aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2015-02-13 17:38:15 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-14 00:21:39 -0500
commit46385326cc1577587ed3e7432c2425cf6d3e4308 (patch)
treea4a87d47fb4ef5853c5c31236a272c22a9304caf /lib
parentccbd59c1c104d6e42e949e2588563bfe25d9d98f (diff)
bitmap, cpumask, nodemask: remove dedicated formatting functions
Now that all bitmap formatting usages have been converted to '%*pb[l]', the separate formatting functions are unnecessary. The following functions are removed. * bitmap_scn[list]printf() * cpumask_scnprintf(), cpulist_scnprintf() * [__]nodemask_scnprintf(), [__]nodelist_scnprintf() * seq_bitmap[_list](), seq_cpumask[_list](), seq_nodemask[_list]() * seq_buf_bitmask() Signed-off-by: Tejun Heo <tj@kernel.org> Cc: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bitmap.c41
-rw-r--r--lib/seq_buf.c36
2 files changed, 0 insertions, 77 deletions
diff --git a/lib/bitmap.c b/lib/bitmap.c
index 088adbdcbad9..d456f4c15a9f 100644
--- a/lib/bitmap.c
+++ b/lib/bitmap.c
@@ -370,24 +370,6 @@ EXPORT_SYMBOL(bitmap_find_next_zero_area_off);
370#define BASEDEC 10 /* fancier cpuset lists input in decimal */ 370#define BASEDEC 10 /* fancier cpuset lists input in decimal */
371 371
372/** 372/**
373 * bitmap_scnprintf - convert bitmap to an ASCII hex string.
374 * @buf: byte buffer into which string is placed
375 * @buflen: reserved size of @buf, in bytes
376 * @maskp: pointer to bitmap to convert
377 * @nmaskbits: size of bitmap, in bits
378 *
379 * Exactly @nmaskbits bits are displayed. Hex digits are grouped into
380 * comma-separated sets of eight digits per set. Returns the number of
381 * characters which were written to *buf, excluding the trailing \0.
382 */
383int bitmap_scnprintf(char *buf, unsigned int buflen,
384 const unsigned long *maskp, int nmaskbits)
385{
386 return scnprintf(buf, buflen, "%*pb", nmaskbits, maskp);
387}
388EXPORT_SYMBOL(bitmap_scnprintf);
389
390/**
391 * __bitmap_parse - convert an ASCII hex string into a bitmap. 373 * __bitmap_parse - convert an ASCII hex string into a bitmap.
392 * @buf: pointer to buffer containing string. 374 * @buf: pointer to buffer containing string.
393 * @buflen: buffer size in bytes. If string is smaller than this 375 * @buflen: buffer size in bytes. If string is smaller than this
@@ -501,29 +483,6 @@ int bitmap_parse_user(const char __user *ubuf,
501EXPORT_SYMBOL(bitmap_parse_user); 483EXPORT_SYMBOL(bitmap_parse_user);
502 484
503/** 485/**
504 * bitmap_scnlistprintf - convert bitmap to list format ASCII string
505 * @buf: byte buffer into which string is placed
506 * @buflen: reserved size of @buf, in bytes
507 * @maskp: pointer to bitmap to convert
508 * @nmaskbits: size of bitmap, in bits
509 *
510 * Output format is a comma-separated list of decimal numbers and
511 * ranges. Consecutively set bits are shown as two hyphen-separated
512 * decimal numbers, the smallest and largest bit numbers set in
513 * the range. Output format is compatible with the format
514 * accepted as input by bitmap_parselist().
515 *
516 * The return value is the number of characters which were written to *buf
517 * excluding the trailing '\0', as per ISO C99's scnprintf.
518 */
519int bitmap_scnlistprintf(char *buf, unsigned int buflen,
520 const unsigned long *maskp, int nmaskbits)
521{
522 return scnprintf(buf, buflen, "%*pbl", nmaskbits, maskp);
523}
524EXPORT_SYMBOL(bitmap_scnlistprintf);
525
526/**
527 * bitmap_print_to_pagebuf - convert bitmap to list or hex format ASCII string 486 * bitmap_print_to_pagebuf - convert bitmap to list or hex format ASCII string
528 * @list: indicates whether the bitmap must be list 487 * @list: indicates whether the bitmap must be list
529 * @buf: page aligned buffer into which string is placed 488 * @buf: page aligned buffer into which string is placed
diff --git a/lib/seq_buf.c b/lib/seq_buf.c
index 4eedfedb9e31..88c0854bd752 100644
--- a/lib/seq_buf.c
+++ b/lib/seq_buf.c
@@ -91,42 +91,6 @@ int seq_buf_printf(struct seq_buf *s, const char *fmt, ...)
91 return ret; 91 return ret;
92} 92}
93 93
94/**
95 * seq_buf_bitmask - write a bitmask array in its ASCII representation
96 * @s: seq_buf descriptor
97 * @maskp: points to an array of unsigned longs that represent a bitmask
98 * @nmaskbits: The number of bits that are valid in @maskp
99 *
100 * Writes a ASCII representation of a bitmask string into @s.
101 *
102 * Returns zero on success, -1 on overflow.
103 */
104int seq_buf_bitmask(struct seq_buf *s, const unsigned long *maskp,
105 int nmaskbits)
106{
107 unsigned int len = seq_buf_buffer_left(s);
108 int ret;
109
110 WARN_ON(s->size == 0);
111
112 /*
113 * Note, because bitmap_scnprintf() only returns the number of bytes
114 * written and not the number that would be written, we use the last
115 * byte of the buffer to let us know if we overflowed. There's a small
116 * chance that the bitmap could have fit exactly inside the buffer, but
117 * it's not that critical if that does happen.
118 */
119 if (len > 1) {
120 ret = bitmap_scnprintf(s->buffer + s->len, len, maskp, nmaskbits);
121 if (ret < len) {
122 s->len += ret;
123 return 0;
124 }
125 }
126 seq_buf_set_overflow(s);
127 return -1;
128}
129
130#ifdef CONFIG_BINARY_PRINTF 94#ifdef CONFIG_BINARY_PRINTF
131/** 95/**
132 * seq_buf_bprintf - Write the printf string from binary arguments 96 * seq_buf_bprintf - Write the printf string from binary arguments