Re: [PATCH 10/14] nfsd: implement the xattr procedure functions.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> On Mar 11, 2020, at 3:59 PM, Frank van der Linden <fllinden@xxxxxxxxxx> wrote:
> 
> Implement the main entry points for the *XATTR operations.

This patch triggers "defined but not used" compiler warnings.
These new functions need to be introduced in the same patch
that adds their callsites.

You might consider squashing together all the patches that
only add new NFSD code, for instance.


> Signed-off-by: Frank van der Linden <fllinden@xxxxxxxxxx>
> ---
> fs/nfsd/nfs4proc.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> fs/nfsd/nfs4xdr.c  |  2 ++
> 2 files changed, 75 insertions(+)
> 
> diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
> index b573ae1121af..a76b9025a357 100644
> --- a/fs/nfsd/nfs4proc.c
> +++ b/fs/nfsd/nfs4proc.c
> @@ -2098,6 +2098,79 @@ nfsd4_layoutreturn(struct svc_rqst *rqstp,
> }
> #endif /* CONFIG_NFSD_PNFS */
> 
> +static __be32
> +nfsd4_getxattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> +	       union nfsd4_op_u *u)
> +{
> +	struct nfsd4_getxattr *getxattr = &u->getxattr;
> +
> +	return nfsd_getxattr(rqstp, &cstate->current_fh,
> +			     getxattr->getxa_name, getxattr->getxa_buf,
> +			     &getxattr->getxa_len);
> +}
> +
> +static __be32
> +nfsd4_setxattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> +	   union nfsd4_op_u *u)
> +{
> +	struct nfsd4_setxattr *setxattr = &u->setxattr;
> +	int ret;
> +
> +	if (opens_in_grace(SVC_NET(rqstp)))
> +		return nfserr_grace;
> +
> +	ret = nfsd_setxattr(rqstp, &cstate->current_fh, setxattr->setxa_name,
> +			    setxattr->setxa_buf, setxattr->setxa_len,
> +			    setxattr->setxa_flags);
> +
> +	if (!ret)
> +		set_change_info(&setxattr->setxa_cinfo, &cstate->current_fh);
> +
> +	return ret;
> +}
> +
> +static __be32
> +nfsd4_listxattrs(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> +	   union nfsd4_op_u *u)
> +{
> +	int ret, len;
> +
> +	/*
> +	 * Get the entire list, then copy out only the user attributes
> +	 * in the encode function. lsxa_buf was previously allocated as
> +	 * tmp svc space, and will be automatically freed later.
> +	 */
> +	len = XATTR_LIST_MAX;
> +
> +	ret = nfsd_listxattr(rqstp, &cstate->current_fh, u->listxattrs.lsxa_buf,
> +			     &len);
> +	if (ret)
> +		return ret;
> +
> +	u->listxattrs.lsxa_len = len;
> +
> +	return nfs_ok;
> +}
> +
> +static __be32
> +nfsd4_removexattr(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
> +	   union nfsd4_op_u *u)
> +{
> +	struct nfsd4_removexattr *removexattr = &u->removexattr;
> +	int ret;
> +
> +	if (opens_in_grace(SVC_NET(rqstp)))
> +		return nfserr_grace;
> +
> +	ret = nfsd_removexattr(rqstp, &cstate->current_fh,
> +	    removexattr->rmxa_name);
> +
> +	if (!ret)
> +		set_change_info(&removexattr->rmxa_cinfo, &cstate->current_fh);
> +
> +	return ret;
> +}
> +
> /*
>  * NULL call.
>  */
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index f6322add2992..b12d7ac6f52c 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -41,6 +41,8 @@
> #include <linux/pagemap.h>
> #include <linux/sunrpc/svcauth_gss.h>
> #include <linux/sunrpc/addr.h>
> +#include <linux/xattr.h>
> +#include <uapi/linux/xattr.h>
> 
> #include "idmap.h"
> #include "acl.h"
> -- 
> 2.16.6
> 

--
Chuck Lever







[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux