From: Alli <allison.henderson@oracle.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH v1 15/17] xfs: Add helper function xfs_attr_list_context_init
Date: Wed, 29 Jun 2022 18:30:01 -0700 [thread overview]
Message-ID: <dbbdeb895015267acf0793daa535cfa20a72592a.camel@oracle.com> (raw)
In-Reply-To: <YrydJU8b6rbTc33J@magnolia>
On Wed, 2022-06-29 at 11:42 -0700, Darrick J. Wong wrote:
> On Sat, Jun 11, 2022 at 02:41:58AM -0700, Allison Henderson wrote:
> > This patch adds a helper function xfs_attr_list_context_init used
> > by
> > xfs_attr_list. This function initializes the xfs_attr_list_context
> > structure passed to xfs_attr_list_int. We will need this later to
> > call
> > xfs_attr_list_int_ilocked when the node is already locked.
>
> Since you've mentioned the xattr userspace functions -- does our
> current
> codebase hide the parent pointer xattrs from regular
> getxattr/setxattr/listxattr system calls?
I don't think it's hidden, but it has the XFS_ATTR_PARENT flag set so
that the caller can know to handle it differently than a normal string
attr.
>
> > Signed-off-by: Allison Henderson <allison.henderson@oracle.com>
>
> The change itself looks pretty straightfoward,
> Reviewed-by: Darrick J. Wong <djwong@kernel.org>
>
Great, thanks!
Allison
> --D
>
> > ---
> > fs/xfs/xfs_file.c | 1 +
> > fs/xfs/xfs_ioctl.c | 54 ++++++++++++++++++++++++++++++++--------
> > ------
> > fs/xfs/xfs_ioctl.h | 2 ++
> > 3 files changed, 41 insertions(+), 16 deletions(-)
> >
> > diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> > index e2f2a3a94634..884827f024fd 100644
> > --- a/fs/xfs/xfs_file.c
> > +++ b/fs/xfs/xfs_file.c
> > @@ -17,6 +17,7 @@
> > #include "xfs_bmap_util.h"
> > #include "xfs_dir2.h"
> > #include "xfs_dir2_priv.h"
> > +#include "xfs_attr.h"
> > #include "xfs_ioctl.h"
> > #include "xfs_trace.h"
> > #include "xfs_log.h"
> > diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c
> > index 5a364a7d58fd..e1612e99e0c5 100644
> > --- a/fs/xfs/xfs_ioctl.c
> > +++ b/fs/xfs/xfs_ioctl.c
> > @@ -369,6 +369,40 @@ xfs_attr_flags(
> > return 0;
> > }
> >
> > +/*
> > + * Initializes an xfs_attr_list_context suitable for
> > + * use by xfs_attr_list
> > + */
> > +int
> > +xfs_ioc_attr_list_context_init(
> > + struct xfs_inode *dp,
> > + char *buffer,
> > + int bufsize,
> > + int flags,
> > + struct xfs_attr_list_context *context)
> > +{
> > + struct xfs_attrlist *alist;
> > +
> > + /*
> > + * Initialize the output buffer.
> > + */
> > + context->dp = dp;
> > + context->resynch = 1;
> > + context->attr_filter = xfs_attr_filter(flags);
> > + context->buffer = buffer;
> > + context->bufsize = round_down(bufsize, sizeof(uint32_t));
> > + context->firstu = context->bufsize;
> > + context->put_listent = xfs_ioc_attr_put_listent;
> > +
> > + alist = context->buffer;
> > + alist->al_count = 0;
> > + alist->al_more = 0;
> > + alist->al_offset[0] = context->bufsize;
> > +
> > + return 0;
> > +}
> > +
> > +
> > int
> > xfs_ioc_attr_list(
> > struct xfs_inode *dp,
> > @@ -378,7 +412,6 @@ xfs_ioc_attr_list(
> > struct xfs_attrlist_cursor __user *ucursor)
> > {
> > struct xfs_attr_list_context context = { };
> > - struct xfs_attrlist *alist;
> > void *buffer;
> > int error;
> >
> > @@ -410,21 +443,10 @@ xfs_ioc_attr_list(
> > if (!buffer)
> > return -ENOMEM;
> >
> > - /*
> > - * Initialize the output buffer.
> > - */
> > - context.dp = dp;
> > - context.resynch = 1;
> > - context.attr_filter = xfs_attr_filter(flags);
> > - context.buffer = buffer;
> > - context.bufsize = round_down(bufsize, sizeof(uint32_t));
> > - context.firstu = context.bufsize;
> > - context.put_listent = xfs_ioc_attr_put_listent;
> > -
> > - alist = context.buffer;
> > - alist->al_count = 0;
> > - alist->al_more = 0;
> > - alist->al_offset[0] = context.bufsize;
> > + error = xfs_ioc_attr_list_context_init(dp, buffer, bufsize,
> > flags,
> > + &context);
> > + if (error)
> > + return error;
> >
> > error = xfs_attr_list(&context);
> > if (error)
> > diff --git a/fs/xfs/xfs_ioctl.h b/fs/xfs/xfs_ioctl.h
> > index d4abba2c13c1..ca60e1c427a3 100644
> > --- a/fs/xfs/xfs_ioctl.h
> > +++ b/fs/xfs/xfs_ioctl.h
> > @@ -35,6 +35,8 @@ int xfs_ioc_attrmulti_one(struct file *parfilp,
> > struct inode *inode,
> > int xfs_ioc_attr_list(struct xfs_inode *dp, void __user *ubuf,
> > size_t bufsize, int flags,
> > struct xfs_attrlist_cursor __user *ucursor);
> > +int xfs_ioc_attr_list_context_init(struct xfs_inode *dp, char
> > *buffer,
> > + int bufsize, int flags, struct xfs_attr_list_context
> > *context);
> >
> > extern struct dentry *
> > xfs_handle_to_dentry(
> > --
> > 2.25.1
> >
next prev parent reply other threads:[~2022-06-30 1:30 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-11 9:41 [PATCH v1 00/17] Return of the Parent Pointers Allison Henderson
2022-06-11 9:41 ` [PATCH v1 01/17] xfs: Add larp state XFS_DAS_CREATE_FORK Allison Henderson
2022-06-15 1:09 ` Dave Chinner
2022-06-15 23:40 ` Alli
2022-06-16 2:08 ` Dave Chinner
2022-06-16 5:32 ` Dave Chinner
2022-06-29 6:33 ` Alli
2022-06-30 0:40 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 02/17] xfs: Hold inode locks in xfs_ialloc Allison Henderson
2022-06-29 18:28 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 03/17] xfs: get directory offset when adding directory name Allison Henderson
2022-06-29 18:29 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 04/17] xfs: get directory offset when removing " Allison Henderson
2022-06-29 18:30 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 05/17] xfs: get directory offset when replacing a " Allison Henderson
2022-06-29 18:30 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 06/17] xfs: add parent pointer support to attribute code Allison Henderson
2022-06-29 18:33 ` Darrick J. Wong
2022-06-29 18:58 ` Alli
2022-06-11 9:41 ` [PATCH v1 07/17] xfs: define parent pointer xattr format Allison Henderson
2022-06-29 18:34 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 08/17] xfs: Add xfs_verify_pptr Allison Henderson
2022-06-29 18:35 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 09/17] xfs: extent transaction reservations for parent attributes Allison Henderson
2022-06-16 5:38 ` Dave Chinner
2022-06-18 0:31 ` Alli
2022-06-29 18:37 ` Darrick J. Wong
2022-06-29 19:23 ` Alli
2022-06-11 9:41 ` [PATCH v1 10/17] xfs: parent pointer attribute creation Allison Henderson
2022-06-16 5:49 ` Dave Chinner
2022-06-18 0:32 ` Alli
2022-06-29 18:41 ` Darrick J. Wong
2022-06-30 1:29 ` Alli
2022-06-11 9:41 ` [PATCH v1 11/17] xfs: add parent attributes to link Allison Henderson
2022-06-16 22:39 ` Dave Chinner
2022-06-18 0:32 ` Alli
2022-06-29 18:09 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 12/17] xfs: remove parent pointers in unlink Allison Henderson
2022-06-29 17:35 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 13/17] xfs: Add parent pointers to rename Allison Henderson
2022-06-29 18:02 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 14/17] xfs: Add the parent pointer support to the superblock version 5 Allison Henderson
2022-06-16 6:03 ` Dave Chinner
2022-06-18 0:32 ` Alli
2022-06-20 0:21 ` Dave Chinner
2022-06-29 18:16 ` Darrick J. Wong
2022-06-11 9:41 ` [PATCH v1 15/17] xfs: Add helper function xfs_attr_list_context_init Allison Henderson
2022-06-29 18:42 ` Darrick J. Wong
2022-06-30 1:30 ` Alli [this message]
2022-06-11 9:41 ` [PATCH v1 16/17] xfs: Increase XFS_DEFER_OPS_NR_INODES to 4 Allison Henderson
2022-06-16 21:54 ` Dave Chinner
2022-06-18 0:32 ` Alli
2022-06-29 18:43 ` Darrick J. Wong
2022-06-30 1:30 ` Alli
2022-06-11 9:42 ` [PATCH v1 17/17] xfs: Add parent pointer ioctl Allison Henderson
2022-06-29 18:52 ` Darrick J. Wong
2022-06-30 1:30 ` Alli
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbbdeb895015267acf0793daa535cfa20a72592a.camel@oracle.com \
--to=allison.henderson@oracle.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox