⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nfs4xdr.c

📁 linux 内核源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
 * Encode LINK request */static int nfs4_xdr_enc_link(struct rpc_rqst *req, __be32 *p, const struct nfs4_link_arg *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 7,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	if ((status = encode_putfh(&xdr, args->fh)) != 0)		goto out;	if ((status = encode_savefh(&xdr)) != 0)		goto out;	if ((status = encode_putfh(&xdr, args->dir_fh)) != 0)		goto out;	if ((status = encode_link(&xdr, args->name)) != 0)		goto out;	if ((status = encode_getfattr(&xdr, args->bitmask)) != 0)		goto out;	if ((status = encode_restorefh(&xdr)) != 0)		goto out;	status = encode_getfattr(&xdr, args->bitmask);out:	return status;}/* * Encode CREATE request */static int nfs4_xdr_enc_create(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 7,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	if ((status = encode_putfh(&xdr, args->dir_fh)) != 0)		goto out;	if ((status = encode_savefh(&xdr)) != 0)		goto out;	if ((status = encode_create(&xdr, args)) != 0)		goto out;	if ((status = encode_getfh(&xdr)) != 0)		goto out;	if ((status = encode_getfattr(&xdr, args->bitmask)) != 0)		goto out;	if ((status = encode_restorefh(&xdr)) != 0)		goto out;	status = encode_getfattr(&xdr, args->bitmask);out:	return status;}/* * Encode SYMLINK request */static int nfs4_xdr_enc_symlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_create_arg *args){	return nfs4_xdr_enc_create(req, p, args);}/* * Encode GETATTR request */static int nfs4_xdr_enc_getattr(struct rpc_rqst *req, __be32 *p, const struct nfs4_getattr_arg *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 2,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	if ((status = encode_putfh(&xdr, args->fh)) == 0)		status = encode_getfattr(&xdr, args->bitmask);	return status;}/* * Encode a CLOSE request */static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args){        struct xdr_stream xdr;        struct compound_hdr hdr = {                .nops   = 3,        };        int status;        xdr_init_encode(&xdr, &req->rq_snd_buf, p);        encode_compound_hdr(&xdr, &hdr);        status = encode_putfh(&xdr, args->fh);        if(status)                goto out;        status = encode_close(&xdr, args);	if (status != 0)		goto out;	status = encode_getfattr(&xdr, args->bitmask);out:        return status;}/* * Encode an OPEN request */static int nfs4_xdr_enc_open(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 7,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (status)		goto out;	status = encode_savefh(&xdr);	if (status)		goto out;	status = encode_open(&xdr, args);	if (status)		goto out;	status = encode_getfh(&xdr);	if (status)		goto out;	status = encode_getfattr(&xdr, args->bitmask);	if (status)		goto out;	status = encode_restorefh(&xdr);	if (status)		goto out;	status = encode_getfattr(&xdr, args->bitmask);out:	return status;}/* * Encode an OPEN_CONFIRM request */static int nfs4_xdr_enc_open_confirm(struct rpc_rqst *req, __be32 *p, struct nfs_open_confirmargs *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops   = 2,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if(status)		goto out;	status = encode_open_confirm(&xdr, args);out:	return status;}/* * Encode an OPEN request with no attributes. */static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops   = 3,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (status)		goto out;	status = encode_open(&xdr, args);	if (status)		goto out;	status = encode_getfattr(&xdr, args->bitmask);out:	return status;}/* * Encode an OPEN_DOWNGRADE request */static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops	= 3,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (status)		goto out;	status = encode_open_downgrade(&xdr, args);	if (status != 0)		goto out;	status = encode_getfattr(&xdr, args->bitmask);out:	return status;}/* * Encode a LOCK request */static int nfs4_xdr_enc_lock(struct rpc_rqst *req, __be32 *p, struct nfs_lock_args *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops   = 2,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if(status)		goto out;	status = encode_lock(&xdr, args);out:	return status;}/* * Encode a LOCKT request */static int nfs4_xdr_enc_lockt(struct rpc_rqst *req, __be32 *p, struct nfs_lockt_args *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops   = 2,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if(status)		goto out;	status = encode_lockt(&xdr, args);out:	return status;}/* * Encode a LOCKU request */static int nfs4_xdr_enc_locku(struct rpc_rqst *req, __be32 *p, struct nfs_locku_args *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops   = 2,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if(status)		goto out;	status = encode_locku(&xdr, args);out:	return status;}/* * Encode a READLINK request */static int nfs4_xdr_enc_readlink(struct rpc_rqst *req, __be32 *p, const struct nfs4_readlink *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 2,	};	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;	unsigned int replen;	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if(status)		goto out;	status = encode_readlink(&xdr, args, req);	/* set up reply kvec	 *    toplevel_status + taglen + rescount + OP_PUTFH + status	 *      + OP_READLINK + status + string length = 8	 */	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readlink_sz) << 2;	xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,			args->pgbase, args->pglen);out:	return status;}/* * Encode a READDIR request */static int nfs4_xdr_enc_readdir(struct rpc_rqst *req, __be32 *p, const struct nfs4_readdir_arg *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 2,	};	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;	int replen;	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if(status)		goto out;	status = encode_readdir(&xdr, args, req);	/* set up reply kvec	 *    toplevel_status + taglen + rescount + OP_PUTFH + status	 *      + OP_READDIR + status + verifer(2)  = 9	 */	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_readdir_sz) << 2;	xdr_inline_pages(&req->rq_rcv_buf, replen, args->pages,			 args->pgbase, args->count);	dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",			__FUNCTION__, replen, args->pages,			args->pgbase, args->count);out:	return status;}/* * Encode a READ request */static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args){	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 2,	};	int replen, status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (status)		goto out;	status = encode_read(&xdr, args);	if (status)		goto out;	/* set up reply kvec	 *    toplevel status + taglen=0 + rescount + OP_PUTFH + status	 *       + OP_READ + status + eof + datalen = 9	 */	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_read_sz) << 2;	xdr_inline_pages(&req->rq_rcv_buf, replen,			 args->pages, args->pgbase, args->count);	req->rq_rcv_buf.flags |= XDRBUF_READ;out:	return status;}/* * Encode an SETATTR request */static int nfs4_xdr_enc_setattr(struct rpc_rqst *req, __be32 *p, struct nfs_setattrargs *args){        struct xdr_stream xdr;        struct compound_hdr hdr = {                .nops   = 3,        };        int status;        xdr_init_encode(&xdr, &req->rq_snd_buf, p);        encode_compound_hdr(&xdr, &hdr);        status = encode_putfh(&xdr, args->fh);        if(status)                goto out;        status = encode_setattr(&xdr, args, args->server);        if(status)                goto out;	status = encode_getfattr(&xdr, args->bitmask);out:        return status;}/* * Encode a GETACL request */static intnfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p,		struct nfs_getaclargs *args){	struct xdr_stream xdr;	struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth;	struct compound_hdr hdr = {		.nops   = 2,	};	int replen, status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (status)		goto out;	status = encode_getattr_two(&xdr, FATTR4_WORD0_ACL, 0);	/* set up reply buffer: */	replen = (RPC_REPHDRSIZE + auth->au_rslack + NFS4_dec_getacl_sz) << 2;	xdr_inline_pages(&req->rq_rcv_buf, replen,		args->acl_pages, args->acl_pgbase, args->acl_len);out:	return status;}/* * Encode a WRITE request */static int nfs4_xdr_enc_write(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 3,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (status)		goto out;	status = encode_write(&xdr, args);	if (status)		goto out;	req->rq_snd_buf.flags |= XDRBUF_WRITE;	status = encode_getfattr(&xdr, args->bitmask);out:	return status;}/* *  a COMMIT request */static int nfs4_xdr_enc_commit(struct rpc_rqst *req, __be32 *p, struct nfs_writeargs *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops = 3,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (status)		goto out;	status = encode_commit(&xdr, args);	if (status)		goto out;	status = encode_getfattr(&xdr, args->bitmask);out:	return status;}/* * FSINFO request */static int nfs4_xdr_enc_fsinfo(struct rpc_rqst *req, __be32 *p, struct nfs4_fsinfo_arg *args){	struct xdr_stream xdr;	struct compound_hdr hdr = {		.nops	= 2,	};	int status;	xdr_init_encode(&xdr, &req->rq_snd_buf, p);	encode_compound_hdr(&xdr, &hdr);	status = encode_putfh(&xdr, args->fh);	if (!status)		status = encode_fsinfo(&xdr, args->bitmask);	return status;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -