From: Timothy Shimmin <tes@sgi.com>
To: Christoph Hellwig <hch@lst.de>
Cc: xfs-oss <xfs@oss.sgi.com>
Subject: Re: [PATCH] use generic_*xattr routines
Date: Tue, 27 May 2008 20:50:48 +1000 [thread overview]
Message-ID: <483BE788.4050504@sgi.com> (raw)
In-Reply-To: <20080526053759.GA17825@lst.de>
Christoph Hellwig wrote:
> On Mon, May 26, 2008 at 11:43:42AM +1000, Timothy Shimmin wrote:
>> I guess this is done to some extent by the put_listent() callback.
>> Though, the context structure is probably a bit overused in different
>> ways.
>> The callback was also used for searching (for parent-ptr code) as well
>> as for list formatting.
>> I presume we are preserving the valuelen list format to keep the API
>> for xfs_attrlist_by_handle used by xfsdump and probably for dmf.
>
> Yes, the idea is to change the put_listen callback for work more like
> filldir. Thas is:
>
> - the callback is supplied by the xfs_attr_list caller, not set based
> on options
Oh, okay. For example, instead of setting the flags to ATTR_KERNOVAL
such as in xfs_vn_listxattr when size is 0, one could just set the callback
to xfs_attr_kern_list_sizes and pass it in etc...
> - there will be an opaque object supplied to xfs_attr_list that is to
> be used by put_listent so that we don't have to pass down
> implementation-specific arguments directly.
>
Ok.
So instead of overloading fields in xfs_attr_list_context_t,
you'll pass down a void* argument or some such for callback specific data.
> I'd also like to move the attrlist_cursor_kern_t into this callback
> opaque context because it doesn't make sense for the normal xattr API,
> but I'll have to see if that's actually feasible.
BTW, the cursor stuff is a bit flawed. Like the dir1 code (I believe),
if from userspace you use the cursor and modifications happen to the EAs
(add or removal) between calls,
we can end up repeating elements in the list or miss some.
We don't preserve the position and we can compact the data etc.
--Tim
xfs_attr_list(
xfs_inode_t *dp,
char *buffer,
int bufsize,
int flags,
attrlist_cursor_kern_t *cursor)
{
xfs_attr_list_context_t context;
...
if (flags & ATTR_KERNAMELS) {
context.bufsize = bufsize;
context.firstu = context.bufsize;
if (flags & ATTR_KERNOVAL)
context.put_listent = xfs_attr_kern_list_sizes;
else
context.put_listent = xfs_attr_kern_list;
} else {
context.bufsize = (bufsize & ~(sizeof(int)-1)); /* align */
context.firstu = context.bufsize;
context.alist->al_count = 0;
context.alist->al_more = 0;
context.alist->al_offset[0] = context.bufsize;
context.put_listent = xfs_attr_put_listent;
}
ssize_t
xfs_vn_listxattr(struct dentry *dentry, char *data, size_t size)
{
struct inode *inode = dentry->d_inode;
struct xfs_inode *ip = XFS_I(inode);
attrlist_cursor_kern_t cursor = { 0 };
int error, xflags;
ssize_t result;
xflags = ATTR_KERNAMELS;
if (!size)
xflags |= ATTR_KERNOVAL;
if (capable(CAP_SYS_ADMIN))
xflags |= ATTR_KERNFULLS;
else
xflags |= ATTR_KERNORMALS;
/*
* First read the regular on-disk attributes.
*/
result = -xfs_attr_list(ip, data, size, xflags, &cursor);
next prev parent reply other threads:[~2008-05-27 10:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-30 11:22 [PATCH] use generic_*xattr routines Christoph Hellwig
2008-05-21 8:16 ` Christoph Hellwig
2008-05-22 7:17 ` Timothy Shimmin
2008-05-23 5:22 ` Timothy Shimmin
2008-05-23 5:48 ` Christoph Hellwig
2008-05-26 1:43 ` Timothy Shimmin
2008-05-26 5:37 ` Christoph Hellwig
2008-05-27 10:50 ` Timothy Shimmin [this message]
2008-05-29 12:39 ` Christoph Hellwig
2008-05-30 6:37 ` Timothy Shimmin
2008-05-30 7:53 ` Christoph Hellwig
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=483BE788.4050504@sgi.com \
--to=tes@sgi.com \
--cc=hch@lst.de \
--cc=xfs@oss.sgi.com \
/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