Commit 874ce338 authored by Trond Myklebust's avatar Trond Myklebust

Clean up the nfs4_stateid and nfs4_verifier typedefs.

Convert them into structures
parent 1a7bc914
...@@ -54,8 +54,7 @@ ...@@ -54,8 +54,7 @@
extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus); extern u32 *nfs4_decode_dirent(u32 *p, struct nfs_entry *entry, int plus);
extern struct rpc_procinfo nfs4_procedures[]; extern struct rpc_procinfo nfs4_procedures[];
static nfs4_stateid zero_stateid = extern nfs4_stateid zero_stateid;
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
static spinlock_t renew_lock = SPIN_LOCK_UNLOCKED; static spinlock_t renew_lock = SPIN_LOCK_UNLOCKED;
...@@ -336,7 +335,7 @@ nfs4_setup_readdir(struct nfs4_compound *cp, u64 cookie, u32 *verifier, ...@@ -336,7 +335,7 @@ nfs4_setup_readdir(struct nfs4_compound *cp, u64 cookie, u32 *verifier,
BUG_ON(bufsize < 80); BUG_ON(bufsize < 80);
readdir->rd_cookie = (cookie > 2) ? cookie : 0; readdir->rd_cookie = (cookie > 2) ? cookie : 0;
memcpy(readdir->rd_req_verifier, verifier, sizeof(nfs4_verifier)); memcpy(&readdir->rd_req_verifier, verifier, sizeof(readdir->rd_req_verifier));
readdir->rd_count = bufsize; readdir->rd_count = bufsize;
readdir->rd_bmval[0] = FATTR4_WORD0_FILEID; readdir->rd_bmval[0] = FATTR4_WORD0_FILEID;
readdir->rd_bmval[1] = 0; readdir->rd_bmval[1] = 0;
...@@ -464,7 +463,7 @@ nfs4_setup_setclientid(struct nfs4_compound *cp, u32 program, unsigned short por ...@@ -464,7 +463,7 @@ nfs4_setup_setclientid(struct nfs4_compound *cp, u32 program, unsigned short por
u32 *p; u32 *p;
tv = CURRENT_TIME; tv = CURRENT_TIME;
p = (u32 *)setclientid->sc_verifier; p = (u32 *)setclientid->sc_verifier.data;
*p++ = tv.tv_sec; *p++ = tv.tv_sec;
*p++ = tv.tv_nsec; *p++ = tv.tv_nsec;
setclientid->sc_name = server->ip_addr; setclientid->sc_name = server->ip_addr;
...@@ -606,7 +605,7 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt ...@@ -606,7 +605,7 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt
goto out; goto out;
} }
if (o_arg.createmode & NFS4_CREATE_EXCLUSIVE){ if (o_arg.createmode & NFS4_CREATE_EXCLUSIVE){
u32 *p = (u32 *) o_arg.u.verifier; u32 *p = (u32 *) o_arg.u.verifier.data;
p[0] = jiffies; p[0] = jiffies;
p[1] = current->pid; p[1] = current->pid;
} else if (o_arg.createmode == NFS4_CREATE_UNCHECKED) { } else if (o_arg.createmode == NFS4_CREATE_UNCHECKED) {
...@@ -648,14 +647,14 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt ...@@ -648,14 +647,14 @@ nfs4_do_open(struct inode *dir, struct qstr *name, int flags, struct iattr *satt
.rpc_cred = cred, .rpc_cred = cred,
}; };
memcpy(oc_arg.stateid, o_res.stateid, sizeof(nfs4_stateid)); memcpy(&oc_arg.stateid, &o_res.stateid, sizeof(oc_arg.stateid));
status = rpc_call_sync(server->client, &msg, 0); status = rpc_call_sync(server->client, &msg, 0);
if (status) if (status)
goto out_up; goto out_up;
nfs4_increment_seqid(status, sp); nfs4_increment_seqid(status, sp);
memcpy(state->stateid, oc_res.stateid, sizeof(state->stateid)); memcpy(&state->stateid, &oc_res.stateid, sizeof(state->stateid));
} else } else
memcpy(state->stateid, o_res.stateid, sizeof(state->stateid)); memcpy(&state->stateid, &o_res.stateid, sizeof(state->stateid));
state->state |= flags & (FMODE_READ|FMODE_WRITE); state->state |= flags & (FMODE_READ|FMODE_WRITE);
state->pid = current->pid; state->pid = current->pid;
...@@ -703,9 +702,9 @@ nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr, ...@@ -703,9 +702,9 @@ nfs4_do_setattr(struct nfs_server *server, struct nfs_fattr *fattr,
fattr->valid = 0; fattr->valid = 0;
if (state) if (state)
memcpy(arg.stateid, state->stateid, sizeof(arg.stateid)); memcpy(&arg.stateid, &state->stateid, sizeof(arg.stateid));
else else
memcpy(arg.stateid, zero_stateid, sizeof(arg.stateid)); memcpy(&arg.stateid, &zero_stateid, sizeof(arg.stateid));
return(rpc_call_sync(server->client, &msg, 0)); return(rpc_call_sync(server->client, &msg, 0));
} }
...@@ -738,7 +737,7 @@ nfs4_do_close(struct inode *inode, struct nfs4_state *state) ...@@ -738,7 +737,7 @@ nfs4_do_close(struct inode *inode, struct nfs4_state *state)
.rpc_resp = &res, .rpc_resp = &res,
}; };
memcpy(arg.stateid, state->stateid, sizeof(arg.stateid)); memcpy(&arg.stateid, &state->stateid, sizeof(arg.stateid));
/* Serialization for the sequence id */ /* Serialization for the sequence id */
arg.seqid = sp->so_seqid, arg.seqid = sp->so_seqid,
status = rpc_call_sync(NFS_SERVER(inode)->client, &msg, 0); status = rpc_call_sync(NFS_SERVER(inode)->client, &msg, 0);
...@@ -1034,7 +1033,6 @@ nfs4_proc_read(struct nfs_read_data *rdata, struct file *filp) ...@@ -1034,7 +1033,6 @@ nfs4_proc_read(struct nfs_read_data *rdata, struct file *filp)
int flags = rdata->flags; int flags = rdata->flags;
struct inode *inode = rdata->inode; struct inode *inode = rdata->inode;
struct nfs_fattr *fattr = rdata->res.fattr; struct nfs_fattr *fattr = rdata->res.fattr;
nfs4_stateid *stateid = &rdata->args.stateid;
struct nfs_server *server = NFS_SERVER(inode); struct nfs_server *server = NFS_SERVER(inode);
struct rpc_message msg = { struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ], .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ],
...@@ -1054,9 +1052,9 @@ nfs4_proc_read(struct nfs_read_data *rdata, struct file *filp) ...@@ -1054,9 +1052,9 @@ nfs4_proc_read(struct nfs_read_data *rdata, struct file *filp)
if (filp) { if (filp) {
struct nfs4_state *state; struct nfs4_state *state;
state = (struct nfs4_state *)filp->private_data; state = (struct nfs4_state *)filp->private_data;
memcpy(stateid, state->stateid, sizeof(stateid)); memcpy(&rdata->args.stateid, &state->stateid, sizeof(rdata->args.stateid));
} else } else
memcpy(stateid, zero_stateid, sizeof(stateid)); memcpy(&rdata->args.stateid, &zero_stateid, sizeof(rdata->args.stateid));
fattr->valid = 0; fattr->valid = 0;
status = rpc_call_sync(server->client, &msg, flags); status = rpc_call_sync(server->client, &msg, flags);
...@@ -1076,7 +1074,6 @@ nfs4_proc_write(struct nfs_write_data *wdata, struct file *filp) ...@@ -1076,7 +1074,6 @@ nfs4_proc_write(struct nfs_write_data *wdata, struct file *filp)
int rpcflags = wdata->flags; int rpcflags = wdata->flags;
struct inode *inode = wdata->inode; struct inode *inode = wdata->inode;
struct nfs_fattr *fattr = wdata->res.fattr; struct nfs_fattr *fattr = wdata->res.fattr;
nfs4_stateid *stateid = &wdata->args.stateid;
struct nfs_server *server = NFS_SERVER(inode); struct nfs_server *server = NFS_SERVER(inode);
struct rpc_message msg = { struct rpc_message msg = {
.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE], .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_WRITE],
...@@ -1095,9 +1092,9 @@ nfs4_proc_write(struct nfs_write_data *wdata, struct file *filp) ...@@ -1095,9 +1092,9 @@ nfs4_proc_write(struct nfs_write_data *wdata, struct file *filp)
if (filp) { if (filp) {
struct nfs4_state *state; struct nfs4_state *state;
state = (struct nfs4_state *)filp->private_data; state = (struct nfs4_state *)filp->private_data;
memcpy(stateid, state->stateid, sizeof(stateid)); memcpy(&wdata->args.stateid, &state->stateid, sizeof(wdata->args.stateid));
} else } else
memcpy(stateid, zero_stateid, sizeof(stateid)); memcpy(&wdata->args.stateid, &zero_stateid, sizeof(wdata->args.stateid));
fattr->valid = 0; fattr->valid = 0;
status = rpc_call_sync(server->client, &msg, rpcflags); status = rpc_call_sync(server->client, &msg, rpcflags);
...@@ -1476,9 +1473,9 @@ nfs4_proc_read_setup(struct nfs_read_data *data, unsigned int count) ...@@ -1476,9 +1473,9 @@ nfs4_proc_read_setup(struct nfs_read_data *data, unsigned int count)
data->timestamp = jiffies; data->timestamp = jiffies;
if (req->wb_state) if (req->wb_state)
memcpy(data->args.stateid, req->wb_state->stateid, sizeof(data->args.stateid)); memcpy(&data->args.stateid, &req->wb_state->stateid, sizeof(data->args.stateid));
else else
memcpy(data->args.stateid, zero_stateid, sizeof(data->args.stateid)); memcpy(&data->args.stateid, &zero_stateid, sizeof(data->args.stateid));
/* N.B. Do we need to test? Never called for swapfile inode */ /* N.B. Do we need to test? Never called for swapfile inode */
flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0); flags = RPC_TASK_ASYNC | (IS_SWAPFILE(inode)? NFS_RPC_SWAPFLAGS : 0);
...@@ -1555,9 +1552,9 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how) ...@@ -1555,9 +1552,9 @@ nfs4_proc_write_setup(struct nfs_write_data *data, unsigned int count, int how)
data->timestamp = jiffies; data->timestamp = jiffies;
if (req->wb_state) if (req->wb_state)
memcpy(data->args.stateid, req->wb_state->stateid, sizeof(data->args.stateid)); memcpy(&data->args.stateid, &req->wb_state->stateid, sizeof(data->args.stateid));
else else
memcpy(data->args.stateid, zero_stateid, sizeof(data->args.stateid)); memcpy(&data->args.stateid, &zero_stateid, sizeof(data->args.stateid));
/* Set the initial flags for the task. */ /* Set the initial flags for the task. */
flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC; flags = (how & FLUSH_SYNC) ? 0 : RPC_TASK_ASYNC;
......
...@@ -46,11 +46,12 @@ ...@@ -46,11 +46,12 @@
static spinlock_t state_spinlock = SPIN_LOCK_UNLOCKED; static spinlock_t state_spinlock = SPIN_LOCK_UNLOCKED;
nfs4_stateid zero_stateid = nfs4_stateid zero_stateid;
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
#if 0
nfs4_stateid one_stateid = nfs4_stateid one_stateid =
{ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
#endif
static LIST_HEAD(nfs4_clientid_list); static LIST_HEAD(nfs4_clientid_list);
...@@ -228,7 +229,7 @@ nfs4_alloc_open_state(void) ...@@ -228,7 +229,7 @@ nfs4_alloc_open_state(void)
return NULL; return NULL;
state->pid = current->pid; state->pid = current->pid;
state->state = 0; state->state = 0;
memset(state->stateid, 0, sizeof(state->stateid)); memset(state->stateid.data, 0, sizeof(state->stateid.data));
atomic_set(&state->count, 1); atomic_set(&state->count, 1);
return state; return state;
} }
......
...@@ -205,6 +205,7 @@ struct compound_hdr { ...@@ -205,6 +205,7 @@ struct compound_hdr {
#define RESERVE_SPACE(nbytes) do { \ #define RESERVE_SPACE(nbytes) do { \
p = xdr_reserve_space(xdr, nbytes); \ p = xdr_reserve_space(xdr, nbytes); \
if (!p) printk("RESERVE_SPACE(%d) failed in function %s\n", nbytes, __FUNCTION__); \
BUG_ON(!p); \ BUG_ON(!p); \
} while (0) } while (0)
...@@ -382,10 +383,10 @@ encode_close(struct xdr_stream *xdr, struct nfs_closeargs *arg) ...@@ -382,10 +383,10 @@ encode_close(struct xdr_stream *xdr, struct nfs_closeargs *arg)
{ {
uint32_t *p; uint32_t *p;
RESERVE_SPACE(8+sizeof(nfs4_stateid)); RESERVE_SPACE(8+sizeof(arg->stateid.data));
WRITE32(OP_CLOSE); WRITE32(OP_CLOSE);
WRITE32(arg->seqid); WRITE32(arg->seqid);
WRITEMEM(arg->stateid, sizeof(nfs4_stateid)); WRITEMEM(arg->stateid.data, sizeof(arg->stateid.data));
return 0; return 0;
} }
...@@ -575,7 +576,7 @@ encode_open(struct xdr_stream *xdr, struct nfs_openargs *arg) ...@@ -575,7 +576,7 @@ encode_open(struct xdr_stream *xdr, struct nfs_openargs *arg)
if (arg->createmode == NFS4_CREATE_EXCLUSIVE) { if (arg->createmode == NFS4_CREATE_EXCLUSIVE) {
RESERVE_SPACE(12); RESERVE_SPACE(12);
WRITE32(arg->createmode); WRITE32(arg->createmode);
WRITEMEM(arg->u.verifier, sizeof(nfs4_verifier)); WRITEMEM(arg->u.verifier.data, sizeof(arg->u.verifier.data));
} }
else if (arg->u.attrs) { else if (arg->u.attrs) {
RESERVE_SPACE(4); RESERVE_SPACE(4);
...@@ -604,9 +605,9 @@ encode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmargs *arg) ...@@ -604,9 +605,9 @@ encode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmargs *arg)
{ {
uint32_t *p; uint32_t *p;
RESERVE_SPACE(8+sizeof(nfs4_stateid)); RESERVE_SPACE(8+sizeof(arg->stateid.data));
WRITE32(OP_OPEN_CONFIRM); WRITE32(OP_OPEN_CONFIRM);
WRITEMEM(arg->stateid, sizeof(nfs4_stateid)); WRITEMEM(arg->stateid.data, sizeof(arg->stateid.data));
WRITE32(arg->seqid); WRITE32(arg->seqid);
return 0; return 0;
...@@ -645,7 +646,7 @@ encode_read(struct xdr_stream *xdr, struct nfs_readargs *args) ...@@ -645,7 +646,7 @@ encode_read(struct xdr_stream *xdr, struct nfs_readargs *args)
RESERVE_SPACE(32); RESERVE_SPACE(32);
WRITE32(OP_READ); WRITE32(OP_READ);
WRITEMEM(args->stateid, sizeof(nfs4_stateid)); WRITEMEM(args->stateid.data, sizeof(args->stateid.data));
WRITE64(args->offset); WRITE64(args->offset);
WRITE32(args->count); WRITE32(args->count);
...@@ -662,7 +663,7 @@ encode_readdir(struct xdr_stream *xdr, struct nfs4_readdir *readdir, struct rpc_ ...@@ -662,7 +663,7 @@ encode_readdir(struct xdr_stream *xdr, struct nfs4_readdir *readdir, struct rpc_
RESERVE_SPACE(32+sizeof(nfs4_verifier)); RESERVE_SPACE(32+sizeof(nfs4_verifier));
WRITE32(OP_READDIR); WRITE32(OP_READDIR);
WRITE64(readdir->rd_cookie); WRITE64(readdir->rd_cookie);
WRITEMEM(readdir->rd_req_verifier, sizeof(nfs4_verifier)); WRITEMEM(readdir->rd_req_verifier.data, sizeof(readdir->rd_req_verifier.data));
WRITE32(readdir->rd_count >> 5); /* meaningless "dircount" field */ WRITE32(readdir->rd_count >> 5); /* meaningless "dircount" field */
WRITE32(readdir->rd_count); WRITE32(readdir->rd_count);
WRITE32(2); WRITE32(2);
...@@ -771,9 +772,9 @@ encode_setattr(struct xdr_stream *xdr, struct nfs_setattrargs *arg, ...@@ -771,9 +772,9 @@ encode_setattr(struct xdr_stream *xdr, struct nfs_setattrargs *arg,
int status; int status;
uint32_t *p; uint32_t *p;
RESERVE_SPACE(4+sizeof(nfs4_stateid)); RESERVE_SPACE(4+sizeof(arg->stateid.data));
WRITE32(OP_SETATTR); WRITE32(OP_SETATTR);
WRITEMEM(arg->stateid, sizeof(nfs4_stateid)); WRITEMEM(arg->stateid.data, sizeof(arg->stateid.data));
if ((status = encode_attrs(xdr, arg->iap, server))) if ((status = encode_attrs(xdr, arg->iap, server)))
return status; return status;
...@@ -792,11 +793,11 @@ encode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid *setclientid) ...@@ -792,11 +793,11 @@ encode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid *setclientid)
len2 = strlen(setclientid->sc_netid); len2 = strlen(setclientid->sc_netid);
len3 = strlen(setclientid->sc_uaddr); len3 = strlen(setclientid->sc_uaddr);
total_len = XDR_QUADLEN(len1) + XDR_QUADLEN(len2) + XDR_QUADLEN(len3); total_len = XDR_QUADLEN(len1) + XDR_QUADLEN(len2) + XDR_QUADLEN(len3);
total_len = (total_len << 2) + 24 + sizeof(nfs4_verifier); total_len = (total_len << 2) + 24 + sizeof(setclientid->sc_verifier.data);
RESERVE_SPACE(total_len); RESERVE_SPACE(total_len);
WRITE32(OP_SETCLIENTID); WRITE32(OP_SETCLIENTID);
WRITEMEM(setclientid->sc_verifier, sizeof(nfs4_verifier)); WRITEMEM(setclientid->sc_verifier.data, sizeof(setclientid->sc_verifier.data));
WRITE32(len1); WRITE32(len1);
WRITEMEM(setclientid->sc_name, len1); WRITEMEM(setclientid->sc_name, len1);
WRITE32(setclientid->sc_prog); WRITE32(setclientid->sc_prog);
...@@ -814,10 +815,10 @@ encode_setclientid_confirm(struct xdr_stream *xdr, struct nfs4_client *client_st ...@@ -814,10 +815,10 @@ encode_setclientid_confirm(struct xdr_stream *xdr, struct nfs4_client *client_st
{ {
uint32_t *p; uint32_t *p;
RESERVE_SPACE(12 + sizeof(nfs4_verifier)); RESERVE_SPACE(12 + sizeof(client_state->cl_confirm.data));
WRITE32(OP_SETCLIENTID_CONFIRM); WRITE32(OP_SETCLIENTID_CONFIRM);
WRITE64(client_state->cl_clientid); WRITE64(client_state->cl_clientid);
WRITEMEM(client_state->cl_confirm,sizeof(nfs4_verifier)); WRITEMEM(client_state->cl_confirm.data, sizeof(client_state->cl_confirm.data));
return 0; return 0;
} }
...@@ -829,7 +830,7 @@ encode_write(struct xdr_stream *xdr, struct nfs_writeargs *args) ...@@ -829,7 +830,7 @@ encode_write(struct xdr_stream *xdr, struct nfs_writeargs *args)
RESERVE_SPACE(36); RESERVE_SPACE(36);
WRITE32(OP_WRITE); WRITE32(OP_WRITE);
WRITEMEM(args->stateid, sizeof(nfs4_stateid)); WRITEMEM(args->stateid.data, sizeof(args->stateid.data));
WRITE64(args->offset); WRITE64(args->offset);
WRITE32(args->stable); WRITE32(args->stable);
WRITE32(args->count); WRITE32(args->count);
...@@ -1256,8 +1257,8 @@ decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) ...@@ -1256,8 +1257,8 @@ decode_close(struct xdr_stream *xdr, struct nfs_closeres *res)
status = decode_op_hdr(xdr, OP_CLOSE); status = decode_op_hdr(xdr, OP_CLOSE);
if (status) if (status)
return status; return status;
READ_BUF(sizeof(nfs4_stateid)); READ_BUF(sizeof(res->stateid.data));
COPYMEM(res->stateid, sizeof(nfs4_stateid)); COPYMEM(res->stateid.data, sizeof(res->stateid.data));
return 0; return 0;
} }
...@@ -1744,8 +1745,8 @@ decode_open(struct xdr_stream *xdr, struct nfs_openres *res) ...@@ -1744,8 +1745,8 @@ decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
status = decode_op_hdr(xdr, OP_OPEN); status = decode_op_hdr(xdr, OP_OPEN);
if (status) if (status)
return status; return status;
READ_BUF(sizeof(nfs4_stateid)); READ_BUF(sizeof(res->stateid.data));
COPYMEM(res->stateid, sizeof(nfs4_stateid)); COPYMEM(res->stateid.data, sizeof(res->stateid.data));
decode_change_info(xdr, res->cinfo); decode_change_info(xdr, res->cinfo);
...@@ -1772,8 +1773,8 @@ decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) ...@@ -1772,8 +1773,8 @@ decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res)
res->status = decode_op_hdr(xdr, OP_OPEN_CONFIRM); res->status = decode_op_hdr(xdr, OP_OPEN_CONFIRM);
if (res->status) if (res->status)
return res->status; return res->status;
READ_BUF(sizeof(nfs4_stateid)); READ_BUF(sizeof(res->stateid.data));
COPYMEM(res->stateid, sizeof(nfs4_stateid)); COPYMEM(res->stateid.data, sizeof(res->stateid.data));
return 0; return 0;
} }
...@@ -1833,7 +1834,7 @@ decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_readdir ...@@ -1833,7 +1834,7 @@ decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_readdir
if (status) if (status)
return status; return status;
READ_BUF(8); READ_BUF(8);
COPYMEM(readdir->rd_resp_verifier, 8); COPYMEM(readdir->rd_resp_verifier.data, 8);
hdrlen = (char *) p - (char *) iov->iov_base; hdrlen = (char *) p - (char *) iov->iov_base;
recvd = req->rq_received - hdrlen; recvd = req->rq_received - hdrlen;
...@@ -2026,9 +2027,9 @@ decode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid *setclientid) ...@@ -2026,9 +2027,9 @@ decode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid *setclientid)
} }
READ32(nfserr); READ32(nfserr);
if (nfserr == NFS_OK) { if (nfserr == NFS_OK) {
READ_BUF(8 + sizeof(nfs4_verifier)); READ_BUF(8 + sizeof(setclientid->sc_state->cl_confirm.data));
READ64(setclientid->sc_state->cl_clientid); READ64(setclientid->sc_state->cl_clientid);
COPYMEM(setclientid->sc_state->cl_confirm, sizeof(nfs4_verifier)); COPYMEM(setclientid->sc_state->cl_confirm.data, sizeof(setclientid->sc_state->cl_confirm.data));
} else if (nfserr == NFSERR_CLID_INUSE) { } else if (nfserr == NFSERR_CLID_INUSE) {
uint32_t len; uint32_t len;
......
...@@ -78,7 +78,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o ...@@ -78,7 +78,7 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data, status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data,
open->op_fname.len, &open->op_iattr, open->op_fname.len, &open->op_iattr,
&resfh, open->op_createmode, &resfh, open->op_createmode,
(u32 *)open->op_verf, &open->op_truncate); (u32 *)open->op_verf.data, &open->op_truncate);
} }
else { else {
status = nfsd_lookup(rqstp, current_fh, status = nfsd_lookup(rqstp, current_fh,
...@@ -204,7 +204,7 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc ...@@ -204,7 +204,7 @@ nfsd4_access(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_acc
static inline int static inline int
nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit) nfsd4_commit(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_commit *commit)
{ {
u32 *p = (u32 *)commit->co_verf; u32 *p = (u32 *)commit->co_verf.data;
*p++ = nfssvc_boot.tv_sec; *p++ = nfssvc_boot.tv_sec;
*p++ = nfssvc_boot.tv_usec; *p++ = nfssvc_boot.tv_usec;
...@@ -522,7 +522,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ ...@@ -522,7 +522,7 @@ nfsd4_write(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_writ
nfs4_unlock_state(); nfs4_unlock_state();
write->wr_bytes_written = write->wr_buflen; write->wr_bytes_written = write->wr_buflen;
write->wr_how_written = write->wr_stable_how; write->wr_how_written = write->wr_stable_how;
p = (u32 *)write->wr_verifier; p = (u32 *)write->wr_verifier.data;
*p++ = nfssvc_boot.tv_sec; *p++ = nfssvc_boot.tv_sec;
*p++ = nfssvc_boot.tv_usec; *p++ = nfssvc_boot.tv_usec;
......
...@@ -228,8 +228,8 @@ create_client(struct xdr_netobj name) { ...@@ -228,8 +228,8 @@ create_client(struct xdr_netobj name) {
} }
static void static void
copy_verf(struct nfs4_client *target, nfs4_verifier source) { copy_verf(struct nfs4_client *target, nfs4_verifier *source) {
memcpy(&target->cl_verifier, source, sizeof(nfs4_verifier)); memcpy(target->cl_verifier.data, source->data, sizeof(target->cl_verifier.data));
} }
static void static void
...@@ -256,8 +256,8 @@ cmp_name(struct xdr_netobj *n1, struct xdr_netobj *n2) { ...@@ -256,8 +256,8 @@ cmp_name(struct xdr_netobj *n1, struct xdr_netobj *n2) {
} }
static int static int
cmp_verf(nfs4_verifier v1, nfs4_verifier v2) { cmp_verf(nfs4_verifier *v1, nfs4_verifier *v2) {
return(!memcmp(v1,v2,sizeof(nfs4_verifier))); return(!memcmp(v1->data,v2->data,sizeof(v1->data)));
} }
static int static int
...@@ -286,7 +286,7 @@ gen_confirm(struct nfs4_client *clp) { ...@@ -286,7 +286,7 @@ gen_confirm(struct nfs4_client *clp) {
u32 * p; u32 * p;
tv = CURRENT_TIME; tv = CURRENT_TIME;
p = (u32 *)clp->cl_confirm; p = (u32 *)clp->cl_confirm.data;
*p++ = tv.tv_sec; *p++ = tv.tv_sec;
*p++ = tv.tv_nsec; *p++ = tv.tv_nsec;
} }
...@@ -371,7 +371,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) ...@@ -371,7 +371,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
.len = setclid->se_namelen, .len = setclid->se_namelen,
.data = setclid->se_name, .data = setclid->se_name,
}; };
char * clverifier = setclid->se_verf; nfs4_verifier clverifier = setclid->se_verf;
unsigned int strhashval; unsigned int strhashval;
struct nfs4_client * conf, * unconf, * new, * clp; struct nfs4_client * conf, * unconf, * new, * clp;
int status; int status;
...@@ -439,13 +439,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) ...@@ -439,13 +439,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
expire_client(unconf); expire_client(unconf);
if (!(new = create_client(clname))) if (!(new = create_client(clname)))
goto out; goto out;
copy_verf(new,clverifier); copy_verf(new, &clverifier);
new->cl_addr = ip_addr; new->cl_addr = ip_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred); copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new); gen_clid(new);
gen_confirm(new); gen_confirm(new);
add_to_unconfirmed(new, strhashval); add_to_unconfirmed(new, strhashval);
} else if (cmp_verf(conf->cl_verifier, clverifier)) { } else if (cmp_verf(&conf->cl_verifier, &clverifier)) {
/* /*
* CASE 1: * CASE 1:
* cl_name match, confirmed, principal match * cl_name match, confirmed, principal match
...@@ -460,13 +460,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) ...@@ -460,13 +460,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
* new cl_confirm * new cl_confirm
*/ */
if ((unconf) && if ((unconf) &&
cmp_verf(unconf->cl_verifier, conf->cl_verifier) && cmp_verf(&unconf->cl_verifier, &conf->cl_verifier) &&
cmp_clid(&unconf->cl_clientid, &conf->cl_clientid)) { cmp_clid(&unconf->cl_clientid, &conf->cl_clientid)) {
expire_client(unconf); expire_client(unconf);
} }
if (!(new = create_client(clname))) if (!(new = create_client(clname)))
goto out; goto out;
copy_verf(new,conf->cl_verifier); copy_verf(new,&conf->cl_verifier);
new->cl_addr = ip_addr; new->cl_addr = ip_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred); copy_cred(&new->cl_cred,&rqstp->rq_cred);
copy_clid(new, conf); copy_clid(new, conf);
...@@ -483,14 +483,14 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) ...@@ -483,14 +483,14 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
*/ */
if (!(new = create_client(clname))) if (!(new = create_client(clname)))
goto out; goto out;
copy_verf(new,clverifier); copy_verf(new,&clverifier);
new->cl_addr = ip_addr; new->cl_addr = ip_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred); copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new); gen_clid(new);
gen_confirm(new); gen_confirm(new);
add_to_unconfirmed(new, strhashval); add_to_unconfirmed(new, strhashval);
} else if (!cmp_clid(&conf->cl_clientid, &unconf->cl_clientid) && } else if (!cmp_clid(&conf->cl_clientid, &unconf->cl_clientid) &&
!cmp_verf(conf->cl_confirm, unconf->cl_confirm)) { !cmp_verf(&conf->cl_confirm, &unconf->cl_confirm)) {
/* /*
* CASE3: * CASE3:
* confirmed found (name, principal match) * confirmed found (name, principal match)
...@@ -510,7 +510,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) ...@@ -510,7 +510,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
expire_client(unconf); expire_client(unconf);
if (!(new = create_client(clname))) if (!(new = create_client(clname)))
goto out; goto out;
copy_verf(new,clverifier); copy_verf(new,&clverifier);
new->cl_addr = ip_addr; new->cl_addr = ip_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred); copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new); gen_clid(new);
...@@ -524,7 +524,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid) ...@@ -524,7 +524,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
} }
setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot; setclid->se_clientid.cl_boot = new->cl_clientid.cl_boot;
setclid->se_clientid.cl_id = new->cl_clientid.cl_id; setclid->se_clientid.cl_id = new->cl_clientid.cl_id;
memcpy(&setclid->se_confirm, new->cl_confirm, sizeof(nfs4_verifier)); memcpy(setclid->se_confirm.data, new->cl_confirm.data, sizeof(setclid->se_confirm.data));
printk(KERN_INFO "NFSD: this client will not receive delegations\n"); printk(KERN_INFO "NFSD: this client will not receive delegations\n");
status = nfs_ok; status = nfs_ok;
out: out:
...@@ -546,7 +546,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi ...@@ -546,7 +546,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; u32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
unsigned int idhashval; unsigned int idhashval;
struct nfs4_client *clp, *conf = NULL, *unconf = NULL; struct nfs4_client *clp, *conf = NULL, *unconf = NULL;
char * confirm = setclientid_confirm->sc_confirm; nfs4_verifier confirm = setclientid_confirm->sc_confirm;
clientid_t * clid = &setclientid_confirm->sc_clientid; clientid_t * clid = &setclientid_confirm->sc_clientid;
struct list_head *pos, *next; struct list_head *pos, *next;
int status; int status;
...@@ -601,10 +601,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi ...@@ -601,10 +601,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
* conf and unconf records match names, verifiers * conf and unconf records match names, verifiers
*/ */
if ((conf && unconf) && if ((conf && unconf) &&
(cmp_verf(unconf->cl_confirm, confirm)) && (cmp_verf(&unconf->cl_confirm, &confirm)) &&
(cmp_verf(conf->cl_verifier, unconf->cl_verifier)) && (cmp_verf(&conf->cl_verifier, &unconf->cl_verifier)) &&
(cmp_name(&conf->cl_name,&unconf->cl_name)) && (cmp_name(&conf->cl_name,&unconf->cl_name)) &&
(!cmp_verf(conf->cl_confirm, unconf->cl_confirm))) { (!cmp_verf(&conf->cl_confirm, &unconf->cl_confirm))) {
if (!cmp_creds(&conf->cl_cred, &unconf->cl_cred)) if (!cmp_creds(&conf->cl_cred, &unconf->cl_cred))
status = nfserr_clid_inuse; status = nfserr_clid_inuse;
else { else {
...@@ -621,7 +621,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi ...@@ -621,7 +621,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
*/ */
if ((conf && !unconf) || if ((conf && !unconf) ||
((conf && unconf) && ((conf && unconf) &&
(!cmp_verf(conf->cl_verifier, unconf->cl_verifier) || (!cmp_verf(&conf->cl_verifier, &unconf->cl_verifier) ||
!cmp_name(&conf->cl_name, &unconf->cl_name)))) { !cmp_name(&conf->cl_name, &unconf->cl_name)))) {
if (!cmp_creds(&conf->cl_cred,&rqstp->rq_cred)) { if (!cmp_creds(&conf->cl_cred,&rqstp->rq_cred)) {
status = nfserr_clid_inuse; status = nfserr_clid_inuse;
...@@ -635,7 +635,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi ...@@ -635,7 +635,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
* unconf record found. * unconf record found.
* unconf->cl_confirm matches input confirm * unconf->cl_confirm matches input confirm
*/ */
if (!conf && unconf && cmp_verf(unconf->cl_confirm, confirm)) { if (!conf && unconf && cmp_verf(&unconf->cl_confirm, &confirm)) {
if (!cmp_creds(&unconf->cl_cred, &rqstp->rq_cred)) { if (!cmp_creds(&unconf->cl_cred, &rqstp->rq_cred)) {
status = nfserr_clid_inuse; status = nfserr_clid_inuse;
} else { } else {
...@@ -650,8 +650,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi ...@@ -650,8 +650,8 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confi
* unconf record not found, or if unconf, then unconf->cl_confirm * unconf record not found, or if unconf, then unconf->cl_confirm
* does not match input confirm. * does not match input confirm.
*/ */
if ((!conf || (conf && !cmp_verf(conf->cl_confirm, confirm))) && if ((!conf || (conf && !cmp_verf(&conf->cl_confirm, &confirm))) &&
(!unconf || (unconf && !cmp_verf(unconf->cl_confirm, confirm)))) { (!unconf || (unconf && !cmp_verf(&unconf->cl_confirm, &confirm)))) {
status = nfserr_stale_clientid; status = nfserr_stale_clientid;
goto out; goto out;
} }
......
...@@ -691,7 +691,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) ...@@ -691,7 +691,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open)
break; break;
case NFS4_CREATE_EXCLUSIVE: case NFS4_CREATE_EXCLUSIVE:
READ_BUF(8); READ_BUF(8);
COPYMEM(open->op_verf, 8); COPYMEM(open->op_verf.data, 8);
break; break;
default: default:
goto xdr_error; goto xdr_error;
...@@ -798,7 +798,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read ...@@ -798,7 +798,7 @@ nfsd4_decode_readdir(struct nfsd4_compoundargs *argp, struct nfsd4_readdir *read
READ_BUF(24); READ_BUF(24);
READ64(readdir->rd_cookie); READ64(readdir->rd_cookie);
COPYMEM(readdir->rd_verf, sizeof(nfs4_verifier)); COPYMEM(readdir->rd_verf.data, sizeof(readdir->rd_verf.data));
READ32(readdir->rd_dircount); /* just in case you needed a useless field... */ READ32(readdir->rd_dircount); /* just in case you needed a useless field... */
READ32(readdir->rd_maxcount); READ32(readdir->rd_maxcount);
if ((status = nfsd4_decode_bitmap(argp, readdir->rd_bmval))) if ((status = nfsd4_decode_bitmap(argp, readdir->rd_bmval)))
...@@ -873,7 +873,7 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient ...@@ -873,7 +873,7 @@ nfsd4_decode_setclientid(struct nfsd4_compoundargs *argp, struct nfsd4_setclient
DECODE_HEAD; DECODE_HEAD;
READ_BUF(12); READ_BUF(12);
COPYMEM(setclientid->se_verf, 8); COPYMEM(setclientid->se_verf.data, 8);
READ32(setclientid->se_namelen); READ32(setclientid->se_namelen);
READ_BUF(setclientid->se_namelen + 8); READ_BUF(setclientid->se_namelen + 8);
...@@ -1740,7 +1740,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_com ...@@ -1740,7 +1740,7 @@ nfsd4_encode_commit(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_com
if (!nfserr) { if (!nfserr) {
RESERVE_SPACE(8); RESERVE_SPACE(8);
WRITEMEM(commit->co_verf, 8); WRITEMEM(commit->co_verf.data, 8);
ADJUST_ARGS(); ADJUST_ARGS();
} }
} }
...@@ -2224,7 +2224,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ ...@@ -2224,7 +2224,7 @@ nfsd4_encode_write(struct nfsd4_compoundres *resp, int nfserr, struct nfsd4_writ
RESERVE_SPACE(16); RESERVE_SPACE(16);
WRITE32(write->wr_bytes_written); WRITE32(write->wr_bytes_written);
WRITE32(write->wr_how_written); WRITE32(write->wr_how_written);
WRITEMEM(write->wr_verifier, 8); WRITEMEM(write->wr_verifier.data, 8);
ADJUST_ARGS(); ADJUST_ARGS();
} }
} }
......
...@@ -46,8 +46,8 @@ ...@@ -46,8 +46,8 @@
#define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2 #define NFS4_ACE_SYSTEM_AUDIT_ACE_TYPE 2
#define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3 #define NFS4_ACE_SYSTEM_ALARM_ACE_TYPE 3
typedef char nfs4_verifier[NFS4_VERIFIER_SIZE]; typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
typedef char nfs4_stateid[16]; typedef struct { char data[16]; } nfs4_stateid;
enum nfs_opnum4 { enum nfs_opnum4 {
OP_ACCESS = 3, OP_ACCESS = 3,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment