aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2006-10-20 02:28:50 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-20 13:26:40 -0400
commite6f684f6443dd37384c63d2f27571350e0b5c8aa (patch)
tree28f36fabb0b54ba06de89901283e082f5aca8e77
parent0dbb4c6799cf8fa8c5ba1926153a30960117477d (diff)
[PATCH] fs/nfs/callback* passes error values big-endian
[pulled from Alexey's patch] Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no> Acked-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/nfs/callback.h6
-rw-r--r--fs/nfs/callback_proc.c6
-rw-r--r--fs/nfs/callback_xdr.c60
3 files changed, 36 insertions, 36 deletions
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h
index 5676163d26e8..6921d82b850b 100644
--- a/fs/nfs/callback.h
+++ b/fs/nfs/callback.h
@@ -44,7 +44,7 @@ struct cb_getattrargs {
44}; 44};
45 45
46struct cb_getattrres { 46struct cb_getattrres {
47 uint32_t status; 47 __be32 status;
48 uint32_t bitmap[2]; 48 uint32_t bitmap[2];
49 uint64_t size; 49 uint64_t size;
50 uint64_t change_attr; 50 uint64_t change_attr;
@@ -59,8 +59,8 @@ struct cb_recallargs {
59 uint32_t truncate; 59 uint32_t truncate;
60}; 60};
61 61
62extern unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res); 62extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res);
63extern unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy); 63extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
64 64
65#ifdef CONFIG_NFS_V4 65#ifdef CONFIG_NFS_V4
66extern int nfs_callback_up(void); 66extern int nfs_callback_up(void);
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 97cf8f71451f..72e55d83756d 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -14,7 +14,7 @@
14 14
15#define NFSDBG_FACILITY NFSDBG_CALLBACK 15#define NFSDBG_FACILITY NFSDBG_CALLBACK
16 16
17unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res) 17__be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res)
18{ 18{
19 struct nfs_client *clp; 19 struct nfs_client *clp;
20 struct nfs_delegation *delegation; 20 struct nfs_delegation *delegation;
@@ -55,11 +55,11 @@ out:
55 return res->status; 55 return res->status;
56} 56}
57 57
58unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy) 58__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
59{ 59{
60 struct nfs_client *clp; 60 struct nfs_client *clp;
61 struct inode *inode; 61 struct inode *inode;
62 unsigned res; 62 __be32 res;
63 63
64 res = htonl(NFS4ERR_BADHANDLE); 64 res = htonl(NFS4ERR_BADHANDLE);
65 clp = nfs_find_client(args->addr, 4); 65 clp = nfs_find_client(args->addr, 4);
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 5998d0c71757..909a1408bcab 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -22,9 +22,9 @@
22 22
23#define NFSDBG_FACILITY NFSDBG_CALLBACK 23#define NFSDBG_FACILITY NFSDBG_CALLBACK
24 24
25typedef unsigned (*callback_process_op_t)(void *, void *); 25typedef __be32 (*callback_process_op_t)(void *, void *);
26typedef unsigned (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *); 26typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
27typedef unsigned (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *); 27typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
28 28
29 29
30struct callback_op { 30struct callback_op {
@@ -61,7 +61,7 @@ static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes)
61 return p; 61 return p;
62} 62}
63 63
64static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str) 64static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str)
65{ 65{
66 uint32_t *p; 66 uint32_t *p;
67 67
@@ -81,7 +81,7 @@ static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const c
81 return 0; 81 return 0;
82} 82}
83 83
84static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) 84static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
85{ 85{
86 uint32_t *p; 86 uint32_t *p;
87 87
@@ -99,7 +99,7 @@ static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
99 return 0; 99 return 0;
100} 100}
101 101
102static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) 102static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
103{ 103{
104 uint32_t *p; 104 uint32_t *p;
105 unsigned int attrlen; 105 unsigned int attrlen;
@@ -118,7 +118,7 @@ static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
118 return 0; 118 return 0;
119} 119}
120 120
121static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) 121static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
122{ 122{
123 uint32_t *p; 123 uint32_t *p;
124 124
@@ -129,11 +129,11 @@ static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
129 return 0; 129 return 0;
130} 130}
131 131
132static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr) 132static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
133{ 133{
134 uint32_t *p; 134 uint32_t *p;
135 unsigned int minor_version; 135 unsigned int minor_version;
136 unsigned status; 136 __be32 status;
137 137
138 status = decode_string(xdr, &hdr->taglen, &hdr->tag); 138 status = decode_string(xdr, &hdr->taglen, &hdr->tag);
139 if (unlikely(status != 0)) 139 if (unlikely(status != 0))
@@ -159,7 +159,7 @@ static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compou
159 return 0; 159 return 0;
160} 160}
161 161
162static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) 162static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
163{ 163{
164 uint32_t *p; 164 uint32_t *p;
165 p = read_buf(xdr, 4); 165 p = read_buf(xdr, 4);
@@ -169,9 +169,9 @@ static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
169 return 0; 169 return 0;
170} 170}
171 171
172static unsigned decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) 172static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args)
173{ 173{
174 unsigned status; 174 __be32 status;
175 175
176 status = decode_fh(xdr, &args->fh); 176 status = decode_fh(xdr, &args->fh);
177 if (unlikely(status != 0)) 177 if (unlikely(status != 0))
@@ -183,10 +183,10 @@ out:
183 return status; 183 return status;
184} 184}
185 185
186static unsigned decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) 186static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args)
187{ 187{
188 uint32_t *p; 188 uint32_t *p;
189 unsigned status; 189 __be32 status;
190 190
191 args->addr = &rqstp->rq_addr; 191 args->addr = &rqstp->rq_addr;
192 status = decode_stateid(xdr, &args->stateid); 192 status = decode_stateid(xdr, &args->stateid);
@@ -204,7 +204,7 @@ out:
204 return status; 204 return status;
205} 205}
206 206
207static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) 207static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
208{ 208{
209 uint32_t *p; 209 uint32_t *p;
210 210
@@ -217,7 +217,7 @@ static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const ch
217 217
218#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE) 218#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE)
219#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY) 219#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY)
220static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep) 220static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep)
221{ 221{
222 uint32_t bm[2]; 222 uint32_t bm[2];
223 uint32_t *p; 223 uint32_t *p;
@@ -247,7 +247,7 @@ static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitma
247 return 0; 247 return 0;
248} 248}
249 249
250static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change) 250static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change)
251{ 251{
252 uint32_t *p; 252 uint32_t *p;
253 253
@@ -260,7 +260,7 @@ static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitma
260 return 0; 260 return 0;
261} 261}
262 262
263static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size) 263static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size)
264{ 264{
265 uint32_t *p; 265 uint32_t *p;
266 266
@@ -273,7 +273,7 @@ static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap,
273 return 0; 273 return 0;
274} 274}
275 275
276static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *time) 276static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec *time)
277{ 277{
278 uint32_t *p; 278 uint32_t *p;
279 279
@@ -285,23 +285,23 @@ static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *
285 return 0; 285 return 0;
286} 286}
287 287
288static unsigned encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) 288static __be32 encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
289{ 289{
290 if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA)) 290 if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA))
291 return 0; 291 return 0;
292 return encode_attr_time(xdr,time); 292 return encode_attr_time(xdr,time);
293} 293}
294 294
295static unsigned encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) 295static __be32 encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
296{ 296{
297 if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY)) 297 if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY))
298 return 0; 298 return 0;
299 return encode_attr_time(xdr,time); 299 return encode_attr_time(xdr,time);
300} 300}
301 301
302static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr) 302static __be32 encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr)
303{ 303{
304 unsigned status; 304 __be32 status;
305 305
306 hdr->status = xdr_reserve_space(xdr, 4); 306 hdr->status = xdr_reserve_space(xdr, 4);
307 if (unlikely(hdr->status == NULL)) 307 if (unlikely(hdr->status == NULL))
@@ -315,7 +315,7 @@ static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compou
315 return 0; 315 return 0;
316} 316}
317 317
318static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res) 318static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
319{ 319{
320 uint32_t *p; 320 uint32_t *p;
321 321
@@ -327,10 +327,10 @@ static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res)
327 return 0; 327 return 0;
328} 328}
329 329
330static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) 330static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res)
331{ 331{
332 uint32_t *savep = NULL; 332 uint32_t *savep = NULL;
333 unsigned status = res->status; 333 __be32 status = res->status;
334 334
335 if (unlikely(status != 0)) 335 if (unlikely(status != 0))
336 goto out; 336 goto out;
@@ -353,15 +353,15 @@ out:
353 return status; 353 return status;
354} 354}
355 355
356static unsigned process_op(struct svc_rqst *rqstp, 356static __be32 process_op(struct svc_rqst *rqstp,
357 struct xdr_stream *xdr_in, void *argp, 357 struct xdr_stream *xdr_in, void *argp,
358 struct xdr_stream *xdr_out, void *resp) 358 struct xdr_stream *xdr_out, void *resp)
359{ 359{
360 struct callback_op *op = &callback_ops[0]; 360 struct callback_op *op = &callback_ops[0];
361 unsigned int op_nr = OP_CB_ILLEGAL; 361 unsigned int op_nr = OP_CB_ILLEGAL;
362 unsigned int status = 0; 362 __be32 status = 0;
363 long maxlen; 363 long maxlen;
364 unsigned res; 364 __be32 res;
365 365
366 dprintk("%s: start\n", __FUNCTION__); 366 dprintk("%s: start\n", __FUNCTION__);
367 status = decode_op_hdr(xdr_in, &op_nr); 367 status = decode_op_hdr(xdr_in, &op_nr);
@@ -405,7 +405,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r
405 struct cb_compound_hdr_res hdr_res; 405 struct cb_compound_hdr_res hdr_res;
406 struct xdr_stream xdr_in, xdr_out; 406 struct xdr_stream xdr_in, xdr_out;
407 uint32_t *p; 407 uint32_t *p;
408 unsigned int status; 408 __be32 status;
409 unsigned int nops = 1; 409 unsigned int nops = 1;
410 410
411 dprintk("%s: start\n", __FUNCTION__); 411 dprintk("%s: start\n", __FUNCTION__);