aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTejun Heo <[email protected]>2015-02-13 14:36:57 -0800
committerLinus Torvalds <[email protected]>2015-02-13 21:21:36 -0800
commitf1bbc032e45106400905ebb47550983af4690b0b (patch)
treebc42367749da0740cca36b71cc91f97406d5e8b1
parentdbc760bcc150cc27160f0131b15db76350df4334 (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 <[email protected]> Cc: Rusty Russell <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: "John W. Linville" <[email protected]> Cc: "Paul E. McKenney" <[email protected]> Cc: Benjamin Herrenschmidt <[email protected]> Cc: Chris Metcalf <[email protected]> Cc: Chris Zankel <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Dmitry Torokhov <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Li Zefan <[email protected]> Cc: Max Filippov <[email protected]> Cc: Mike Travis <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Russell King <[email protected]> Cc: Steffen Klassert <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Tony Luck <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--include/linux/cpumask.h8
-rw-r--r--include/linux/nodemask.h8
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;
*/
#define cpumask_bits(maskp) ((maskp)->bits)
+/**
+ * cpumask_pr_args - printf args to output a cpumask
+ * @maskp: cpumask to be printed
+ *
+ * Can be used to provide arguments for '%*pb[l]' when printing a cpumask.
+ */
+#define cpumask_pr_args(maskp) nr_cpu_ids, cpumask_bits(maskp)
+
#if NR_CPUS == 1
#define nr_cpu_ids 1
#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 @@
typedef struct { DECLARE_BITMAP(bits, MAX_NUMNODES); } nodemask_t;
extern nodemask_t _unused_nodemask_arg_;
+/**
+ * nodemask_pr_args - printf args to output a nodemask
+ * @maskp: nodemask to be printed
+ *
+ * Can be used to provide arguments for '%*pb[l]' when printing a nodemask.
+ */
+#define nodemask_pr_args(maskp) MAX_NUMNODES, (maskp)->bits
+
/*
* The inline keyword gives the compiler room to decide to inline, or
* not inline a function as it sees best. However, as these functions