Commit 0dbb4c67 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] xdr annotations: NFS readdir entries

on-the-wire data is big-endian

[in large part pulled from Alexey's patch]
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Acked-by: default avatarTrond Myklebust <trond.myklebust@fys.uio.no>
Acked-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 8687b63a
...@@ -142,12 +142,12 @@ nfs_opendir(struct inode *inode, struct file *filp) ...@@ -142,12 +142,12 @@ nfs_opendir(struct inode *inode, struct file *filp)
return res; return res;
} }
typedef u32 * (*decode_dirent_t)(u32 *, struct nfs_entry *, int); typedef __be32 * (*decode_dirent_t)(__be32 *, struct nfs_entry *, int);
typedef struct { typedef struct {
struct file *file; struct file *file;
struct page *page; struct page *page;
unsigned long page_index; unsigned long page_index;
u32 *ptr; __be32 *ptr;
u64 *dir_cookie; u64 *dir_cookie;
loff_t current_index; loff_t current_index;
struct nfs_entry *entry; struct nfs_entry *entry;
...@@ -220,7 +220,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page) ...@@ -220,7 +220,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
static inline static inline
int dir_decode(nfs_readdir_descriptor_t *desc) int dir_decode(nfs_readdir_descriptor_t *desc)
{ {
u32 *p = desc->ptr; __be32 *p = desc->ptr;
p = desc->decode(p, desc->entry, desc->plus); p = desc->decode(p, desc->entry, desc->plus);
if (IS_ERR(p)) if (IS_ERR(p))
return PTR_ERR(p); return PTR_ERR(p);
......
...@@ -93,15 +93,15 @@ extern void nfs_destroy_directcache(void); ...@@ -93,15 +93,15 @@ extern void nfs_destroy_directcache(void);
/* nfs2xdr.c */ /* nfs2xdr.c */
extern int nfs_stat_to_errno(int); extern int nfs_stat_to_errno(int);
extern struct rpc_procinfo nfs_procedures[]; extern struct rpc_procinfo nfs_procedures[];
extern u32 * nfs_decode_dirent(u32 *, struct nfs_entry *, int); extern __be32 * nfs_decode_dirent(__be32 *, struct nfs_entry *, int);
/* nfs3xdr.c */ /* nfs3xdr.c */
extern struct rpc_procinfo nfs3_procedures[]; extern struct rpc_procinfo nfs3_procedures[];
extern u32 *nfs3_decode_dirent(u32 *, struct nfs_entry *, int); extern __be32 *nfs3_decode_dirent(__be32 *, struct nfs_entry *, int);
/* nfs4xdr.c */ /* nfs4xdr.c */
#ifdef CONFIG_NFS_V4 #ifdef CONFIG_NFS_V4
extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
#endif #endif
/* nfs4proc.c */ /* nfs4proc.c */
......
...@@ -468,8 +468,8 @@ nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy) ...@@ -468,8 +468,8 @@ nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy)
goto out; goto out;
} }
u32 * __be32 *
nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) nfs_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
{ {
if (!*p++) { if (!*p++) {
if (!*p) if (!*p)
......
...@@ -583,8 +583,8 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res ...@@ -583,8 +583,8 @@ nfs3_xdr_readdirres(struct rpc_rqst *req, __be32 *p, struct nfs3_readdirres *res
goto out; goto out;
} }
u32 * __be32 *
nfs3_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) nfs3_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
{ {
struct nfs_entry old = *entry; struct nfs_entry old = *entry;
......
...@@ -212,7 +212,7 @@ extern void nfs_free_seqid(struct nfs_seqid *seqid); ...@@ -212,7 +212,7 @@ extern void nfs_free_seqid(struct nfs_seqid *seqid);
extern const nfs4_stateid zero_stateid; extern const nfs4_stateid zero_stateid;
/* nfs4xdr.c */ /* nfs4xdr.c */
extern uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus); extern __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus);
extern struct rpc_procinfo nfs4_procedures[]; extern struct rpc_procinfo nfs4_procedures[];
struct nfs4_mount_data; struct nfs4_mount_data;
......
...@@ -141,7 +141,7 @@ const u32 nfs4_fs_locations_bitmap[2] = { ...@@ -141,7 +141,7 @@ const u32 nfs4_fs_locations_bitmap[2] = {
static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry, static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry,
struct nfs4_readdir_arg *readdir) struct nfs4_readdir_arg *readdir)
{ {
u32 *start, *p; __be32 *start, *p;
BUG_ON(readdir->count < 80); BUG_ON(readdir->count < 80);
if (cookie > 2) { if (cookie > 2) {
...@@ -162,7 +162,7 @@ static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry, ...@@ -162,7 +162,7 @@ static void nfs4_setup_readdir(u64 cookie, u32 *verifier, struct dentry *dentry,
* when talking to the server, we always send cookie 0 * when talking to the server, we always send cookie 0
* instead of 1 or 2. * instead of 1 or 2.
*/ */
start = p = (u32 *)kmap_atomic(*readdir->pages, KM_USER0); start = p = kmap_atomic(*readdir->pages, KM_USER0);
if (cookie == 0) { if (cookie == 0) {
*p++ = xdr_one; /* next */ *p++ = xdr_one; /* next */
......
...@@ -4421,7 +4421,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs ...@@ -4421,7 +4421,7 @@ static int nfs4_xdr_dec_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs
return status; return status;
} }
uint32_t *nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus) __be32 *nfs4_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus)
{ {
uint32_t bitmap[2] = {0}; uint32_t bitmap[2] = {0};
uint32_t len; uint32_t len;
......
...@@ -811,7 +811,7 @@ struct nfs_rpc_ops { ...@@ -811,7 +811,7 @@ struct nfs_rpc_ops {
int (*pathconf) (struct nfs_server *, struct nfs_fh *, int (*pathconf) (struct nfs_server *, struct nfs_fh *,
struct nfs_pathconf *); struct nfs_pathconf *);
int (*set_capabilities)(struct nfs_server *, struct nfs_fh *); int (*set_capabilities)(struct nfs_server *, struct nfs_fh *);
u32 * (*decode_dirent)(u32 *, struct nfs_entry *, int plus); __be32 *(*decode_dirent)(__be32 *, struct nfs_entry *, int plus);
void (*read_setup) (struct nfs_read_data *); void (*read_setup) (struct nfs_read_data *);
int (*read_done) (struct rpc_task *, struct nfs_read_data *); int (*read_done) (struct rpc_task *, struct nfs_read_data *);
void (*write_setup) (struct nfs_write_data *, int how); void (*write_setup) (struct nfs_write_data *, int how);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment