From: Will Dyson <will.dyson@gmail.com>
To: James Morris <jmorris@redhat.com>
Cc: Andrew Morton <akpm@osdl.org>,
viro@parcelfarce.linux.theplanet.co.uk,
Stephen Smalley <sds@epoch.ncsc.mil>,
Christoph Hellwig <hch@infradead.org>,
Andreas Gruenbacher <agruen@suse.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/6] xattr consolidation v2 - generic xattr API
Date: Mon, 20 Sep 2004 23:25:10 -0400 [thread overview]
Message-ID: <8e6f9472040920202565041b61@mail.gmail.com> (raw)
In-Reply-To: <Xine.LNX.4.44.0409201904220.23206-100000@thoron.boston.redhat.com>
On Mon, 20 Sep 2004 19:07:21 -0400 (EDT), James Morris
<jmorris@redhat.com> wrote:
> > For example:
> >
> > /*
> > In order to implement different sets of xattr operations for each
> > xattr prefix, a filesystem should create a null-terminated array of
> > struct xattr_handler (one for each prefix) and hang a pointer to it
> > off of the s_xattr field of the superblock. The generic_fooxattr
> > functions will search this list for a xattr_handler with a prefix
> > field that matches the prefix of the xattr we are dealing with and
> > call the apropriate function pointer from that xattr_handler.
> > */
>
> The above is inaccurate. e.g. not all of the generic functions search for
> a matching xattr handler.
Ok. You see the difficulty of documenting code that someone else
wrote. Please consider the following:
--- xattr.c.old 2004-09-20 22:39:18.000000000 -0400
+++ xattr.c 2004-09-20 23:13:53.000000000 -0400
@@ -359,11 +359,24 @@
return *a_prefix ? NULL : a;
}
+/*
+ * In order to implement different sets of xattr operations for each xattr
+ * prefix, a filesystem should create a null-terminated array of struct
+ * xattr_handler (one for each prefix) and hang a pointer to it off of the
+ * s_xattr field of the superblock.
+ *
+ * The generic_fooxattr() functions will use this list to dispatch xattr
+ * operations to the correct xattr_handler.
+ */
+
#define for_each_xattr_handler(handlers, handler) \
for ((handler) = *(handlers)++; \
(handler) != NULL; \
(handler) = *(handlers)++)
+/*
+ * Find the xattr_handler with the matching prefix
+ */
static struct xattr_handler *xattr_resolve_name(struct xattr_handler
**handlers, const char **name)
{
struct xattr_handler *handler;
@@ -381,6 +394,9 @@
return handler;
}
+/*
+ * Find the handler for the prefix and dispatch the operation through it
+ */
ssize_t generic_getxattr(struct dentry *dentry, const char *name,
void *buffer, size_t size)
{
struct xattr_handler *handler;
@@ -392,6 +408,10 @@
return handler->get(inode, name, buffer, size);
}
+/*
+ * Combine the results of the list() function from every xattr_handler in the
+ * list.
+ */
ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t
buffer_size)
{
struct inode *inode = dentry->d_inode;
@@ -417,6 +437,9 @@
return size;
}
+/*
+ * Find the handler for the prefix and dispatch the operation through it
+ */
int generic_setxattr(struct dentry *dentry, const char *name, const
void *value, size_t size, int flags)
{
struct xattr_handler *handler;
@@ -430,6 +453,9 @@
return handler->set(inode, name, value, size, flags);
}
+/*
+ * Find the handler for the prefix and dispatch the operation through it
+ */
int generic_removexattr(struct dentry *dentry, const char *name)
{
struct xattr_handler *handler;
--
Will Dyson - Consultant
http://www.lucidts.com/
prev parent reply other threads:[~2004-09-21 3:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <Xine.LNX.4.44.0409180252090.10905@thoron.boston.redhat.com>
2004-09-18 7:20 ` [PATCH 1/6] xattr consolidation v2 - generic xattr API James Morris
2004-09-18 23:31 ` Andreas Gruenbacher
2004-09-18 23:47 ` James Morris
2004-09-19 10:13 ` Andreas Gruenbacher
2004-09-19 14:46 ` James Morris
2004-09-20 17:50 ` Will Dyson
2004-09-20 23:07 ` James Morris
2004-09-21 3:25 ` Will Dyson [this message]
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=8e6f9472040920202565041b61@mail.gmail.com \
--to=will.dyson@gmail.com \
--cc=agruen@suse.de \
--cc=akpm@osdl.org \
--cc=hch@infradead.org \
--cc=jmorris@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sds@epoch.ncsc.mil \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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