diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2006-10-20 02:28:50 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:26:40 -0400 |
commit | e6f684f6443dd37384c63d2f27571350e0b5c8aa (patch) | |
tree | 28f36fabb0b54ba06de89901283e082f5aca8e77 /fs/nfs/callback_xdr.c | |
parent | 0dbb4c6799cf8fa8c5ba1926153a30960117477d (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>
Diffstat (limited to 'fs/nfs/callback_xdr.c')
-rw-r--r-- | fs/nfs/callback_xdr.c | 60 |
1 files changed, 30 insertions, 30 deletions
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 | ||
25 | typedef unsigned (*callback_process_op_t)(void *, void *); | 25 | typedef __be32 (*callback_process_op_t)(void *, void *); |
26 | typedef unsigned (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *); | 26 | typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *); |
27 | typedef unsigned (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *); | 27 | typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *); |
28 | 28 | ||
29 | 29 | ||
30 | struct callback_op { | 30 | struct 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 | ||
64 | static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str) | 64 | static __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 | ||
84 | static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) | 84 | static __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 | ||
102 | static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | 102 | static __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 | ||
121 | static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) | 121 | static __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 | ||
132 | static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr) | 132 | static __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 | ||
162 | static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op) | 162 | static __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 | ||
172 | static unsigned decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args) | 172 | static __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 | ||
186 | static unsigned decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args) | 186 | static __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 | ||
207 | static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const char *str) | 207 | static __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) |
220 | static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep) | 220 | static __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 | ||
250 | static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change) | 250 | static __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 | ||
263 | static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size) | 263 | static __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 | ||
276 | static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *time) | 276 | static __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 | ||
288 | static unsigned encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) | 288 | static __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 | ||
295 | static unsigned encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time) | 295 | static __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 | ||
302 | static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr) | 302 | static __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 | ||
318 | static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res) | 318 | static __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 | ||
330 | static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) | 330 | static __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 | ||
356 | static unsigned process_op(struct svc_rqst *rqstp, | 356 | static __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__); |