diff options
author | Tejun Heo <tj@kernel.org> | 2015-02-13 17:36:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-02-14 00:21:36 -0500 |
commit | f1bbc032e45106400905ebb47550983af4690b0b (patch) | |
tree | bc42367749da0740cca36b71cc91f97406d5e8b1 | |
parent | dbc760bcc150cc27160f0131b15db76350df4334 (diff) |
cpumask, nodemask: implement cpumask/nodemask_pr_args()
printf family of functions can now format bitmaps using '%*pb[l]' and
all cpumask and nodemask formatting will be converted to use it. To
ease printing these masks with '%*pb[l]' which require two params -
the number of bits and the actual bitmap, this patch implement
cpumask_pr_args() and nodemask_pr_args() which can be used to provide
arguments for '%*pb[l]'
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Christoph Lameter <cl@linux.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Li Zefan <lizefan@huawei.com>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Mike Travis <travis@sgi.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Steffen Klassert <steffen.klassert@secunet.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/cpumask.h | 8 | ||||
-rw-r--r-- | include/linux/nodemask.h | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index ee9acb0ce542..a9b3d00915a0 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -22,6 +22,14 @@ typedef struct cpumask { DECLARE_BITMAP(bits, NR_CPUS); } cpumask_t; | |||
22 | */ | 22 | */ |
23 | #define cpumask_bits(maskp) ((maskp)->bits) | 23 | #define cpumask_bits(maskp) ((maskp)->bits) |
24 | 24 | ||
25 | /** | ||
26 | * cpumask_pr_args - printf args to output a cpumask | ||
27 | * @maskp: cpumask to be printed | ||
28 | * | ||
29 | * Can be used to provide arguments for '%*pb[l]' when printing a cpumask. | ||
30 | */ | ||
31 | #define cpumask_pr_args(maskp) nr_cpu_ids, cpumask_bits(maskp) | ||
32 | |||
25 | #if NR_CPUS == 1 | 33 | #if NR_CPUS == 1 |
26 | #define nr_cpu_ids 1 | 34 | #define nr_cpu_ids 1 |
27 | #else | 35 | #else |
diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h index 21cef483dc1b..10f8e556ba07 100644 --- a/include/linux/nodemask.h +++ b/include/linux/nodemask.h | |||
@@ -98,6 +98,14 @@ | |||
98 | typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; | 98 | typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t; |
99 | extern nodemask_t _unused_nodemask_arg_; | 99 | extern nodemask_t _unused_nodemask_arg_; |
100 | 100 | ||
101 | /** | ||
102 | * nodemask_pr_args - printf args to output a nodemask | ||
103 | * @maskp: nodemask to be printed | ||
104 | * | ||
105 | * Can be used to provide arguments for '%*pb[l]' when printing a nodemask. | ||
106 | */ | ||
107 | #define nodemask_pr_args(maskp) MAX_NUMNODES, (maskp)->bits | ||
108 | |||
101 | /* | 109 | /* |
102 | * The inline keyword gives the compiler room to decide to inline, or | 110 | * The inline keyword gives the compiler room to decide to inline, or |
103 | * not inline a function as it sees best. However, as these functions | 111 | * not inline a function as it sees best. However, as these functions |