Re: [PATCH 3/3] parser: add unsigned int parser

From: Randy Dunlap
Date: Wed Jan 27 2021 - 22:28:56 EST


Hi,

On 1/27/21 6:20 PM, bingjingc wrote:
> From: BingJing Chang <bingjingc@xxxxxxxxxxxx>
>
> Will be used by fs parsing options
>
> Reviewed-by: Robbie Ko<robbieko@xxxxxxxxxxxx>
> Reviewed-by: Chung-Chiang Cheng <cccheng@xxxxxxxxxxxx>
> Signed-off-by: BingJing Chang <bingjingc@xxxxxxxxxxxx>
> ---
> fs/isofs/inode.c | 16 ++--------------
> fs/udf/super.c | 16 ++--------------
> include/linux/parser.h | 1 +
> lib/parser.c | 22 ++++++++++++++++++++++
> 4 files changed, 27 insertions(+), 28 deletions(-)

[snip]

> diff --git a/lib/parser.c b/lib/parser.c
> index f5b3e5d..2ec9c4f 100644
> --- a/lib/parser.c
> +++ b/lib/parser.c
> @@ -189,6 +189,28 @@ int match_int(substring_t *s, int *result)
> EXPORT_SYMBOL(match_int);
>
> /**
> + * match_uint: - scan a decimal representation of an integer from a substring_t

This shows us that all of the kernel-doc for functions in
lib/parser.c is formatted incorrectly.

The above should be:

* match_uint - scan a decimal representation of an integer from a substring_t

i.e., drop the ':' only on the function name lines, for all functions in
this source file.


If you don't want to do that, I'll plan to do it.


> + * @s: substring_t to be scanned
> + * @result: resulting integer on success
> + *
> + * Description: Attempts to parse the &substring_t @s as a decimal integer. On
> + * success, sets @result to the integer represented by the string and returns 0.
> + * Returns -ENOMEM, -EINVAL, or -ERANGE on failure.
> + */
> +int match_uint(substring_t *s, unsigned int *result)
> +{
> + int err = -ENOMEM;
> + char *buf = match_strdup(s);
> +
> + if (buf) {
> + err = kstrtouint(buf, 10, result);
> + kfree(buf);
> + }
> + return err;
> +}
> +EXPORT_SYMBOL(match_uint);
> +
> +/**
> * match_u64: - scan a decimal representation of a u64 from
> * a substring_t

ditto.

> * @s: substring_t to be scanned
>


thanks.
--
~Randy