diff mbox series

[v3,11/13] ext4: change token2str() to use ext4_param_specs

Message ID 20211021114508.21407-12-lczerner@redhat.com
State Superseded
Headers show
Series ext4: new mount API conversion | expand

Commit Message

Lukas Czerner Oct. 21, 2021, 11:45 a.m. UTC
Chage token2str() to use ext4_param_specs instead of tokens so that we
can get rid of tokens entirely.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
---
 fs/ext4/super.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Carlos Maiolino Oct. 26, 2021, 11:40 a.m. UTC | #1
On Thu, Oct 21, 2021 at 01:45:06PM +0200, Lukas Czerner wrote:
> Chage token2str() to use ext4_param_specs instead of tokens so that we

^ Change.

> can get rid of tokens entirely.

If you're removing tokens entirely, maybe the name token2str() doesn't make
sense anymore?

> 
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> ---
>  fs/ext4/super.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index bdcaa158eab8..0ccd47f3fa91 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -3037,12 +3037,12 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
>  
>  static const char *token2str(int token)
>  {
> -	const struct match_token *t;
> +	const struct fs_parameter_spec *spec;
>  
> -	for (t = tokens; t->token != Opt_err; t++)
> -		if (t->token == token && !strchr(t->pattern, '='))
> +	for (spec = ext4_param_specs; spec->name != NULL; spec++)
> +		if (spec->opt == token && !spec->type)
>  			break;
> -	return t->pattern;
> +	return spec->name;
>  }
>  
>  /*
> -- 
> 2.31.1
>
Lukas Czerner Oct. 26, 2021, 12:09 p.m. UTC | #2
On Tue, Oct 26, 2021 at 01:40:43PM +0200, Carlos Maiolino wrote:
> On Thu, Oct 21, 2021 at 01:45:06PM +0200, Lukas Czerner wrote:
> > Chage token2str() to use ext4_param_specs instead of tokens so that we
> 
> ^ Change.
> 
> > can get rid of tokens entirely.
> 
> If you're removing tokens entirely, maybe the name token2str() doesn't make
> sense anymore?

True, I guess it's no longer called "token" so maybe option2str() ?

-Lukas

> 
> > 
> > Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> > ---
> >  fs/ext4/super.c | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> > 
> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > index bdcaa158eab8..0ccd47f3fa91 100644
> > --- a/fs/ext4/super.c
> > +++ b/fs/ext4/super.c
> > @@ -3037,12 +3037,12 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
> >  
> >  static const char *token2str(int token)
> >  {
> > -	const struct match_token *t;
> > +	const struct fs_parameter_spec *spec;
> >  
> > -	for (t = tokens; t->token != Opt_err; t++)
> > -		if (t->token == token && !strchr(t->pattern, '='))
> > +	for (spec = ext4_param_specs; spec->name != NULL; spec++)
> > +		if (spec->opt == token && !spec->type)
> >  			break;
> > -	return t->pattern;
> > +	return spec->name;
> >  }
> >  
> >  /*
> > -- 
> > 2.31.1
> > 
> 
> -- 
> Carlos
>
Lukas Czerner Oct. 27, 2021, 11:52 a.m. UTC | #3
On Tue, Oct 26, 2021 at 02:09:53PM +0200, Lukas Czerner wrote:
> On Tue, Oct 26, 2021 at 01:40:43PM +0200, Carlos Maiolino wrote:
> > On Thu, Oct 21, 2021 at 01:45:06PM +0200, Lukas Czerner wrote:
> > > Chage token2str() to use ext4_param_specs instead of tokens so that we
> > 
> > ^ Change.
> > 
> > > can get rid of tokens entirely.
> > 
> > If you're removing tokens entirely, maybe the name token2str() doesn't make
> > sense anymore?
> 
> True, I guess it's no longer called "token" so maybe option2str() ?

Actually it's still called token in the struct mount_opts which is what
we're passing down to the token2str() anyway. Since this really is
inconsequential stuff I'll leave it as it is.

-Lukas

> 
> -Lukas
> 
> > 
> > > 
> > > Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> > > ---
> > >  fs/ext4/super.c | 8 ++++----
> > >  1 file changed, 4 insertions(+), 4 deletions(-)
> > > 
> > > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> > > index bdcaa158eab8..0ccd47f3fa91 100644
> > > --- a/fs/ext4/super.c
> > > +++ b/fs/ext4/super.c
> > > @@ -3037,12 +3037,12 @@ static inline void ext4_show_quota_options(struct seq_file *seq,
> > >  
> > >  static const char *token2str(int token)
> > >  {
> > > -	const struct match_token *t;
> > > +	const struct fs_parameter_spec *spec;
> > >  
> > > -	for (t = tokens; t->token != Opt_err; t++)
> > > -		if (t->token == token && !strchr(t->pattern, '='))
> > > +	for (spec = ext4_param_specs; spec->name != NULL; spec++)
> > > +		if (spec->opt == token && !spec->type)
> > >  			break;
> > > -	return t->pattern;
> > > +	return spec->name;
> > >  }
> > >  
> > >  /*
> > > -- 
> > > 2.31.1
> > > 
> > 
> > -- 
> > Carlos
> > 
>
diff mbox series

Patch

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index bdcaa158eab8..0ccd47f3fa91 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -3037,12 +3037,12 @@  static inline void ext4_show_quota_options(struct seq_file *seq,
 
 static const char *token2str(int token)
 {
-	const struct match_token *t;
+	const struct fs_parameter_spec *spec;
 
-	for (t = tokens; t->token != Opt_err; t++)
-		if (t->token == token && !strchr(t->pattern, '='))
+	for (spec = ext4_param_specs; spec->name != NULL; spec++)
+		if (spec->opt == token && !spec->type)
 			break;
-	return t->pattern;
+	return spec->name;
 }
 
 /*