From: Josef Sipek <jsipek@fsl.cs.sunysb.edu>
To: linux-kernel@vger.kernel.org
Cc: notting@redhat.com, akpm@osdl.org, torvalds@osdl.org,
hch@infradead.org, viro@ftp.linux.org.uk,
linux-fsdevel@vger.kernel.org
Subject: [PATCH] Introduce vfs_listxattr
Date: Mon, 9 Oct 2006 16:10:48 -0400 [thread overview]
Message-ID: <20061009201048.GA4707@filer.fsl.cs.sunysb.edu> (raw)
From: Bill Nottingham <notting@redhat.com>
This patch moves code out of fs/xattr.c:listxattr into a new function -
vfs_listxattr. The code for vfs_listxattr was originally submitted by Bill
Nottingham <notting@redhat.com> to Unionfs.
Signed-off-by: Josef "Jeff" Sipek <jsipek@cs.sunysb.edu>
diff -r 0231458fbb78 fs/xattr.c
--- a/fs/xattr.c Sat Oct 07 16:46:17 2006 -0400
+++ b/fs/xattr.c Sat Oct 07 17:36:18 2006 -0400
@@ -135,6 +135,26 @@ vfs_getxattr(struct dentry *dentry, char
}
EXPORT_SYMBOL_GPL(vfs_getxattr);
+ssize_t
+vfs_listxattr(struct dentry *d, char *list, size_t size)
+{
+ ssize_t error;
+
+ error = security_inode_listxattr(d);
+ if (error)
+ return error;
+ error = -EOPNOTSUPP;
+ if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
+ error = d->d_inode->i_op->listxattr(d, list, size);
+ } else {
+ error = security_inode_listsecurity(d->d_inode, list, size);
+ if (size && error > size)
+ error = -ERANGE;
+ }
+ return error;
+}
+EXPORT_SYMBOL_GPL(vfs_listxattr);
+
int
vfs_removexattr(struct dentry *dentry, char *name)
{
@@ -346,17 +366,7 @@ listxattr(struct dentry *d, char __user
return -ENOMEM;
}
- error = security_inode_listxattr(d);
- if (error)
- goto out;
- error = -EOPNOTSUPP;
- if (d->d_inode->i_op && d->d_inode->i_op->listxattr) {
- error = d->d_inode->i_op->listxattr(d, klist, size);
- } else {
- error = security_inode_listsecurity(d->d_inode, klist, size);
- if (size && error > size)
- error = -ERANGE;
- }
+ error = vfs_listxattr(d, klist, size);
if (error > 0) {
if (size && copy_to_user(list, klist, error))
error = -EFAULT;
@@ -365,7 +375,6 @@ listxattr(struct dentry *d, char __user
than XATTR_LIST_MAX bytes. Not possible. */
error = -E2BIG;
}
-out:
kfree(klist);
return error;
}
diff -r 0231458fbb78 include/linux/xattr.h
--- a/include/linux/xattr.h Sat Oct 07 16:46:17 2006 -0400
+++ b/include/linux/xattr.h Sat Oct 07 17:32:43 2006 -0400
@@ -41,6 +41,7 @@ struct xattr_handler {
};
ssize_t vfs_getxattr(struct dentry *, char *, void *, size_t);
+ssize_t vfs_listxattr(struct dentry *d, char *list, size_t size);
int vfs_setxattr(struct dentry *, char *, void *, size_t, int);
int vfs_removexattr(struct dentry *, char *);
--
UNIX is user-friendly ... it's just selective about who it's friends are
next reply other threads:[~2006-10-09 20:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-09 20:10 Josef Sipek [this message]
2006-10-09 20:33 ` Andrew Morton
2006-10-09 20:42 ` Al Viro
2006-10-09 20:46 ` Josef Sipek
2006-10-09 20:39 ` Al Viro
2006-10-10 13:31 ` 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=20061009201048.GA4707@filer.fsl.cs.sunysb.edu \
--to=jsipek@fsl.cs.sunysb.edu \
--cc=akpm@osdl.org \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=notting@redhat.com \
--cc=torvalds@osdl.org \
--cc=viro@ftp.linux.org.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
all inboxes | Powered by JetHome®