Commit 2ebbc012a9433a252be7ab4ce54e94bf7b21e506
Committed by
Linus Torvalds
1 parent
91f07168ce
[PATCH] xdr annotations: NFSv4 server
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>
Showing 3 changed files with 46 additions and 46 deletions Side-by-side Diff
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4xdr.c
... | ... | @@ -94,7 +94,7 @@ |
94 | 94 | * consistent with the style used in NFSv2/v3... |
95 | 95 | */ |
96 | 96 | #define DECODE_HEAD \ |
97 | - u32 *p; \ | |
97 | + __be32 *p; \ | |
98 | 98 | int status |
99 | 99 | #define DECODE_TAIL \ |
100 | 100 | status = 0; \ |
101 | 101 | |
... | ... | @@ -144,13 +144,13 @@ |
144 | 144 | } \ |
145 | 145 | } while (0) |
146 | 146 | |
147 | -static u32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) | |
147 | +static __be32 *read_buf(struct nfsd4_compoundargs *argp, int nbytes) | |
148 | 148 | { |
149 | 149 | /* We want more bytes than seem to be available. |
150 | 150 | * Maybe we need a new page, maybe we have just run out |
151 | 151 | */ |
152 | 152 | int avail = (char*)argp->end - (char*)argp->p; |
153 | - u32 *p; | |
153 | + __be32 *p; | |
154 | 154 | if (avail + argp->pagelen < nbytes) |
155 | 155 | return NULL; |
156 | 156 | if (avail + PAGE_SIZE < nbytes) /* need more than a page !! */ |
... | ... | @@ -197,7 +197,7 @@ |
197 | 197 | return 0; |
198 | 198 | } |
199 | 199 | |
200 | -static char *savemem(struct nfsd4_compoundargs *argp, u32 *p, int nbytes) | |
200 | +static char *savemem(struct nfsd4_compoundargs *argp, __be32 *p, int nbytes) | |
201 | 201 | { |
202 | 202 | void *new = NULL; |
203 | 203 | if (p == argp->tmp) { |
... | ... | @@ -951,8 +951,8 @@ |
951 | 951 | argp->pagelen -= len; |
952 | 952 | } |
953 | 953 | } |
954 | - argp->end = (u32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); | |
955 | - argp->p = (u32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); | |
954 | + argp->end = (__be32*) (argp->rqstp->rq_vec[v].iov_base + argp->rqstp->rq_vec[v].iov_len); | |
955 | + argp->p = (__be32*) (argp->rqstp->rq_vec[v].iov_base + (XDR_QUADLEN(len) << 2)); | |
956 | 956 | argp->rqstp->rq_vec[v].iov_len = len; |
957 | 957 | write->wr_vlen = v+1; |
958 | 958 | |
... | ... | @@ -1179,7 +1179,7 @@ |
1179 | 1179 | * task to translate them into Linux-specific versions which are more |
1180 | 1180 | * consistent with the style used in NFSv2/v3... |
1181 | 1181 | */ |
1182 | -#define ENCODE_HEAD u32 *p | |
1182 | +#define ENCODE_HEAD __be32 *p | |
1183 | 1183 | |
1184 | 1184 | #define WRITE32(n) *p++ = htonl(n) |
1185 | 1185 | #define WRITE64(n) do { \ |
... | ... | @@ -1209,8 +1209,8 @@ |
1209 | 1209 | * Header routine to setup seqid operation replay cache |
1210 | 1210 | */ |
1211 | 1211 | #define ENCODE_SEQID_OP_HEAD \ |
1212 | - u32 *p; \ | |
1213 | - u32 *save; \ | |
1212 | + __be32 *p; \ | |
1213 | + __be32 *save; \ | |
1214 | 1214 | \ |
1215 | 1215 | save = resp->p; |
1216 | 1216 | |
1217 | 1217 | |
... | ... | @@ -1235,10 +1235,10 @@ |
1235 | 1235 | * seperated @sep. |
1236 | 1236 | */ |
1237 | 1237 | static int nfsd4_encode_components(char sep, char *components, |
1238 | - u32 **pp, int *buflen) | |
1238 | + __be32 **pp, int *buflen) | |
1239 | 1239 | { |
1240 | - u32 *p = *pp; | |
1241 | - u32 *countp = p; | |
1240 | + __be32 *p = *pp; | |
1241 | + __be32 *countp = p; | |
1242 | 1242 | int strlen, count=0; |
1243 | 1243 | char *str, *end; |
1244 | 1244 | |
1245 | 1245 | |
... | ... | @@ -1272,10 +1272,10 @@ |
1272 | 1272 | * encode a location element of a fs_locations structure |
1273 | 1273 | */ |
1274 | 1274 | static int nfsd4_encode_fs_location4(struct nfsd4_fs_location *location, |
1275 | - u32 **pp, int *buflen) | |
1275 | + __be32 **pp, int *buflen) | |
1276 | 1276 | { |
1277 | 1277 | int status; |
1278 | - u32 *p = *pp; | |
1278 | + __be32 *p = *pp; | |
1279 | 1279 | |
1280 | 1280 | status = nfsd4_encode_components(':', location->hosts, &p, buflen); |
1281 | 1281 | if (status) |
1282 | 1282 | |
... | ... | @@ -1320,11 +1320,11 @@ |
1320 | 1320 | */ |
1321 | 1321 | static int nfsd4_encode_fs_locations(struct svc_rqst *rqstp, |
1322 | 1322 | struct svc_export *exp, |
1323 | - u32 **pp, int *buflen) | |
1323 | + __be32 **pp, int *buflen) | |
1324 | 1324 | { |
1325 | 1325 | u32 status; |
1326 | 1326 | int i; |
1327 | - u32 *p = *pp; | |
1327 | + __be32 *p = *pp; | |
1328 | 1328 | struct nfsd4_fs_locations *fslocs = &exp->ex_fslocs; |
1329 | 1329 | char *root = nfsd4_path(rqstp, exp, &status); |
1330 | 1330 | |
... | ... | @@ -1355,7 +1355,7 @@ |
1355 | 1355 | |
1356 | 1356 | static int |
1357 | 1357 | nfsd4_encode_name(struct svc_rqst *rqstp, int whotype, uid_t id, int group, |
1358 | - u32 **p, int *buflen) | |
1358 | + __be32 **p, int *buflen) | |
1359 | 1359 | { |
1360 | 1360 | int status; |
1361 | 1361 | |
1362 | 1362 | |
1363 | 1363 | |
... | ... | @@ -1376,20 +1376,20 @@ |
1376 | 1376 | } |
1377 | 1377 | |
1378 | 1378 | static inline int |
1379 | -nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, u32 **p, int *buflen) | |
1379 | +nfsd4_encode_user(struct svc_rqst *rqstp, uid_t uid, __be32 **p, int *buflen) | |
1380 | 1380 | { |
1381 | 1381 | return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, uid, 0, p, buflen); |
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | static inline int |
1385 | -nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, u32 **p, int *buflen) | |
1385 | +nfsd4_encode_group(struct svc_rqst *rqstp, uid_t gid, __be32 **p, int *buflen) | |
1386 | 1386 | { |
1387 | 1387 | return nfsd4_encode_name(rqstp, NFS4_ACL_WHO_NAMED, gid, 1, p, buflen); |
1388 | 1388 | } |
1389 | 1389 | |
1390 | 1390 | static inline int |
1391 | 1391 | nfsd4_encode_aclname(struct svc_rqst *rqstp, int whotype, uid_t id, int group, |
1392 | - u32 **p, int *buflen) | |
1392 | + __be32 **p, int *buflen) | |
1393 | 1393 | { |
1394 | 1394 | return nfsd4_encode_name(rqstp, whotype, id, group, p, buflen); |
1395 | 1395 | } |
... | ... | @@ -1423,7 +1423,7 @@ |
1423 | 1423 | */ |
1424 | 1424 | int |
1425 | 1425 | nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp, |
1426 | - struct dentry *dentry, u32 *buffer, int *countp, u32 *bmval, | |
1426 | + struct dentry *dentry, __be32 *buffer, int *countp, u32 *bmval, | |
1427 | 1427 | struct svc_rqst *rqstp) |
1428 | 1428 | { |
1429 | 1429 | u32 bmval0 = bmval[0]; |
1430 | 1430 | |
... | ... | @@ -1432,11 +1432,11 @@ |
1432 | 1432 | struct svc_fh tempfh; |
1433 | 1433 | struct kstatfs statfs; |
1434 | 1434 | int buflen = *countp << 2; |
1435 | - u32 *attrlenp; | |
1435 | + __be32 *attrlenp; | |
1436 | 1436 | u32 dummy; |
1437 | 1437 | u64 dummy64; |
1438 | 1438 | u32 rdattr_err = 0; |
1439 | - u32 *p = buffer; | |
1439 | + __be32 *p = buffer; | |
1440 | 1440 | int status; |
1441 | 1441 | int aclsupport = 0; |
1442 | 1442 | struct nfs4_acl *acl = NULL; |
... | ... | @@ -1831,7 +1831,7 @@ |
1831 | 1831 | |
1832 | 1832 | static int |
1833 | 1833 | nfsd4_encode_dirent_fattr(struct nfsd4_readdir *cd, |
1834 | - const char *name, int namlen, u32 *p, int *buflen) | |
1834 | + const char *name, int namlen, __be32 *p, int *buflen) | |
1835 | 1835 | { |
1836 | 1836 | struct svc_export *exp = cd->rd_fhp->fh_export; |
1837 | 1837 | struct dentry *dentry; |
1838 | 1838 | |
... | ... | @@ -1864,10 +1864,10 @@ |
1864 | 1864 | return nfserr; |
1865 | 1865 | } |
1866 | 1866 | |
1867 | -static u32 * | |
1868 | -nfsd4_encode_rdattr_error(u32 *p, int buflen, int nfserr) | |
1867 | +static __be32 * | |
1868 | +nfsd4_encode_rdattr_error(__be32 *p, int buflen, int nfserr) | |
1869 | 1869 | { |
1870 | - u32 *attrlenp; | |
1870 | + __be32 *attrlenp; | |
1871 | 1871 | |
1872 | 1872 | if (buflen < 6) |
1873 | 1873 | return NULL; |
... | ... | @@ -1887,7 +1887,7 @@ |
1887 | 1887 | { |
1888 | 1888 | struct nfsd4_readdir *cd = container_of(ccd, struct nfsd4_readdir, common); |
1889 | 1889 | int buflen; |
1890 | - u32 *p = cd->buffer; | |
1890 | + __be32 *p = cd->buffer; | |
1891 | 1891 | int nfserr = nfserr_toosmall; |
1892 | 1892 | |
1893 | 1893 | /* In nfsv4, "." and ".." never make it onto the wire.. */ |
... | ... | @@ -2321,7 +2321,7 @@ |
2321 | 2321 | { |
2322 | 2322 | int maxcount; |
2323 | 2323 | loff_t offset; |
2324 | - u32 *page, *savep, *tailbase; | |
2324 | + __be32 *page, *savep, *tailbase; | |
2325 | 2325 | ENCODE_HEAD; |
2326 | 2326 | |
2327 | 2327 | if (nfserr) |
... | ... | @@ -2479,7 +2479,7 @@ |
2479 | 2479 | void |
2480 | 2480 | nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op) |
2481 | 2481 | { |
2482 | - u32 *statp; | |
2482 | + __be32 *statp; | |
2483 | 2483 | ENCODE_HEAD; |
2484 | 2484 | |
2485 | 2485 | RESERVE_SPACE(8); |
... | ... | @@ -2617,7 +2617,7 @@ |
2617 | 2617 | */ |
2618 | 2618 | |
2619 | 2619 | int |
2620 | -nfs4svc_encode_voidres(struct svc_rqst *rqstp, u32 *p, void *dummy) | |
2620 | +nfs4svc_encode_voidres(struct svc_rqst *rqstp, __be32 *p, void *dummy) | |
2621 | 2621 | { |
2622 | 2622 | return xdr_ressize_check(rqstp, p); |
2623 | 2623 | } |
... | ... | @@ -2639,7 +2639,7 @@ |
2639 | 2639 | } |
2640 | 2640 | |
2641 | 2641 | int |
2642 | -nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundargs *args) | |
2642 | +nfs4svc_decode_compoundargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundargs *args) | |
2643 | 2643 | { |
2644 | 2644 | int status; |
2645 | 2645 | |
... | ... | @@ -2660,7 +2660,7 @@ |
2660 | 2660 | } |
2661 | 2661 | |
2662 | 2662 | int |
2663 | -nfs4svc_encode_compoundres(struct svc_rqst *rqstp, u32 *p, struct nfsd4_compoundres *resp) | |
2663 | +nfs4svc_encode_compoundres(struct svc_rqst *rqstp, __be32 *p, struct nfsd4_compoundres *resp) | |
2664 | 2664 | { |
2665 | 2665 | /* |
2666 | 2666 | * All that remains is to write the tag and operation count... |
include/linux/nfsd/xdr4.h
... | ... | @@ -258,9 +258,9 @@ |
258 | 258 | struct svc_fh * rd_fhp; /* response */ |
259 | 259 | |
260 | 260 | struct readdir_cd common; |
261 | - u32 * buffer; | |
261 | + __be32 * buffer; | |
262 | 262 | int buflen; |
263 | - u32 * offset; | |
263 | + __be32 * offset; | |
264 | 264 | }; |
265 | 265 | |
266 | 266 | struct nfsd4_release_lockowner { |
267 | 267 | |
... | ... | @@ -371,12 +371,12 @@ |
371 | 371 | |
372 | 372 | struct nfsd4_compoundargs { |
373 | 373 | /* scratch variables for XDR decode */ |
374 | - u32 * p; | |
375 | - u32 * end; | |
374 | + __be32 * p; | |
375 | + __be32 * end; | |
376 | 376 | struct page ** pagelist; |
377 | 377 | int pagelen; |
378 | - u32 tmp[8]; | |
379 | - u32 * tmpp; | |
378 | + __be32 tmp[8]; | |
379 | + __be32 * tmpp; | |
380 | 380 | struct tmpbuf { |
381 | 381 | struct tmpbuf *next; |
382 | 382 | void (*release)(const void *); |
383 | 383 | |
... | ... | @@ -395,15 +395,15 @@ |
395 | 395 | |
396 | 396 | struct nfsd4_compoundres { |
397 | 397 | /* scratch variables for XDR encode */ |
398 | - u32 * p; | |
399 | - u32 * end; | |
398 | + __be32 * p; | |
399 | + __be32 * end; | |
400 | 400 | struct xdr_buf * xbuf; |
401 | 401 | struct svc_rqst * rqstp; |
402 | 402 | |
403 | 403 | u32 taglen; |
404 | 404 | char * tag; |
405 | 405 | u32 opcnt; |
406 | - u32 * tagp; /* where to encode tag and opcount */ | |
406 | + __be32 * tagp; /* where to encode tag and opcount */ | |
407 | 407 | }; |
408 | 408 | |
409 | 409 | #define NFS4_SVC_XDRSIZE sizeof(struct nfsd4_compoundargs) |
410 | 410 | |
... | ... | @@ -419,10 +419,10 @@ |
419 | 419 | cinfo->after_ctime_nsec = fhp->fh_post_ctime.tv_nsec; |
420 | 420 | } |
421 | 421 | |
422 | -int nfs4svc_encode_voidres(struct svc_rqst *, u32 *, void *); | |
423 | -int nfs4svc_decode_compoundargs(struct svc_rqst *, u32 *, | |
422 | +int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); | |
423 | +int nfs4svc_decode_compoundargs(struct svc_rqst *, __be32 *, | |
424 | 424 | struct nfsd4_compoundargs *); |
425 | -int nfs4svc_encode_compoundres(struct svc_rqst *, u32 *, | |
425 | +int nfs4svc_encode_compoundres(struct svc_rqst *, __be32 *, | |
426 | 426 | struct nfsd4_compoundres *); |
427 | 427 | void nfsd4_encode_operation(struct nfsd4_compoundres *, struct nfsd4_op *); |
428 | 428 | void nfsd4_encode_replay(struct nfsd4_compoundres *resp, struct nfsd4_op *op); |