Commit 05a6c8a9 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

lib/bitmap.c: fix documentation for scnprintf() functions

The code comments for bscnl_emit() and bitmap_scnlistprintf() are
describing snprintf() return semantics, but these functions use
scnprintf() return semantics.  Fix that, and document the
bitmap_scnprintf() return value as well.

Cc: Ryota Ozaki <ozaki.ryota@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 68aecfb9
...@@ -369,7 +369,8 @@ EXPORT_SYMBOL(bitmap_find_next_zero_area); ...@@ -369,7 +369,8 @@ EXPORT_SYMBOL(bitmap_find_next_zero_area);
* @nmaskbits: size of bitmap, in bits * @nmaskbits: size of bitmap, in bits
* *
* Exactly @nmaskbits bits are displayed. Hex digits are grouped into * Exactly @nmaskbits bits are displayed. Hex digits are grouped into
* comma-separated sets of eight digits per set. * comma-separated sets of eight digits per set. Returns the number of
* characters which were written to *buf, excluding the trailing \0.
*/ */
int bitmap_scnprintf(char *buf, unsigned int buflen, int bitmap_scnprintf(char *buf, unsigned int buflen,
const unsigned long *maskp, int nmaskbits) const unsigned long *maskp, int nmaskbits)
...@@ -517,8 +518,8 @@ EXPORT_SYMBOL(bitmap_parse_user); ...@@ -517,8 +518,8 @@ EXPORT_SYMBOL(bitmap_parse_user);
* *
* Helper routine for bitmap_scnlistprintf(). Write decimal number * Helper routine for bitmap_scnlistprintf(). Write decimal number
* or range to buf, suppressing output past buf+buflen, with optional * or range to buf, suppressing output past buf+buflen, with optional
* comma-prefix. Return len of what would be written to buf, if it * comma-prefix. Return len of what was written to *buf, excluding the
* all fit. * trailing \0.
*/ */
static inline int bscnl_emit(char *buf, int buflen, int rbot, int rtop, int len) static inline int bscnl_emit(char *buf, int buflen, int rbot, int rtop, int len)
{ {
...@@ -544,9 +545,8 @@ static inline int bscnl_emit(char *buf, int buflen, int rbot, int rtop, int len) ...@@ -544,9 +545,8 @@ static inline int bscnl_emit(char *buf, int buflen, int rbot, int rtop, int len)
* the range. Output format is compatible with the format * the range. Output format is compatible with the format
* accepted as input by bitmap_parselist(). * accepted as input by bitmap_parselist().
* *
* The return value is the number of characters which would be * The return value is the number of characters which were written to *buf
* generated for the given input, excluding the trailing '\0', as * excluding the trailing '\0', as per ISO C99's scnprintf.
* per ISO C99.
*/ */
int bitmap_scnlistprintf(char *buf, unsigned int buflen, int bitmap_scnlistprintf(char *buf, unsigned int buflen,
const unsigned long *maskp, int nmaskbits) const unsigned long *maskp, int nmaskbits)
......
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