linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Introduce vfs_listxattr
@ 2006-10-09 20:10 Josef Sipek
  2006-10-09 20:33 ` Andrew Morton
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Josef Sipek @ 2006-10-09 20:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: notting, akpm, torvalds, hch, viro, linux-fsdevel

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce vfs_listxattr
  2006-10-09 20:10 [PATCH] Introduce vfs_listxattr Josef Sipek
@ 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
  2 siblings, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2006-10-09 20:33 UTC (permalink / raw)
  To: Josef Sipek; +Cc: linux-kernel, notting, torvalds, hch, viro, linux-fsdevel

On Mon, 9 Oct 2006 16:10:48 -0400
Josef Sipek <jsipek@fsl.cs.sunysb.edu> wrote:

> 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.

That tells us what the patch does.  In general, please be sure to also tell
us *why* you prepared a patch.

Does this patch allow unionfs to be loaded into an otherwise unpatched
kernel.org kernel?  If so, that seems to be a good reason for including
this patch into the mainline kernel.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce vfs_listxattr
  2006-10-09 20:10 [PATCH] Introduce vfs_listxattr Josef Sipek
  2006-10-09 20:33 ` Andrew Morton
@ 2006-10-09 20:39 ` Al Viro
  2006-10-10 13:31 ` Christoph Hellwig
  2 siblings, 0 replies; 6+ messages in thread
From: Al Viro @ 2006-10-09 20:39 UTC (permalink / raw)
  To: Josef Sipek; +Cc: linux-kernel, notting, akpm, torvalds, hch, linux-fsdevel

On Mon, Oct 09, 2006 at 04:10:48PM -0400, Josef Sipek wrote:
> 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.

Makes sense, regardless of unionfs.

ACKed-by: Al Viro <viro@zeniv.linux.org.uk>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce vfs_listxattr
  2006-10-09 20:33 ` Andrew Morton
@ 2006-10-09 20:42   ` Al Viro
  2006-10-09 20:46   ` Josef Sipek
  1 sibling, 0 replies; 6+ messages in thread
From: Al Viro @ 2006-10-09 20:42 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Josef Sipek, linux-kernel, notting, torvalds, hch, linux-fsdevel

On Mon, Oct 09, 2006 at 01:33:32PM -0700, Andrew Morton wrote:
> On Mon, 9 Oct 2006 16:10:48 -0400
> Josef Sipek <jsipek@fsl.cs.sunysb.edu> wrote:
> 
> > 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.
> 
> That tells us what the patch does.  In general, please be sure to also tell
> us *why* you prepared a patch.
> 
> Does this patch allow unionfs to be loaded into an otherwise unpatched
> kernel.org kernel?  If so, that seems to be a good reason for including
> this patch into the mainline kernel.

Generally I'd say that it makes sense.  Anything that wants to
access the method in question would either have to play with
set_fs() or open-code it; neither is good.

It makes sense to localize calls of a method when we have pretty
much mandatory framing for it (security_... stuff).

So the only question is whether it makes sense for anything other
than syscall itself to access the method in question.  AFAICS,
the answer's yes...

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce vfs_listxattr
  2006-10-09 20:33 ` Andrew Morton
  2006-10-09 20:42   ` Al Viro
@ 2006-10-09 20:46   ` Josef Sipek
  1 sibling, 0 replies; 6+ messages in thread
From: Josef Sipek @ 2006-10-09 20:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, notting, torvalds, hch, viro, linux-fsdevel

On Mon, Oct 09, 2006 at 01:33:32PM -0700, Andrew Morton wrote:
> On Mon, 9 Oct 2006 16:10:48 -0400
> Josef Sipek <jsipek@fsl.cs.sunysb.edu> wrote:
> 
> > 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.
> 
> That tells us what the patch does.  In general, please be sure to also tell
> us *why* you prepared a patch.
>
> Does this patch allow unionfs to be loaded into an otherwise unpatched
> kernel.org kernel?  If so, that seems to be a good reason for including
> this patch into the mainline kernel.

Sorry about that. The reason for this submission is to make the listxattr
code in fs/xattr.c a little cleaner (as well as to clean up some code in
Unionfs.)

Currently, Unionfs has vfs_listxattr defined in its code. I think that's
very ugly, and I'd like to see it (re)moved. The logical place to put it, is
along side of all the other vfs_*xattr functions. Overall, I think this
patch is benefitial for both kernel.org kernel and Unionfs.

Josef "Jeff" Sipek.

-- 
Humans were created by water to transport it upward.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Introduce vfs_listxattr
  2006-10-09 20:10 [PATCH] Introduce vfs_listxattr Josef Sipek
  2006-10-09 20:33 ` Andrew Morton
  2006-10-09 20:39 ` Al Viro
@ 2006-10-10 13:31 ` Christoph Hellwig
  2 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2006-10-10 13:31 UTC (permalink / raw)
  To: Josef Sipek
  Cc: linux-kernel, notting, akpm, torvalds, hch, viro, linux-fsdevel

On Mon, Oct 09, 2006 at 04:10:48PM -0400, Josef Sipek wrote:
> 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.

Looks fine, thanks.  I didn't do it back then because nfsd wasn't using
it, but it's an obvious addition to the vfs_* APIs.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-10-10 13:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-09 20:10 [PATCH] Introduce vfs_listxattr Josef Sipek
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).