Newer
Older
static void encode_test_stateid(struct xdr_stream *xdr,
struct nfs41_test_stateid_args *args,
struct compound_hdr *hdr)
{
encode_op_hdr(xdr, OP_TEST_STATEID, decode_test_stateid_maxsz, hdr);
encode_uint32(xdr, 1);
encode_nfs4_stateid(xdr, args->stateid);
static void encode_free_stateid(struct xdr_stream *xdr,
struct nfs41_free_stateid_args *args,
struct compound_hdr *hdr)
{
encode_op_hdr(xdr, OP_FREE_STATEID, decode_free_stateid_maxsz, hdr);
encode_nfs4_stateid(xdr, args->stateid);
#endif /* CONFIG_NFS_V4_1 */
/*
* END OF "GENERIC" ENCODE ROUTINES.
*/
static u32 nfs4_xdr_minorversion(const struct nfs4_sequence_args *args)
{
#if defined(CONFIG_NFS_V4_1)
if (args->sa_slot)
return args->sa_slot->table->session->clp->cl_mvops->minor_version;
#endif /* CONFIG_NFS_V4_1 */
return 0;
}
static void nfs4_xdr_enc_access(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_accessargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_access(xdr, args->access, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_lookup(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_lookup_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->dir_fh, &hdr);
encode_lookup(xdr, args->name, &hdr);
encode_getfh(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
}
/*
* Encode LOOKUP_ROOT request
*/
static void nfs4_xdr_enc_lookup_root(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs4_lookup_root_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putrootfh(xdr, &hdr);
encode_getfh(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_remove(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs_removeargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_remove(xdr, &args->name, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_rename(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs_renameargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->old_dir, &hdr);
encode_savefh(xdr, &hdr);
encode_putfh(xdr, args->new_dir, &hdr);
encode_rename(xdr, args->old_name, args->new_name, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_link(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_link_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_savefh(xdr, &hdr);
encode_putfh(xdr, args->dir_fh, &hdr);
encode_link(xdr, args->name, &hdr);
encode_restorefh(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_create(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_create_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->dir_fh, &hdr);
encode_create(xdr, args, &hdr);
encode_getfh(xdr, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_symlink(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_create_arg *args)
nfs4_xdr_enc_create(req, xdr, args);
static void nfs4_xdr_enc_getattr(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_getattr_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_close(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_closeargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_close(xdr, args, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_openargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_open(xdr, args, &hdr);
encode_getfh(xdr, &hdr);
if (args->access)
encode_access(xdr, args->access, &hdr);
encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr);
encode_nops(&hdr);
}
/*
* Encode an OPEN_CONFIRM request
*/
static void nfs4_xdr_enc_open_confirm(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_open_confirmargs *args)
encode_compound_hdr(xdr, req, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_open_confirm(xdr, args, &hdr);
encode_nops(&hdr);
}
/*
* Encode an OPEN request with no attributes.
*/
static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_openargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_open(xdr, args, &hdr);
if (args->access)
encode_access(xdr, args->access, &hdr);
encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr);
encode_nops(&hdr);
}
/*
* Encode an OPEN_DOWNGRADE request
*/
static void nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_closeargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_open_downgrade(xdr, args, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_lock(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_lock_args *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_lock(xdr, args, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_lockt(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_lockt_args *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_lockt(xdr, args, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_locku(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_locku_args *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_locku(xdr, args, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_release_lockowner(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_release_lockowner_args *args)
{
struct compound_hdr hdr = {
.minorversion = 0,
};
encode_compound_hdr(xdr, req, &hdr);
encode_release_lockowner(xdr, &args->lock_owner, &hdr);
encode_nops(&hdr);
}
static void nfs4_xdr_enc_readlink(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_readlink *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_readlink(xdr, args, req, &hdr);

Benny Halevy
committed
xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages,
args->pgbase, args->pglen);
encode_nops(&hdr);
}
/*
* Encode a READDIR request
*/
static void nfs4_xdr_enc_readdir(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_readdir_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_readdir(xdr, args, req, &hdr);

Benny Halevy
committed
xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages,
args->pgbase, args->count);
dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",

Benny Halevy
committed
__func__, hdr.replen << 2, args->pages,
args->pgbase, args->count);
encode_nops(&hdr);
static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_readargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_read(xdr, args, &hdr);

Benny Halevy
committed
xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2,
req->rq_rcv_buf.flags |= XDRBUF_READ;
encode_nops(&hdr);
}
/*
* Encode an SETATTR request
*/
static void nfs4_xdr_enc_setattr(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_setattrargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_setattr(xdr, args, args->server, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
/*
* Encode a GETACL request
*/
static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_getaclargs *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),

Benny Halevy
committed
uint32_t replen;
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
replen = hdr.replen + op_decode_hdr_maxsz + 1;
encode_getattr_two(xdr, FATTR4_WORD0_ACL, 0, &hdr);

Benny Halevy
committed
xdr_inline_pages(&req->rq_rcv_buf, replen << 2,
args->acl_pages, args->acl_pgbase, args->acl_len);
encode_nops(&hdr);
static void nfs4_xdr_enc_write(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_writeargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_write(xdr, args, &hdr);
req->rq_snd_buf.flags |= XDRBUF_WRITE;
if (args->bitmask)
encode_getfattr(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_commit(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_commitargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_commit(xdr, args, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs4_fsinfo_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_fsinfo(xdr, args->bitmask, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_pathconf(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_pathconf_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_getattr_one(xdr, args->bitmask[0] & nfs4_pathconf_bitmap[0],
encode_nops(&hdr);
static void nfs4_xdr_enc_statfs(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct nfs4_statfs_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_getattr_two(xdr, args->bitmask[0] & nfs4_statfs_bitmap[0],
args->bitmask[1] & nfs4_statfs_bitmap[1], &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_server_caps(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_server_caps_arg *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fhandle, &hdr);
encode_getattr_one(xdr, FATTR4_WORD0_SUPPORTED_ATTRS|
FATTR4_WORD0_FH_EXPIRE_TYPE|
FATTR4_WORD0_LINK_SUPPORT|
FATTR4_WORD0_SYMLINK_SUPPORT|
FATTR4_WORD0_ACLSUPPORT, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_renew(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs_client *clp)
encode_compound_hdr(xdr, req, &hdr);
encode_renew(xdr, clp->cl_clientid, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_setclientid(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_setclientid *sc)
encode_compound_hdr(xdr, req, &hdr);
encode_setclientid(xdr, sc, &hdr);
encode_nops(&hdr);
}
/*
* a SETCLIENTID_CONFIRM request
*/
static void nfs4_xdr_enc_setclientid_confirm(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_setclientid_res *arg)
const u32 lease_bitmap[3] = { FATTR4_WORD0_LEASE_TIME };
encode_compound_hdr(xdr, req, &hdr);
encode_setclientid_confirm(xdr, arg, &hdr);
encode_putrootfh(xdr, &hdr);
encode_fsinfo(xdr, lease_bitmap, &hdr);
encode_nops(&hdr);
static void nfs4_xdr_enc_delegreturn(struct rpc_rqst *req,
struct xdr_stream *xdr,
const struct nfs4_delegreturnargs *args)
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fhandle, &hdr);
encode_getfattr(xdr, args->bitmask, &hdr);
encode_delegreturn(xdr, args->stateid, &hdr);
encode_nops(&hdr);
/*
* Encode FS_LOCATIONS request
*/
static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_fs_locations_arg *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),

Benny Halevy
committed
uint32_t replen;
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->dir_fh, &hdr);
encode_lookup(xdr, args->name, &hdr);

Benny Halevy
committed
replen = hdr.replen; /* get the attribute into args->page */
encode_fs_locations(xdr, args->bitmask, &hdr);

Benny Halevy
committed
xdr_inline_pages(&req->rq_rcv_buf, replen << 2, &args->page,
encode_nops(&hdr);
/*
* Encode SECINFO request
*/
static void nfs4_xdr_enc_secinfo(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_secinfo_arg *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->dir_fh, &hdr);
encode_secinfo(xdr, args->name, &hdr);
encode_nops(&hdr);
}
/*
* BIND_CONN_TO_SESSION request
*/
static void nfs4_xdr_enc_bind_conn_to_session(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_client *clp)
{
struct compound_hdr hdr = {
.minorversion = clp->cl_mvops->minor_version,
};
encode_compound_hdr(xdr, req, &hdr);
encode_bind_conn_to_session(xdr, clp->cl_session, &hdr);
encode_nops(&hdr);
}
static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs41_exchange_id_args *args)
.minorversion = args->client->cl_mvops->minor_version,
encode_compound_hdr(xdr, req, &hdr);
encode_exchange_id(xdr, args, &hdr);
/*
* a CREATE_SESSION request
*/
static void nfs4_xdr_enc_create_session(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs41_create_session_args *args)
.minorversion = args->client->cl_mvops->minor_version,
encode_compound_hdr(xdr, req, &hdr);
encode_create_session(xdr, args, &hdr);
/*
* a DESTROY_SESSION request
*/
static void nfs4_xdr_enc_destroy_session(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_session *session)
.minorversion = session->clp->cl_mvops->minor_version,
encode_compound_hdr(xdr, req, &hdr);
encode_destroy_session(xdr, session, &hdr);
/*
* a DESTROY_CLIENTID request
*/
static void nfs4_xdr_enc_destroy_clientid(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs_client *clp)
{
struct compound_hdr hdr = {
.minorversion = clp->cl_mvops->minor_version,
};
encode_compound_hdr(xdr, req, &hdr);
encode_destroy_clientid(xdr, clp->cl_clientid, &hdr);
encode_nops(&hdr);
}
static void nfs4_xdr_enc_sequence(struct rpc_rqst *req, struct xdr_stream *xdr,
struct nfs4_sequence_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, args, &hdr);
static void nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_get_lease_time_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->la_seq_args),
};
const u32 lease_bitmap[3] = { FATTR4_WORD0_LEASE_TIME };
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->la_seq_args, &hdr);
encode_putrootfh(xdr, &hdr);
encode_fsinfo(xdr, lease_bitmap, &hdr);
/*
* a RECLAIM_COMPLETE request
*/
static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs41_reclaim_complete_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args)
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_reclaim_complete(xdr, args, &hdr);
encode_nops(&hdr);
}
/*
* Encode GETDEVICELIST request
*/
static void nfs4_xdr_enc_getdevicelist(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_getdevicelist_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, args->fh, &hdr);
encode_getdevicelist(xdr, args, &hdr);
encode_nops(&hdr);
}
/*
* Encode GETDEVICEINFO request
*/
static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_getdeviceinfo_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_getdeviceinfo(xdr, args, &hdr);
/* set up reply kvec. Subtract notification bitmap max size (2)
* so that notification bitmap is put in xdr_buf tail */
xdr_inline_pages(&req->rq_rcv_buf, (hdr.replen - 2) << 2,
args->pdev->pages, args->pdev->pgbase,
args->pdev->pglen);
encode_nops(&hdr);
}
/*
* Encode LAYOUTGET request
*/
static void nfs4_xdr_enc_layoutget(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_layoutget_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, NFS_FH(args->inode), &hdr);
encode_layoutget(xdr, args, &hdr);
xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2,
args->layout.pages, 0, args->layout.pglen);
encode_nops(&hdr);
}
/*
* Encode LAYOUTCOMMIT request
*/
static void nfs4_xdr_enc_layoutcommit(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_layoutcommit_args *args)
struct nfs4_layoutcommit_data *data =
container_of(args, struct nfs4_layoutcommit_data, args);
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, NFS_FH(args->inode), &hdr);
encode_layoutcommit(xdr, data->args.inode, args, &hdr);
encode_nops(&hdr);
}
/*
* Encode LAYOUTRETURN request
*/
static void nfs4_xdr_enc_layoutreturn(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs4_layoutreturn_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putfh(xdr, NFS_FH(args->inode), &hdr);
encode_layoutreturn(xdr, args, &hdr);
encode_nops(&hdr);
/*
* Encode SECINFO_NO_NAME request
*/
static int nfs4_xdr_enc_secinfo_no_name(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs41_secinfo_no_name_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_putrootfh(xdr, &hdr);
encode_secinfo_no_name(xdr, args, &hdr);
encode_nops(&hdr);
return 0;
}
/*
* Encode TEST_STATEID request
*/
static void nfs4_xdr_enc_test_stateid(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs41_test_stateid_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_test_stateid(xdr, args, &hdr);
encode_nops(&hdr);
}
/*
* Encode FREE_STATEID request
*/
static void nfs4_xdr_enc_free_stateid(struct rpc_rqst *req,
struct xdr_stream *xdr,
struct nfs41_free_stateid_args *args)
{
struct compound_hdr hdr = {
.minorversion = nfs4_xdr_minorversion(&args->seq_args),
};
encode_compound_hdr(xdr, req, &hdr);
encode_sequence(xdr, &args->seq_args, &hdr);
encode_free_stateid(xdr, args, &hdr);
encode_nops(&hdr);
}
static void print_overflow_msg(const char *func, const struct xdr_stream *xdr)
{
dprintk("nfs: %s: prematurely hit end of receive buffer. "
"Remaining buffer length is %tu words.\n",
func, xdr->end - xdr->p);
}
static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string)
p = xdr_inline_decode(xdr, 4);
if (unlikely(!p))
goto out_overflow;
p = xdr_inline_decode(xdr, *len);
if (unlikely(!p))
goto out_overflow;
out_overflow:
print_overflow_msg(__func__, xdr);
return -EIO;
}
static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
{
p = xdr_inline_decode(xdr, 8);
if (unlikely(!p))
goto out_overflow;