From: Jan Kara <jack@suse.cz>
To: Chen Gang <gang.chen@asianux.com>
Cc: jack@suse.cz, akpm@linux-foundation.org,
adilger.kernel@dilger.ca, Theodore Ts'o <tytso@mit.edu>,
jaegeuk.kim@samsung.com, dwmw2@infradead.org,
torvalds@linux-foundation.org, linux-ext4@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
linux-mtd@lists.infradead.org, reiserfs-devel@vger.kernel.org
Subject: Re: [PATCH] fs/ext*,f2fs,jffs2,reiserfs: give comments for acl size and count calculation
Date: Mon, 31 Dec 2012 16:45:59 +0100 [thread overview]
Message-ID: <20121231154559.GG7564@quack.suse.cz> (raw)
In-Reply-To: <50DD20B2.6040204@asianux.com>
On Fri 28-12-12 12:31:46, Chen Gang wrote:
>
> give comments (by Theodore Ts'o)
>
> ACL_USER_OBJ ACL_USER*[1] ACL_GROUP_OBJ ACL_GROUP*[1] ACL_MASK[2] ACL_OTHER
>
> [1] Where * is the regexp sense of "0 or more times"
> [2] Only if there is at least one ACL_USER or ACL_GROUP tag;
> otherwise skip ACL_MASK.
>
> use macro instead of hard code number (by Chen Gang)
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Chen Gang <gang.chen@asianux.com>
> ---
...
> diff --git a/include/linux/posix_acl.h b/include/linux/posix_acl.h
> index 7931efe..d75d2f6 100644
> --- a/include/linux/posix_acl.h
> +++ b/include/linux/posix_acl.h
> @@ -26,6 +26,15 @@
> #define ACL_MASK (0x10)
> #define ACL_OTHER (0x20)
>
> +/*
> + * ACL_USER_OBJ ACL_USER*[1] ACL_GROUP_OBJ ACL_GROUP*[1] ACL_MASK[2] ACL_OTHER
> + *
> + * [1] Where * is the regexp sense of "0 or more times"
> + * [2] Only if there is at least one ACL_USER or ACL_GROUP tag;
> + * otherwise skip ACL_MASK.
> + */
> +#define ACL_MAX_SHORT_ENTRY (4)
> +
I agree that defining a constant for this makes sence. Just please be
more verbose with the comment. This is hardly readable for anyone not
knowing what's going on in advance. Also braces around 4 are superfluous.
Add something like the comment below before posix_acl_valid():
/*
* posix_acl_valid() makes sure ACL format is the following:
* ACL_USER_OBJ ACL_USER*[1] ACL_GROUP_OBJ ACL_GROUP*[1] ACL_MASK[2] ACL_OTHER
*
* [1] Where * is the regexp sense of "0 or more times"
* [2] If ACL_USER or ACL_GROUP is present, then ACL_MASK must be present.
*/
Then add comment before definition of ACL_MAX_SHORT_ENTRY:
/*
* posix_acl_valid() makes sure that if there are <= 4 ACL entries, then
* all of them are short. Otherwise exactly 4 entries are short ones and
* other have full length. See comment before that function for exact ACL
* format.
*/
Honza
> /* permissions in the e_perm field */
> #define ACL_READ (0x04)
> #define ACL_WRITE (0x02)
> --
> 1.7.10.4
--
Jan Kara <jack@suse.cz>
SUSE Labs, CR
next prev parent reply other threads:[~2012-12-31 15:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-28 4:31 [PATCH] fs/ext*,f2fs,jffs2,reiserfs: give comments for acl size and count calculation Chen Gang
2012-12-31 15:45 ` Jan Kara [this message]
2013-01-04 3:04 ` [PATCH v2] " Chen Gang
2013-01-04 3:19 ` Chen Gang
2013-01-04 3:26 ` [PATCH v3] " Chen Gang
2013-01-07 19:20 ` Jan Kara
2013-01-08 2:02 ` Chen Gang
2013-01-11 8:58 ` [PATCH v4] " Chen Gang
2013-01-20 7:02 ` Chen Gang
2013-01-21 10:24 ` Jan Kara
2013-01-21 10:40 ` Chen Gang
2013-01-29 8:24 ` Chen Gang
2013-02-02 5:10 ` Chen Gang
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=20121231154559.GG7564@quack.suse.cz \
--to=jack@suse.cz \
--cc=adilger.kernel@dilger.ca \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=gang.chen@asianux.com \
--cc=jaegeuk.kim@samsung.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-mtd@lists.infradead.org \
--cc=reiserfs-devel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=tytso@mit.edu \
/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;
as well as URLs for NNTP newsgroup(s).