Re: why strcmp(name, "") ?

Andreas Gruenbacher <[email protected]> Thu, 16 Feb 2006 10:03:44 +0100
Newsgroups gmane.linux.file-systems.acl.devel
Organization SUSE Labs / Novell Inc.
Message-ID <[email protected]>
On Thursday 16 February 2006 09:29, h.xu wrote:
> Hi!
>
> In linux-2.6.12.5/fs/ext3/acl.c, we have the following code:
>
> static int
> ext3_xattr_get_acl_access(struct inode *inode, const char *name,
>               void *buffer, size_t size)
> {
>     if (strcmp(name, "") != 0)
>         return -EINVAL;
>     return ext3_xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
> }
>
> [...]
>
> My question is:
>
> Why strcmp `name' with ""?  Why must `name' be ""?  Who called these
> functions and are they sure that `name' parameter must be ""?

Because the VFS only does a prefix match, so all requests for attributes 
called system.posix_acl_access* end up here. We only want to make sure there 
is no garbage at the end.

Andreas

-- 
Andreas Gruenbacher <[email protected]>
SUSE Labs, SUSE LINUX Products GmbH / Novell Inc.
_______________________________________________
acl-devel mailing list
[email protected]
http://acl.bestbits.at/mailman/listinfo/acl-devel