All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chen Gang <gang.chen@asianux.com>
To: Jan Kara <jack@suse.cz>
Cc: 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 v3] fs/ext*,f2fs,jffs2,reiserfs: give comments for acl size and count calculation
Date: Tue, 08 Jan 2013 10:02:44 +0800	[thread overview]
Message-ID: <50EB7E44.1040707@asianux.com> (raw)
In-Reply-To: <20130107192016.GD13659@quack.suse.cz>

于 2013年01月08日 03:20, Jan Kara 写道:
> On Fri 04-01-13 11:26:53, 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.
>   Note that I actually updated the entry [2] to be more precise in my
> suggested comment. I wrote:
> [2] If ACL_USER or ACL_GROUP is present, then ACL_MASK must be present.
> 
>   Please use this formulation because the old version suggests ACL_MASK
> cannot be present if neither ACL_USER nor ACL_GROUP are present and that's
> not true. Otherwise your patch looks fine. Thanks!

  according to the implementation of posix_acl_valid (contents at bottom).
    new comments are more precise to match the implementation.
    it means:
      if new comments was incorrect, the implementation would be incorrect.
  welcome another members (especially Theodore Ts'o) to giving confirmation or completion. 

  I should wait 2 days, before send patch v4 with new comments.
    no additional reply within 2 days, means new comments is correct.


  Regards

gchen.


 76 int
 77 posix_acl_valid(const struct posix_acl *acl)
 78 {
 79         const struct posix_acl_entry *pa, *pe;
 80         int state = ACL_USER_OBJ;
 81         kuid_t prev_uid = INVALID_UID;
 82         kgid_t prev_gid = INVALID_GID;
 83         int needs_mask = 0;
 84 
 85         FOREACH_ACL_ENTRY(pa, acl, pe) {
 86                 if (pa->e_perm & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
 87                         return -EINVAL;
 88                 switch (pa->e_tag) {
 89                         case ACL_USER_OBJ:
 90                                 if (state == ACL_USER_OBJ) {
 91                                         state = ACL_USER;
 92                                         break;
 93                                 }
 94                                 return -EINVAL;
 95 
 96                         case ACL_USER:
 97                                 if (state != ACL_USER)
 98                                         return -EINVAL;
 99                                 if (!uid_valid(pa->e_uid))
100                                         return -EINVAL;
101                                 if (uid_valid(prev_uid) &&
102                                     uid_lte(pa->e_uid, prev_uid))
103                                         return -EINVAL;
104                                 prev_uid = pa->e_uid;
105                                 needs_mask = 1;
106                                 break;
107 
108                         case ACL_GROUP_OBJ:
109                                 if (state == ACL_USER) {
110                                         state = ACL_GROUP;
111                                         break;
112                                 }
113                                 return -EINVAL;
114 
115                         case ACL_GROUP:
116                                 if (state != ACL_GROUP)
117                                         return -EINVAL;
118                                 if (!gid_valid(pa->e_gid))
119                                         return -EINVAL;
120                                 if (gid_valid(prev_gid) &&
121                                     gid_lte(pa->e_gid, prev_gid))
122                                         return -EINVAL;
123                                 prev_gid = pa->e_gid;
124                                 needs_mask = 1;
125                                 break;
126 
127                         case ACL_MASK:
128                                 if (state != ACL_GROUP)
129                                         return -EINVAL;
130                                 state = ACL_OTHER;
131                                 break;
132 
133                         case ACL_OTHER:
134                                 if (state == ACL_OTHER ||
135                                     (state == ACL_GROUP && !needs_mask)) {
136                                         state = 0;
137                                         break;
138                                 }
139                                 return -EINVAL;
140 
141                         default:
142                                 return -EINVAL;
143                 }
144         }
145         if (state == 0)
146                 return 0;
147         return -EINVAL;
148 }


-- 
Chen Gang

Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: Chen Gang <gang.chen@asianux.com>
To: Jan Kara <jack@suse.cz>
Cc: Theodore Ts'o <tytso@mit.edu>,
	dwmw2@infradead.org, reiserfs-devel@vger.kernel.org,
	linux-f2fs-devel@lists.sourceforge.net, adilger.kernel@dilger.ca,
	linux-mtd@lists.infradead.org, jaegeuk.kim@samsung.com,
	akpm@linux-foundation.org, linux-ext4@vger.kernel.org,
	torvalds@linux-foundation.org
Subject: Re: [PATCH v3] fs/ext*,f2fs,jffs2,reiserfs: give comments for acl size and count calculation
Date: Tue, 08 Jan 2013 10:02:44 +0800	[thread overview]
Message-ID: <50EB7E44.1040707@asianux.com> (raw)
In-Reply-To: <20130107192016.GD13659@quack.suse.cz>

于 2013年01月08日 03:20, Jan Kara 写道:
> On Fri 04-01-13 11:26:53, 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.
>   Note that I actually updated the entry [2] to be more precise in my
> suggested comment. I wrote:
> [2] If ACL_USER or ACL_GROUP is present, then ACL_MASK must be present.
> 
>   Please use this formulation because the old version suggests ACL_MASK
> cannot be present if neither ACL_USER nor ACL_GROUP are present and that's
> not true. Otherwise your patch looks fine. Thanks!

  according to the implementation of posix_acl_valid (contents at bottom).
    new comments are more precise to match the implementation.
    it means:
      if new comments was incorrect, the implementation would be incorrect.
  welcome another members (especially Theodore Ts'o) to giving confirmation or completion. 

  I should wait 2 days, before send patch v4 with new comments.
    no additional reply within 2 days, means new comments is correct.


  Regards

gchen.


 76 int
 77 posix_acl_valid(const struct posix_acl *acl)
 78 {
 79         const struct posix_acl_entry *pa, *pe;
 80         int state = ACL_USER_OBJ;
 81         kuid_t prev_uid = INVALID_UID;
 82         kgid_t prev_gid = INVALID_GID;
 83         int needs_mask = 0;
 84 
 85         FOREACH_ACL_ENTRY(pa, acl, pe) {
 86                 if (pa->e_perm & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE))
 87                         return -EINVAL;
 88                 switch (pa->e_tag) {
 89                         case ACL_USER_OBJ:
 90                                 if (state == ACL_USER_OBJ) {
 91                                         state = ACL_USER;
 92                                         break;
 93                                 }
 94                                 return -EINVAL;
 95 
 96                         case ACL_USER:
 97                                 if (state != ACL_USER)
 98                                         return -EINVAL;
 99                                 if (!uid_valid(pa->e_uid))
100                                         return -EINVAL;
101                                 if (uid_valid(prev_uid) &&
102                                     uid_lte(pa->e_uid, prev_uid))
103                                         return -EINVAL;
104                                 prev_uid = pa->e_uid;
105                                 needs_mask = 1;
106                                 break;
107 
108                         case ACL_GROUP_OBJ:
109                                 if (state == ACL_USER) {
110                                         state = ACL_GROUP;
111                                         break;
112                                 }
113                                 return -EINVAL;
114 
115                         case ACL_GROUP:
116                                 if (state != ACL_GROUP)
117                                         return -EINVAL;
118                                 if (!gid_valid(pa->e_gid))
119                                         return -EINVAL;
120                                 if (gid_valid(prev_gid) &&
121                                     gid_lte(pa->e_gid, prev_gid))
122                                         return -EINVAL;
123                                 prev_gid = pa->e_gid;
124                                 needs_mask = 1;
125                                 break;
126 
127                         case ACL_MASK:
128                                 if (state != ACL_GROUP)
129                                         return -EINVAL;
130                                 state = ACL_OTHER;
131                                 break;
132 
133                         case ACL_OTHER:
134                                 if (state == ACL_OTHER ||
135                                     (state == ACL_GROUP && !needs_mask)) {
136                                         state = 0;
137                                         break;
138                                 }
139                                 return -EINVAL;
140 
141                         default:
142                                 return -EINVAL;
143                 }
144         }
145         if (state == 0)
146                 return 0;
147         return -EINVAL;
148 }


-- 
Chen Gang

Asianux Corporation

  reply	other threads:[~2013-01-08  2:01 UTC|newest]

Thread overview: 23+ 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
2012-12-31 15:45   ` Jan Kara
2013-01-04  3:04 ` [PATCH v2] " Chen Gang
2013-01-04  3:19   ` 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-07 19:20         ` Jan Kara
2013-01-08  2:02         ` Chen Gang [this message]
2013-01-08  2:02           ` Chen Gang
2013-01-11  8:58         ` [PATCH v4] " Chen Gang
2013-01-11  8:58           ` Chen Gang
2013-01-20  7:02           ` Chen Gang
2013-01-20  7:02             ` Chen Gang
2013-01-21 10:24             ` Jan Kara
2013-01-21 10:24               ` Jan Kara
2013-01-21 10:40               ` Chen Gang
2013-01-21 10:40                 ` Chen Gang
2013-01-29  8:24                 ` Chen Gang
2013-01-29  8:24                   ` Chen Gang
2013-02-02  5:10                   ` 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=50EB7E44.1040707@asianux.com \
    --to=gang.chen@asianux.com \
    --cc=adilger.kernel@dilger.ca \
    --cc=akpm@linux-foundation.org \
    --cc=dwmw2@infradead.org \
    --cc=jack@suse.cz \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.