Commit edd9334c authored by Randy Dunlap's avatar Randy Dunlap Committed by Linus Torvalds

lib: parser: clean up kernel-doc

Mark match_uint() as kernel-doc notation since it is already fully
annotated as such.  Use % prefix on constants in kernel-doc comments.
Convert function return descriptions to use the "Return:" kernel-doc
notation.

Link: https://lkml.kernel.org/r/20210407034514.5651-1-rdunlap@infradead.orgSigned-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 9d6ecac0
...@@ -98,7 +98,7 @@ static int match_one(char *s, const char *p, substring_t args[]) ...@@ -98,7 +98,7 @@ static int match_one(char *s, const char *p, substring_t args[])
* locations. * locations.
* *
* Description: Detects which if any of a set of token strings has been passed * Description: Detects which if any of a set of token strings has been passed
* to it. Tokens can include up to MAX_OPT_ARGS instances of basic c-style * to it. Tokens can include up to %MAX_OPT_ARGS instances of basic c-style
* format identifiers which will be taken into account when matching the * format identifiers which will be taken into account when matching the
* tokens, and whose locations will be returned in the @args array. * tokens, and whose locations will be returned in the @args array.
*/ */
...@@ -120,8 +120,10 @@ EXPORT_SYMBOL(match_token); ...@@ -120,8 +120,10 @@ EXPORT_SYMBOL(match_token);
* @base: base to use when converting string * @base: base to use when converting string
* *
* Description: Given a &substring_t and a base, attempts to parse the substring * Description: Given a &substring_t and a base, attempts to parse the substring
* as a number in that base. On success, sets @result to the integer represented * as a number in that base.
* by the string and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure. *
* Return: On success, sets @result to the integer represented by the
* string and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure.
*/ */
static int match_number(substring_t *s, int *result, int base) static int match_number(substring_t *s, int *result, int base)
{ {
...@@ -153,8 +155,10 @@ static int match_number(substring_t *s, int *result, int base) ...@@ -153,8 +155,10 @@ static int match_number(substring_t *s, int *result, int base)
* @base: base to use when converting string * @base: base to use when converting string
* *
* Description: Given a &substring_t and a base, attempts to parse the substring * Description: Given a &substring_t and a base, attempts to parse the substring
* as a number in that base. On success, sets @result to the integer represented * as a number in that base.
* by the string and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure. *
* Return: On success, sets @result to the integer represented by the
* string and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure.
*/ */
static int match_u64int(substring_t *s, u64 *result, int base) static int match_u64int(substring_t *s, u64 *result, int base)
{ {
...@@ -178,9 +182,10 @@ static int match_u64int(substring_t *s, u64 *result, int base) ...@@ -178,9 +182,10 @@ static int match_u64int(substring_t *s, u64 *result, int base)
* @s: substring_t to be scanned * @s: substring_t to be scanned
* @result: resulting integer on success * @result: resulting integer on success
* *
* Description: Attempts to parse the &substring_t @s as a decimal integer. On * Description: Attempts to parse the &substring_t @s as a decimal integer.
* success, sets @result to the integer represented by the string and returns 0. *
* Returns -ENOMEM, -EINVAL, or -ERANGE on failure. * Return: On success, sets @result to the integer represented by the string
* and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure.
*/ */
int match_int(substring_t *s, int *result) int match_int(substring_t *s, int *result)
{ {
...@@ -188,14 +193,15 @@ int match_int(substring_t *s, int *result) ...@@ -188,14 +193,15 @@ int match_int(substring_t *s, int *result)
} }
EXPORT_SYMBOL(match_int); EXPORT_SYMBOL(match_int);
/* /**
* match_uint - scan a decimal representation of an integer from a substring_t * match_uint - scan a decimal representation of an integer from a substring_t
* @s: substring_t to be scanned * @s: substring_t to be scanned
* @result: resulting integer on success * @result: resulting integer on success
* *
* Description: Attempts to parse the &substring_t @s as a decimal integer. On * Description: Attempts to parse the &substring_t @s as a decimal integer.
* success, sets @result to the integer represented by the string and returns 0. *
* Returns -ENOMEM, -EINVAL, or -ERANGE on failure. * Return: 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 match_uint(substring_t *s, unsigned int *result)
{ {
...@@ -217,9 +223,10 @@ EXPORT_SYMBOL(match_uint); ...@@ -217,9 +223,10 @@ EXPORT_SYMBOL(match_uint);
* @result: resulting unsigned long long on success * @result: resulting unsigned long long on success
* *
* Description: Attempts to parse the &substring_t @s as a long decimal * Description: Attempts to parse the &substring_t @s as a long decimal
* integer. On success, sets @result to the integer represented by the * integer.
* string and returns 0. *
* Returns -ENOMEM, -EINVAL, or -ERANGE on failure. * Return: On success, sets @result to the integer represented by the string
* and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure.
*/ */
int match_u64(substring_t *s, u64 *result) int match_u64(substring_t *s, u64 *result)
{ {
...@@ -232,9 +239,10 @@ EXPORT_SYMBOL(match_u64); ...@@ -232,9 +239,10 @@ EXPORT_SYMBOL(match_u64);
* @s: substring_t to be scanned * @s: substring_t to be scanned
* @result: resulting integer on success * @result: resulting integer on success
* *
* Description: Attempts to parse the &substring_t @s as an octal integer. On * Description: Attempts to parse the &substring_t @s as an octal integer.
* success, sets @result to the integer represented by the string and returns *
* 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure. * Return: On success, sets @result to the integer represented by the string
* and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure.
*/ */
int match_octal(substring_t *s, int *result) int match_octal(substring_t *s, int *result)
{ {
...@@ -248,8 +256,9 @@ EXPORT_SYMBOL(match_octal); ...@@ -248,8 +256,9 @@ EXPORT_SYMBOL(match_octal);
* @result: resulting integer on success * @result: resulting integer on success
* *
* Description: Attempts to parse the &substring_t @s as a hexadecimal integer. * Description: Attempts to parse the &substring_t @s as a hexadecimal integer.
* On success, sets @result to the integer represented by the string and *
* returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure. * Return: On success, sets @result to the integer represented by the string
* and returns 0. Returns -ENOMEM, -EINVAL, or -ERANGE on failure.
*/ */
int match_hex(substring_t *s, int *result) int match_hex(substring_t *s, int *result)
{ {
...@@ -263,10 +272,11 @@ EXPORT_SYMBOL(match_hex); ...@@ -263,10 +272,11 @@ EXPORT_SYMBOL(match_hex);
* @str: the string to be parsed * @str: the string to be parsed
* *
* Description: Parse the string @str to check if matches wildcard * Description: Parse the string @str to check if matches wildcard
* pattern @pattern. The pattern may contain two type wildcardes: * pattern @pattern. The pattern may contain two types of wildcards:
* '*' - matches zero or more characters * '*' - matches zero or more characters
* '?' - matches one character * '?' - matches one character
* If it's matched, return true, else return false. *
* Return: If the @str matches the @pattern, return true, else return false.
*/ */
bool match_wildcard(const char *pattern, const char *str) bool match_wildcard(const char *pattern, const char *str)
{ {
...@@ -316,7 +326,9 @@ EXPORT_SYMBOL(match_wildcard); ...@@ -316,7 +326,9 @@ EXPORT_SYMBOL(match_wildcard);
* *
* Description: Copy the characters in &substring_t @src to the * Description: Copy the characters in &substring_t @src to the
* c-style string @dest. Copy no more than @size - 1 characters, plus * c-style string @dest. Copy no more than @size - 1 characters, plus
* the terminating NUL. Return length of @src. * the terminating NUL.
*
* Return: length of @src.
*/ */
size_t match_strlcpy(char *dest, const substring_t *src, size_t size) size_t match_strlcpy(char *dest, const substring_t *src, size_t size)
{ {
...@@ -338,6 +350,9 @@ EXPORT_SYMBOL(match_strlcpy); ...@@ -338,6 +350,9 @@ EXPORT_SYMBOL(match_strlcpy);
* Description: Allocates and returns a string filled with the contents of * Description: Allocates and returns a string filled with the contents of
* the &substring_t @s. The caller is responsible for freeing the returned * the &substring_t @s. The caller is responsible for freeing the returned
* string with kfree(). * string with kfree().
*
* Return: the address of the newly allocated NUL-terminated string or
* %NULL on error.
*/ */
char *match_strdup(const substring_t *s) char *match_strdup(const substring_t *s)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment