diff mbox

[1/1,linux-next] ceph: use standard Opt_err

Message ID 1433531567-3948-1-git-send-email-fabf@skynet.be (mailing list archive)
State New, archived
Headers show

Commit Message

Fabian Frederick June 5, 2015, 7:12 p.m. UTC
ceph used -1 for the last match_table_t option.
Use Opt_err enum like other FS

match_token() is based on the pattern (NULL)
so behavior should remain the same.

Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
This is untested. If this one is ok, I can send the same update
for rbd and net/ceph.

 fs/ceph/super.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ilya Dryomov June 8, 2015, 7:49 a.m. UTC | #1
On Fri, Jun 5, 2015 at 10:12 PM, Fabian Frederick <fabf@skynet.be> wrote:
> ceph used -1 for the last match_table_t option.
> Use Opt_err enum like other FS
>
> match_token() is based on the pattern (NULL)
> so behavior should remain the same.
>
> Signed-off-by: Fabian Frederick <fabf@skynet.be>
> ---
> This is untested. If this one is ok, I can send the same update
> for rbd and net/ceph.
>
>  fs/ceph/super.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ceph/super.c b/fs/ceph/super.c
> index 4e99053..35ef692 100644
> --- a/fs/ceph/super.c
> +++ b/fs/ceph/super.c
> @@ -137,7 +137,8 @@ enum {
>  #ifdef CONFIG_CEPH_FS_POSIX_ACL
>         Opt_acl,
>  #endif
> -       Opt_noacl
> +       Opt_noacl,
> +       Opt_err
>  };
>
>  static match_table_t fsopt_tokens = {
> @@ -169,7 +170,7 @@ static match_table_t fsopt_tokens = {
>         {Opt_acl, "acl"},
>  #endif
>         {Opt_noacl, "noacl"},
> -       {-1, NULL}
> +       {Opt_err, NULL}
>  };
>
>  static int parse_fsopt_token(char *c, void *private)

This would result in a BUG on any unknown option - match_token->token
is what match_token() returns and parse_fsopt_token() clearly expects
that to be a negative value.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ilya Dryomov June 15, 2015, 9:30 a.m. UTC | #2
On Sun, Jun 14, 2015 at 12:05 PM, Fabian Frederick <fabf@skynet.be> wrote:
>
>
>> On 08 June 2015 at 09:49 Ilya Dryomov <idryomov@gmail.com> wrote:
>>
>>
>> On Fri, Jun 5, 2015 at 10:12 PM, Fabian Frederick <fabf@skynet.be> wrote:
>> > ceph used -1 for the last match_table_t option.
>> > Use Opt_err enum like other FS
>> >
>> > match_token() is based on the pattern (NULL)
>> > so behavior should remain the same.
>> >
>> > Signed-off-by: Fabian Frederick <fabf@skynet.be>
>> > ---
>> > This is untested. If this one is ok, I can send the same update
>> > for rbd and net/ceph.
>> >
>> >  fs/ceph/super.c | 5 +++--
>> >  1 file changed, 3 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/fs/ceph/super.c b/fs/ceph/super.c
>> > index 4e99053..35ef692 100644
>> > --- a/fs/ceph/super.c
>> > +++ b/fs/ceph/super.c
>> > @@ -137,7 +137,8 @@ enum {
>> >  #ifdef CONFIG_CEPH_FS_POSIX_ACL
>> >         Opt_acl,
>> >  #endif
>> > -       Opt_noacl
>> > +       Opt_noacl,
>> > +       Opt_err
>> >  };
>> >
>> >  static match_table_t fsopt_tokens = {
>> > @@ -169,7 +170,7 @@ static match_table_t fsopt_tokens = {
>> >         {Opt_acl, "acl"},
>> >  #endif
>> >         {Opt_noacl, "noacl"},
>> > -       {-1, NULL}
>> > +       {Opt_err, NULL}
>> >  };
>> >
>> >  static int parse_fsopt_token(char *c, void *private)
>>
>> This would result in a BUG on any unknown option - match_token->token
>> is what match_token() returns and parse_fsopt_token() clearly expects
>> that to be a negative value.
>>
>> Thanks,
>
> Maybe we could remove the following test ?
>
> token = match_token((char *)c, fsopt_tokens, argstr);
> if (token < 0)
>         return -EINVAL;
>
> and return -EINVAL in switch default case ?

Sounds good.

Thanks,

                Ilya
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/ceph/super.c b/fs/ceph/super.c
index 4e99053..35ef692 100644
--- a/fs/ceph/super.c
+++ b/fs/ceph/super.c
@@ -137,7 +137,8 @@  enum {
 #ifdef CONFIG_CEPH_FS_POSIX_ACL
 	Opt_acl,
 #endif
-	Opt_noacl
+	Opt_noacl,
+	Opt_err
 };
 
 static match_table_t fsopt_tokens = {
@@ -169,7 +170,7 @@  static match_table_t fsopt_tokens = {
 	{Opt_acl, "acl"},
 #endif
 	{Opt_noacl, "noacl"},
-	{-1, NULL}
+	{Opt_err, NULL}
 };
 
 static int parse_fsopt_token(char *c, void *private)