[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>
This commit is contained in:
parent
0dbb4c6799
commit
e6f684f644
|
@ -44,7 +44,7 @@ struct cb_getattrargs {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cb_getattrres {
|
struct cb_getattrres {
|
||||||
uint32_t status;
|
__be32 status;
|
||||||
uint32_t bitmap[2];
|
uint32_t bitmap[2];
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
uint64_t change_attr;
|
uint64_t change_attr;
|
||||||
|
@ -59,8 +59,8 @@ struct cb_recallargs {
|
||||||
uint32_t truncate;
|
uint32_t truncate;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res);
|
extern __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res);
|
||||||
extern unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
|
extern __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy);
|
||||||
|
|
||||||
#ifdef CONFIG_NFS_V4
|
#ifdef CONFIG_NFS_V4
|
||||||
extern int nfs_callback_up(void);
|
extern int nfs_callback_up(void);
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
#define NFSDBG_FACILITY NFSDBG_CALLBACK
|
#define NFSDBG_FACILITY NFSDBG_CALLBACK
|
||||||
|
|
||||||
unsigned nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res)
|
__be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *res)
|
||||||
{
|
{
|
||||||
struct nfs_client *clp;
|
struct nfs_client *clp;
|
||||||
struct nfs_delegation *delegation;
|
struct nfs_delegation *delegation;
|
||||||
|
@ -55,11 +55,11 @@ out:
|
||||||
return res->status;
|
return res->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
|
__be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
|
||||||
{
|
{
|
||||||
struct nfs_client *clp;
|
struct nfs_client *clp;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
unsigned res;
|
__be32 res;
|
||||||
|
|
||||||
res = htonl(NFS4ERR_BADHANDLE);
|
res = htonl(NFS4ERR_BADHANDLE);
|
||||||
clp = nfs_find_client(args->addr, 4);
|
clp = nfs_find_client(args->addr, 4);
|
||||||
|
|
|
@ -22,9 +22,9 @@
|
||||||
|
|
||||||
#define NFSDBG_FACILITY NFSDBG_CALLBACK
|
#define NFSDBG_FACILITY NFSDBG_CALLBACK
|
||||||
|
|
||||||
typedef unsigned (*callback_process_op_t)(void *, void *);
|
typedef __be32 (*callback_process_op_t)(void *, void *);
|
||||||
typedef unsigned (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
|
typedef __be32 (*callback_decode_arg_t)(struct svc_rqst *, struct xdr_stream *, void *);
|
||||||
typedef unsigned (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
|
typedef __be32 (*callback_encode_res_t)(struct svc_rqst *, struct xdr_stream *, void *);
|
||||||
|
|
||||||
|
|
||||||
struct callback_op {
|
struct callback_op {
|
||||||
|
@ -61,7 +61,7 @@ static uint32_t *read_buf(struct xdr_stream *xdr, int nbytes)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str)
|
static __be32 decode_string(struct xdr_stream *xdr, unsigned int *len, const char **str)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ static unsigned decode_string(struct xdr_stream *xdr, unsigned int *len, const c
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
|
static __be32 decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ static unsigned decode_fh(struct xdr_stream *xdr, struct nfs_fh *fh)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
|
static __be32 decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
unsigned int attrlen;
|
unsigned int attrlen;
|
||||||
|
@ -118,7 +118,7 @@ static unsigned decode_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
|
static __be32 decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -129,11 +129,11 @@ static unsigned decode_stateid(struct xdr_stream *xdr, nfs4_stateid *stateid)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
|
static __be32 decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compound_hdr_arg *hdr)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
unsigned int minor_version;
|
unsigned int minor_version;
|
||||||
unsigned status;
|
__be32 status;
|
||||||
|
|
||||||
status = decode_string(xdr, &hdr->taglen, &hdr->tag);
|
status = decode_string(xdr, &hdr->taglen, &hdr->tag);
|
||||||
if (unlikely(status != 0))
|
if (unlikely(status != 0))
|
||||||
|
@ -159,7 +159,7 @@ static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compou
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
|
static __be32 decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
p = read_buf(xdr, 4);
|
p = read_buf(xdr, 4);
|
||||||
|
@ -169,9 +169,9 @@ static unsigned decode_op_hdr(struct xdr_stream *xdr, unsigned int *op)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args)
|
static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_getattrargs *args)
|
||||||
{
|
{
|
||||||
unsigned status;
|
__be32 status;
|
||||||
|
|
||||||
status = decode_fh(xdr, &args->fh);
|
status = decode_fh(xdr, &args->fh);
|
||||||
if (unlikely(status != 0))
|
if (unlikely(status != 0))
|
||||||
|
@ -183,10 +183,10 @@ out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args)
|
static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr, struct cb_recallargs *args)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
unsigned status;
|
__be32 status;
|
||||||
|
|
||||||
args->addr = &rqstp->rq_addr;
|
args->addr = &rqstp->rq_addr;
|
||||||
status = decode_stateid(xdr, &args->stateid);
|
status = decode_stateid(xdr, &args->stateid);
|
||||||
|
@ -204,7 +204,7 @@ out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
|
static __be32 encode_string(struct xdr_stream *xdr, unsigned int len, const char *str)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ static unsigned encode_string(struct xdr_stream *xdr, unsigned int len, const ch
|
||||||
|
|
||||||
#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE)
|
#define CB_SUPPORTED_ATTR0 (FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE)
|
||||||
#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY)
|
#define CB_SUPPORTED_ATTR1 (FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY)
|
||||||
static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep)
|
static __be32 encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitmap, uint32_t **savep)
|
||||||
{
|
{
|
||||||
uint32_t bm[2];
|
uint32_t bm[2];
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
@ -247,7 +247,7 @@ static unsigned encode_attr_bitmap(struct xdr_stream *xdr, const uint32_t *bitma
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change)
|
static __be32 encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t change)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ static unsigned encode_attr_change(struct xdr_stream *xdr, const uint32_t *bitma
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size)
|
static __be32 encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap, uint64_t size)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ static unsigned encode_attr_size(struct xdr_stream *xdr, const uint32_t *bitmap,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *time)
|
static __be32 encode_attr_time(struct xdr_stream *xdr, const struct timespec *time)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -285,23 +285,23 @@ static unsigned encode_attr_time(struct xdr_stream *xdr, const struct timespec *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
|
static __be32 encode_attr_ctime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
|
||||||
{
|
{
|
||||||
if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA))
|
if (!(bitmap[1] & FATTR4_WORD1_TIME_METADATA))
|
||||||
return 0;
|
return 0;
|
||||||
return encode_attr_time(xdr,time);
|
return encode_attr_time(xdr,time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
|
static __be32 encode_attr_mtime(struct xdr_stream *xdr, const uint32_t *bitmap, const struct timespec *time)
|
||||||
{
|
{
|
||||||
if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY))
|
if (!(bitmap[1] & FATTR4_WORD1_TIME_MODIFY))
|
||||||
return 0;
|
return 0;
|
||||||
return encode_attr_time(xdr,time);
|
return encode_attr_time(xdr,time);
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr)
|
static __be32 encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compound_hdr_res *hdr)
|
||||||
{
|
{
|
||||||
unsigned status;
|
__be32 status;
|
||||||
|
|
||||||
hdr->status = xdr_reserve_space(xdr, 4);
|
hdr->status = xdr_reserve_space(xdr, 4);
|
||||||
if (unlikely(hdr->status == NULL))
|
if (unlikely(hdr->status == NULL))
|
||||||
|
@ -315,7 +315,7 @@ static unsigned encode_compound_hdr_res(struct xdr_stream *xdr, struct cb_compou
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res)
|
static __be32 encode_op_hdr(struct xdr_stream *xdr, uint32_t op, __be32 res)
|
||||||
{
|
{
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
|
|
||||||
|
@ -327,10 +327,10 @@ static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res)
|
static __be32 encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res)
|
||||||
{
|
{
|
||||||
uint32_t *savep = NULL;
|
uint32_t *savep = NULL;
|
||||||
unsigned status = res->status;
|
__be32 status = res->status;
|
||||||
|
|
||||||
if (unlikely(status != 0))
|
if (unlikely(status != 0))
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -353,15 +353,15 @@ out:
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned process_op(struct svc_rqst *rqstp,
|
static __be32 process_op(struct svc_rqst *rqstp,
|
||||||
struct xdr_stream *xdr_in, void *argp,
|
struct xdr_stream *xdr_in, void *argp,
|
||||||
struct xdr_stream *xdr_out, void *resp)
|
struct xdr_stream *xdr_out, void *resp)
|
||||||
{
|
{
|
||||||
struct callback_op *op = &callback_ops[0];
|
struct callback_op *op = &callback_ops[0];
|
||||||
unsigned int op_nr = OP_CB_ILLEGAL;
|
unsigned int op_nr = OP_CB_ILLEGAL;
|
||||||
unsigned int status = 0;
|
__be32 status = 0;
|
||||||
long maxlen;
|
long maxlen;
|
||||||
unsigned res;
|
__be32 res;
|
||||||
|
|
||||||
dprintk("%s: start\n", __FUNCTION__);
|
dprintk("%s: start\n", __FUNCTION__);
|
||||||
status = decode_op_hdr(xdr_in, &op_nr);
|
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
|
||||||
struct cb_compound_hdr_res hdr_res;
|
struct cb_compound_hdr_res hdr_res;
|
||||||
struct xdr_stream xdr_in, xdr_out;
|
struct xdr_stream xdr_in, xdr_out;
|
||||||
uint32_t *p;
|
uint32_t *p;
|
||||||
unsigned int status;
|
__be32 status;
|
||||||
unsigned int nops = 1;
|
unsigned int nops = 1;
|
||||||
|
|
||||||
dprintk("%s: start\n", __FUNCTION__);
|
dprintk("%s: start\n", __FUNCTION__);
|
||||||
|
|
Loading…
Reference in New Issue