X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=fs%2Fnfs%2Fnfs2xdr.c;h=cd3ca7b5d3dbfd0dda765505fe086f7288f37d32;hb=HEAD;hp=b49501fc0a7985927d87d0d69042ec2995c7dc3b;hpb=7ff3e52cf2947ebd38c84159af68e5a29d228f6c;p=powerpc.git diff --git a/fs/nfs/nfs2xdr.c b/fs/nfs/nfs2xdr.c index b49501fc0a..cd3ca7b5d3 100644 --- a/fs/nfs/nfs2xdr.c +++ b/fs/nfs/nfs2xdr.c @@ -26,7 +26,6 @@ #include "internal.h" #define NFSDBG_FACILITY NFSDBG_XDR -/* #define NFS_PARANOIA 1 */ /* Mapping from NFS error code to "errno" error code. */ #define errno_NFSERR_IO EIO @@ -66,15 +65,15 @@ /* * Common NFS XDR functions as inlines */ -static inline u32 * -xdr_encode_fhandle(u32 *p, struct nfs_fh *fhandle) +static inline __be32 * +xdr_encode_fhandle(__be32 *p, struct nfs_fh *fhandle) { memcpy(p, fhandle->data, NFS2_FHSIZE); return p + XDR_QUADLEN(NFS2_FHSIZE); } -static inline u32 * -xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle) +static inline __be32 * +xdr_decode_fhandle(__be32 *p, struct nfs_fh *fhandle) { /* NFSv2 handles have a fixed length */ fhandle->size = NFS2_FHSIZE; @@ -82,8 +81,8 @@ xdr_decode_fhandle(u32 *p, struct nfs_fh *fhandle) return p + XDR_QUADLEN(NFS2_FHSIZE); } -static inline u32* -xdr_encode_time(u32 *p, struct timespec *timep) +static inline __be32* +xdr_encode_time(__be32 *p, struct timespec *timep) { *p++ = htonl(timep->tv_sec); /* Convert nanoseconds into microseconds */ @@ -91,8 +90,8 @@ xdr_encode_time(u32 *p, struct timespec *timep) return p; } -static inline u32* -xdr_encode_current_server_time(u32 *p, struct timespec *timep) +static inline __be32* +xdr_encode_current_server_time(__be32 *p, struct timespec *timep) { /* * Passing the invalid value useconds=1000000 is a @@ -108,8 +107,8 @@ xdr_encode_current_server_time(u32 *p, struct timespec *timep) return p; } -static inline u32* -xdr_decode_time(u32 *p, struct timespec *timep) +static inline __be32* +xdr_decode_time(__be32 *p, struct timespec *timep) { timep->tv_sec = ntohl(*p++); /* Convert microseconds into nanoseconds */ @@ -117,8 +116,8 @@ xdr_decode_time(u32 *p, struct timespec *timep) return p; } -static u32 * -xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) +static __be32 * +xdr_decode_fattr(__be32 *p, struct nfs_fattr *fattr) { u32 rdev; fattr->type = (enum nfs_ftype) ntohl(*p++); @@ -146,10 +145,10 @@ xdr_decode_fattr(u32 *p, struct nfs_fattr *fattr) return p; } -static inline u32 * -xdr_encode_sattr(u32 *p, struct iattr *attr) +static inline __be32 * +xdr_encode_sattr(__be32 *p, struct iattr *attr) { - const u32 not_set = __constant_htonl(0xFFFFFFFF); + const __be32 not_set = __constant_htonl(0xFFFFFFFF); *p++ = (attr->ia_valid & ATTR_MODE) ? htonl(attr->ia_mode) : not_set; *p++ = (attr->ia_valid & ATTR_UID) ? htonl(attr->ia_uid) : not_set; @@ -184,7 +183,7 @@ xdr_encode_sattr(u32 *p, struct iattr *attr) * GETATTR, READLINK, STATFS */ static int -nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) +nfs_xdr_fhandle(struct rpc_rqst *req, __be32 *p, struct nfs_fh *fh) { p = xdr_encode_fhandle(p, fh); req->rq_slen = xdr_adjust_iovec(req->rq_svec, p); @@ -195,7 +194,7 @@ nfs_xdr_fhandle(struct rpc_rqst *req, u32 *p, struct nfs_fh *fh) * Encode SETATTR arguments */ static int -nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args) +nfs_xdr_sattrargs(struct rpc_rqst *req, __be32 *p, struct nfs_sattrargs *args) { p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_sattr(p, args->sattr); @@ -208,7 +207,7 @@ nfs_xdr_sattrargs(struct rpc_rqst *req, u32 *p, struct nfs_sattrargs *args) * LOOKUP, REMOVE, RMDIR */ static int -nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args) +nfs_xdr_diropargs(struct rpc_rqst *req, __be32 *p, struct nfs_diropargs *args) { p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_array(p, args->name, args->len); @@ -222,7 +221,7 @@ nfs_xdr_diropargs(struct rpc_rqst *req, u32 *p, struct nfs_diropargs *args) * exactly to the page we want to fetch. */ static int -nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) +nfs_xdr_readargs(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) { struct rpc_auth *auth = req->rq_task->tk_auth; unsigned int replen; @@ -246,7 +245,7 @@ nfs_xdr_readargs(struct rpc_rqst *req, u32 *p, struct nfs_readargs *args) * Decode READ reply */ static int -nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) +nfs_xdr_readres(struct rpc_rqst *req, __be32 *p, struct nfs_readres *res) { struct kvec *iov = req->rq_rcv_buf.head; int status, count, recvd, hdrlen; @@ -286,7 +285,7 @@ nfs_xdr_readres(struct rpc_rqst *req, u32 *p, struct nfs_readres *res) * Write arguments. Splice the buffer to be written into the iovec. */ static int -nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) +nfs_xdr_writeargs(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args) { struct xdr_buf *sndbuf = &req->rq_snd_buf; u32 offset = (u32)args->offset; @@ -309,7 +308,7 @@ nfs_xdr_writeargs(struct rpc_rqst *req, u32 *p, struct nfs_writeargs *args) * CREATE, MKDIR */ static int -nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args) +nfs_xdr_createargs(struct rpc_rqst *req, __be32 *p, struct nfs_createargs *args) { p = xdr_encode_fhandle(p, args->fh); p = xdr_encode_array(p, args->name, args->len); @@ -322,7 +321,7 @@ nfs_xdr_createargs(struct rpc_rqst *req, u32 *p, struct nfs_createargs *args) * Encode RENAME arguments */ static int -nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args) +nfs_xdr_renameargs(struct rpc_rqst *req, __be32 *p, struct nfs_renameargs *args) { p = xdr_encode_fhandle(p, args->fromfh); p = xdr_encode_array(p, args->fromname, args->fromlen); @@ -336,7 +335,7 @@ nfs_xdr_renameargs(struct rpc_rqst *req, u32 *p, struct nfs_renameargs *args) * Encode LINK arguments */ static int -nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args) +nfs_xdr_linkargs(struct rpc_rqst *req, __be32 *p, struct nfs_linkargs *args) { p = xdr_encode_fhandle(p, args->fromfh); p = xdr_encode_fhandle(p, args->tofh); @@ -349,7 +348,7 @@ nfs_xdr_linkargs(struct rpc_rqst *req, u32 *p, struct nfs_linkargs *args) * Encode SYMLINK arguments */ static int -nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args) +nfs_xdr_symlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_symlinkargs *args) { struct xdr_buf *sndbuf = &req->rq_snd_buf; size_t pad; @@ -378,7 +377,7 @@ nfs_xdr_symlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_symlinkargs *args) * Encode arguments to readdir call */ static int -nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args) +nfs_xdr_readdirargs(struct rpc_rqst *req, __be32 *p, struct nfs_readdirargs *args) { struct rpc_task *task = req->rq_task; struct rpc_auth *auth = task->tk_auth; @@ -404,7 +403,7 @@ nfs_xdr_readdirargs(struct rpc_rqst *req, u32 *p, struct nfs_readdirargs *args) * from nfs_readdir for each entry. */ static int -nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) +nfs_xdr_readdirres(struct rpc_rqst *req, __be32 *p, void *dummy) { struct xdr_buf *rcvbuf = &req->rq_rcv_buf; struct kvec *iov = rcvbuf->head; @@ -412,7 +411,7 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) int hdrlen, recvd; int status, nr; unsigned int len, pglen; - u32 *end, *entry, *kaddr; + __be32 *end, *entry, *kaddr; if ((status = ntohl(*p++))) return -nfs_stat_to_errno(status); @@ -432,8 +431,8 @@ nfs_xdr_readdirres(struct rpc_rqst *req, u32 *p, void *dummy) if (pglen > recvd) pglen = recvd; page = rcvbuf->pages; - kaddr = p = (u32 *)kmap_atomic(*page, KM_USER0); - end = (u32 *)((char *)p + pglen); + kaddr = p = kmap_atomic(*page, KM_USER0); + end = (__be32 *)((char *)p + pglen); entry = p; for (nr = 0; *p++; nr++) { if (p + 2 > end) @@ -468,8 +467,8 @@ err_unmap: goto out; } -u32 * -nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) +__be32 * +nfs_decode_dirent(__be32 *p, struct nfs_entry *entry, int plus) { if (!*p++) { if (!*p) @@ -496,7 +495,7 @@ nfs_decode_dirent(u32 *p, struct nfs_entry *entry, int plus) * Decode simple status reply */ static int -nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy) +nfs_xdr_stat(struct rpc_rqst *req, __be32 *p, void *dummy) { int status; @@ -510,7 +509,7 @@ nfs_xdr_stat(struct rpc_rqst *req, u32 *p, void *dummy) * GETATTR, SETATTR, WRITE */ static int -nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) +nfs_xdr_attrstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) { int status; @@ -525,7 +524,7 @@ nfs_xdr_attrstat(struct rpc_rqst *req, u32 *p, struct nfs_fattr *fattr) * LOOKUP, CREATE, MKDIR */ static int -nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res) +nfs_xdr_diropres(struct rpc_rqst *req, __be32 *p, struct nfs_diropok *res) { int status; @@ -540,7 +539,7 @@ nfs_xdr_diropres(struct rpc_rqst *req, u32 *p, struct nfs_diropok *res) * Encode READLINK args */ static int -nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args) +nfs_xdr_readlinkargs(struct rpc_rqst *req, __be32 *p, struct nfs_readlinkargs *args) { struct rpc_auth *auth = req->rq_task->tk_auth; unsigned int replen; @@ -558,7 +557,7 @@ nfs_xdr_readlinkargs(struct rpc_rqst *req, u32 *p, struct nfs_readlinkargs *args * Decode READLINK reply */ static int -nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy) +nfs_xdr_readlinkres(struct rpc_rqst *req, __be32 *p, void *dummy) { struct xdr_buf *rcvbuf = &req->rq_rcv_buf; struct kvec *iov = rcvbuf->head; @@ -601,7 +600,7 @@ nfs_xdr_readlinkres(struct rpc_rqst *req, u32 *p, void *dummy) * Decode WRITE reply */ static int -nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) +nfs_xdr_writeres(struct rpc_rqst *req, __be32 *p, struct nfs_writeres *res) { res->verf->committed = NFS_FILE_SYNC; return nfs_xdr_attrstat(req, p, res->fattr); @@ -611,7 +610,7 @@ nfs_xdr_writeres(struct rpc_rqst *req, u32 *p, struct nfs_writeres *res) * Decode STATFS reply */ static int -nfs_xdr_statfsres(struct rpc_rqst *req, u32 *p, struct nfs2_fsstat *res) +nfs_xdr_statfsres(struct rpc_rqst *req, __be32 *p, struct nfs2_fsstat *res) { int status; @@ -687,16 +686,13 @@ nfs_stat_to_errno(int stat) return nfs_errtbl[i].errno; } -#ifndef MAX -# define MAX(a, b) (((a) > (b))? (a) : (b)) -#endif - #define PROC(proc, argtype, restype, timer) \ [NFSPROC_##proc] = { \ .p_proc = NFSPROC_##proc, \ .p_encode = (kxdrproc_t) nfs_xdr_##argtype, \ .p_decode = (kxdrproc_t) nfs_xdr_##restype, \ - .p_bufsiz = MAX(NFS_##argtype##_sz,NFS_##restype##_sz) << 2, \ + .p_arglen = NFS_##argtype##_sz, \ + .p_replen = NFS_##restype##_sz, \ .p_timer = timer, \ .p_statidx = NFSPROC_##proc, \ .p_name = #proc, \