diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2006-10-20 02:28:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:26:40 -0400 |
commit | 5704fdeb41c9fb282ae576516f221ea0b8f64b2b (patch) | |
tree | b4e3f71f95530659e1f25c51d7d002365ab2e554 | |
parent | e6f684f6443dd37384c63d2f27571350e0b5c8aa (diff) |
[PATCH] xdr annotations: fs/nfs/callback*
on-the-wire data is big-endian
[mostly 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.h | 4 | ||||
-rw-r--r-- | fs/nfs/callback_xdr.c | 44 |
2 files changed, 24 insertions, 24 deletions
diff --git a/fs/nfs/callback.h b/fs/nfs/callback.h index 6921d82b850b..db3d7919c601 100644 --- a/fs/nfs/callback.h +++ b/fs/nfs/callback.h | |||
@@ -31,10 +31,10 @@ struct cb_compound_hdr_arg { | |||
31 | }; | 31 | }; |
32 | 32 | ||
33 | struct cb_compound_hdr_res { | 33 | struct cb_compound_hdr_res { |
34 | uint32_t *status; | 34 | __be32 *status; |
35 | int taglen; | 35 | int taglen; |
36 | const char *tag; | 36 | const char *tag; |
37 | uint32_t *nops; | 37 | __be32 *nops; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | struct cb_getattrargs { | 40 | struct cb_getattrargs { |
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c index 909a1408bcab..f8ea1f51f590 100644 --- a/fs/nfs/callback_xdr.c +++ b/fs/nfs/callback_xdr.c | |||
@@ -41,19 +41,19 @@ static __be32 nfs4_callback_null(struct svc_rqst *rqstp, void *argp, void *resp) | |||
41 | return htonl(NFS4_OK); | 41 | return htonl(NFS4_OK); |
42 | } | 42 | } |
43 | 43 | ||
44 | static int nfs4_decode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) | 44 | static int nfs4_decode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
45 | { | 45 | { |
46 | return xdr_argsize_check(rqstp, p); | 46 | return xdr_argsize_check(rqstp, p); |
47 | } | 47 | } |
48 | 48 | ||
49 | static int nfs4_encode_void(struct svc_rqst *rqstp, uint32_t *p, void *dummy) | 49 | static int nfs4_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy) |
50 | { | 50 | { |
51 | return xdr_ressize_check(rqstp, p); | 51 | return xdr_ressize_check(rqstp, p); |
52 | } | 52 | } |
53 | 53 | ||
54 | static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes) | 54 | static __be32 *read_buf(struct xdr_stream *xdr, int nbytes) |
55 | { | 55 | { |
56 | uint32_t *p; | 56 | __be32 *p; |
57 | 57 | ||
58 | p = xdr_inline_decode(xdr, nbytes); | 58 | p = xdr_inline_decode(xdr, nbytes); |
59 | if (unlikely(p == NULL)) | 59 | if (unlikely(p == NULL)) |
@@ -63,7 +63,7 @@ static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes) | |||
63 | 63 | ||
64 | static __be32 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 | __be32 *p; |
67 | 67 | ||
68 | p = read_buf(xdr, 4); | 68 | p = read_buf(xdr, 4); |
69 | if (unlikely(p == NULL)) | 69 | if (unlikely(p == NULL)) |
@@ -83,7 +83,7 @@ static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len, const cha | |||
83 | 83 | ||
84 | static __be32 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 | __be32 *p; |
87 | 87 | ||
88 | p = read_buf(xdr, 4); | 88 | p = read_buf(xdr, 4); |
89 | if (unlikely(p == NULL)) | 89 | if (unlikely(p == NULL)) |
@@ -101,7 +101,7 @@ static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh) | |||
101 | 101 | ||
102 | static __be32 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 | __be32 *p; |
105 | unsigned int attrlen; | 105 | unsigned int attrlen; |
106 | 106 | ||
107 | p = read_buf(xdr, 4); | 107 | p = read_buf(xdr, 4); |
@@ -120,7 +120,7 @@ static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) | |||
120 | 120 | ||
121 | static __be32 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 | __be32 *p; |
124 | 124 | ||
125 | p = read_buf(xdr, 16); | 125 | p = read_buf(xdr, 16); |
126 | if (unlikely(p == NULL)) | 126 | if (unlikely(p == NULL)) |
@@ -131,7 +131,7 @@ static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid) | |||
131 | 131 | ||
132 | static __be32 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 | __be32 *p; |
135 | unsigned int minor_version; | 135 | unsigned int minor_version; |
136 | __be32 status; | 136 | __be32 status; |
137 | 137 | ||
@@ -161,7 +161,7 @@ static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound | |||
161 | 161 | ||
162 | static __be32 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 | __be32 *p; |
165 | p = read_buf(xdr, 4); | 165 | p = read_buf(xdr, 4); |
166 | if (unlikely(p == NULL)) | 166 | if (unlikely(p == NULL)) |
167 | return htonl(NFS4ERR_RESOURCE); | 167 | return htonl(NFS4ERR_RESOURCE); |
@@ -185,7 +185,7 @@ out: | |||
185 | 185 | ||
186 | static __be32 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 | __be32 *p; |
189 | __be32 status; | 189 | __be32 status; |
190 | 190 | ||
191 | args->addr = &rqstp->rq_addr; | 191 | args->addr = &rqstp->rq_addr; |
@@ -206,7 +206,7 @@ out: | |||
206 | 206 | ||
207 | static __be32 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 | __be32 *p; |
210 | 210 | ||
211 | p = xdr_reserve_space(xdr, 4 + len); | 211 | p = xdr_reserve_space(xdr, 4 + len); |
212 | if (unlikely(p == NULL)) | 212 | if (unlikely(p == NULL)) |
@@ -217,10 +217,10 @@ static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char | |||
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 __be32 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, __be32 **savep) |
221 | { | 221 | { |
222 | uint32_t bm[2]; | 222 | __be32 bm[2]; |
223 | uint32_t *p; | 223 | __be32 *p; |
224 | 224 | ||
225 | bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0); | 225 | bm[0] = htonl(bitmap[0] & CB_SUPPORTED_ATTR0); |
226 | bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1); | 226 | bm[1] = htonl(bitmap[1] & CB_SUPPORTED_ATTR1); |
@@ -249,7 +249,7 @@ static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, | |||
249 | 249 | ||
250 | static __be32 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 | __be32 *p; |
253 | 253 | ||
254 | if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) | 254 | if (!(bitmap[0] & FATTR4_WORD0_CHANGE)) |
255 | return 0; | 255 | return 0; |
@@ -262,7 +262,7 @@ static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, | |||
262 | 262 | ||
263 | static __be32 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 | __be32 *p; |
266 | 266 | ||
267 | if (!(bitmap[0] & FATTR4_WORD0_SIZE)) | 267 | if (!(bitmap[0] & FATTR4_WORD0_SIZE)) |
268 | return 0; | 268 | return 0; |
@@ -275,7 +275,7 @@ static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, u | |||
275 | 275 | ||
276 | static __be32 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 | __be32 *p; |
279 | 279 | ||
280 | p = xdr_reserve_space(xdr, 12); | 280 | p = xdr_reserve_space(xdr, 12); |
281 | if (unlikely(p == 0)) | 281 | if (unlikely(p == 0)) |
@@ -317,7 +317,7 @@ static __be32 encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound | |||
317 | 317 | ||
318 | static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res) | 318 | static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res) |
319 | { | 319 | { |
320 | uint32_t *p; | 320 | __be32 *p; |
321 | 321 | ||
322 | p = xdr_reserve_space(xdr, 8); | 322 | p = xdr_reserve_space(xdr, 8); |
323 | if (unlikely(p == NULL)) | 323 | if (unlikely(p == NULL)) |
@@ -329,7 +329,7 @@ static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res) | |||
329 | 329 | ||
330 | static __be32 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 | __be32 *savep = NULL; |
333 | __be32 status = res->status; | 333 | __be32 status = res->status; |
334 | 334 | ||
335 | if (unlikely(status != 0)) | 335 | if (unlikely(status != 0)) |
@@ -404,7 +404,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r | |||
404 | struct cb_compound_hdr_arg hdr_arg; | 404 | struct cb_compound_hdr_arg hdr_arg; |
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 | __be32 *p; |
408 | __be32 status; | 408 | __be32 status; |
409 | unsigned int nops = 1; | 409 | unsigned int nops = 1; |
410 | 410 | ||
@@ -412,7 +412,7 @@ static __be32 nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *r | |||
412 | 412 | ||
413 | xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); | 413 | xdr_init_decode(&xdr_in, &rqstp->rq_arg, rqstp->rq_arg.head[0].iov_base); |
414 | 414 | ||
415 | p = (uint32_t*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); | 415 | p = (__be32*)((char *)rqstp->rq_res.head[0].iov_base + rqstp->rq_res.head[0].iov_len); |
416 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); | 416 | xdr_init_encode(&xdr_out, &rqstp->rq_res, p); |
417 | 417 | ||
418 | decode_compound_hdr_arg(&xdr_in, &hdr_arg); | 418 | decode_compound_hdr_arg(&xdr_in, &hdr_arg); |