mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Andreas Gruenbacher <agruen@suse.de>
Cc: linux-kernel@vger.kernel.org, James Morris <jmorris@namei.org>,
	Kay Sievers <kay.sievers@vrfy.org>
Subject: Re: Generic infrastructure for acls
Date: Fri, 1 Sep 2006 14:44:23 -0700	[thread overview]
Message-ID: <20060901144423.aa306d36.akpm@osdl.org> (raw)
In-Reply-To: <20060901221457.803728153@winden.suse.de>

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.  How is the caller to know that *list
got filled in?  By checking the generic_acl_list() return value against
`list_size'?

If so, shouldn't this be covered in the API description (when you write
it ;))?

Or should it be returning some error code in this case?

Or should we just strdup() the thing?

Or return `name' and let the caller worry about it?

-- 
VGER BF report: H 1.83187e-15

  reply	other threads:[~2006-09-01 21:44 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 [this message]
2006-09-01 22:32     ` Andreas Gruenbacher
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=20060901144423.aa306d36.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=agruen@suse.de \
    --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

Powered by JetHome