From: Andreas Gruenbacher <agruen@suse.de>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org, James Morris <jmorris@namei.org>,
Kay Sievers <kay.sievers@vrfy.org>
Subject: Re: Generic infrastructure for acls
Date: Sat, 2 Sep 2006 00:32:02 +0200 [thread overview]
Message-ID: <200609020032.02595.agruen@suse.de> (raw)
In-Reply-To: <20060901144423.aa306d36.akpm@osdl.org>
On Friday, 01 September 2006 23:44, Andrew Morton wrote:
> On Sat, 02 Sep 2006 00:14:22 +0200
>
> Andreas Gruenbacher <agruen@suse.de> wrote:
> > +generic_acl_list(struct inode *inode, struct generic_acl_operations
> > *ops, + int type, char *list, size_t list_size)
> > +{
> > + struct posix_acl *acl;
> > + const char *name;
> > + size_t size;
> > +
> > + acl = ops->getacl(inode, type);
> > + if (!acl)
> > + return 0;
> > + posix_acl_release(acl);
> > +
> > + switch(type) {
> > + case ACL_TYPE_ACCESS:
> > + name = POSIX_ACL_XATTR_ACCESS;
> > + break;
> > +
> > + case ACL_TYPE_DEFAULT:
> > + name = POSIX_ACL_XATTR_DEFAULT;
> > + break;
> > +
> > + default:
> > + return 0;
> > + }
> > + size = strlen(name) + 1;
> > + if (list && size <= list_size)
> > + memcpy(list, name, size);
> > + return size;
> > +}
>
> That's a clumsy-looking interface.
We could get rid of the switch by passing in the type and the name, but
otherwise that's pretty exactly what's needed, no matter if done in a
fs-dependent or independent way.
> How is the caller to know that *list got filled in? By checking the
generic_acl_list() return value against `list_size'?
The return value determines how many bytes have been used or would be needed
in the buffer -- generic_listxattr() in fs/xattr.c has this code:
> for_each_xattr_handler(handlers, handler) {
> size = handler->list(inode, buf, buffer_size, NULL, 0);
> if (size > buffer_size)
> return -ERANGE;
> buf += size;
> buffer_size -= size;
> }
Andreas
--
VGER BF report: H 0
next prev parent reply other threads:[~2006-09-01 22:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-01 22:14 [patch 0/2] Tmpfs acls Andreas Gruenbacher
2006-09-01 22:14 ` Generic infrastructure for acls Andreas Gruenbacher
2006-09-01 21:44 ` Andrew Morton
2006-09-01 22:32 ` Andreas Gruenbacher [this message]
2006-09-06 16:40 ` Andreas Gruenbacher
2006-09-06 20:06 ` Randy.Dunlap
2006-09-06 6:54 ` Jan Engelhardt
2006-09-01 22:14 ` Access Control Lists for tmpfs Andreas Gruenbacher
2006-09-01 21:52 ` Andrew Morton
2006-09-02 7:24 ` Arjan van de Ven
2006-09-05 19:07 ` Andrew Morton
2006-09-06 16:40 ` Andreas Gruenbacher
2006-09-06 7:02 ` Jan Engelhardt
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=200609020032.02595.agruen@suse.de \
--to=agruen@suse.de \
--cc=akpm@osdl.org \
--cc=jmorris@namei.org \
--cc=kay.sievers@vrfy.org \
--cc=linux-kernel@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