printk and friends can now formap bitmaps using '%*pb[l]'.  cpumask
and nodemask also provide cpumask_pr_args() and nodemask_pr_args()
respectively which can be used to generate the two printf arguments
necessary to format the specified cpu/nodemask.

This patch is dependent on the following two patches.

 lib/vsprintf: implement bitmap printing through '%*pb[l]'
 cpumask, nodemask: implement cpumask/nodemask_pr_args()

Please wait till the forementioned patches are merged to mainline
before applying to subsystem trees.

Signed-off-by: Tejun Heo <t...@kernel.org>
Cc: Andrew Morton <a...@linux-foundation.org>
Cc: Steven Rostedt <rost...@goodmis.org>
Cc: Ingo Molnar <mi...@redhat.com>
---
 kernel/trace/trace.c     | 6 +++---
 kernel/trace/trace_seq.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 4a9079b..1380c16 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3352,12 +3352,12 @@ tracing_cpumask_read(struct file *filp, char __user 
*ubuf,
 
        mutex_lock(&tracing_cpumask_update_lock);
 
-       len = cpumask_scnprintf(mask_str, count, tr->tracing_cpumask);
-       if (count - len < 2) {
+       len = snprintf(mask_str, count, "%*pb\n",
+                      cpumask_pr_args(tr->tracing_cpumask));
+       if (len >= count) {
                count = -EINVAL;
                goto out_err;
        }
-       len += sprintf(mask_str + len, "\n");
        count = simple_read_from_buffer(ubuf, count, ppos, mask_str, NR_CPUS+1);
 
 out_err:
diff --git a/kernel/trace/trace_seq.c b/kernel/trace/trace_seq.c
index f8b45d8..e694c9f 100644
--- a/kernel/trace/trace_seq.c
+++ b/kernel/trace/trace_seq.c
@@ -120,7 +120,7 @@ void trace_seq_bitmask(struct trace_seq *s, const unsigned 
long *maskp,
 
        __trace_seq_init(s);
 
-       seq_buf_bitmask(&s->seq, maskp, nmaskbits);
+       seq_buf_printf(&s->seq, "%*pb", nmaskbits, maskp);
 
        if (unlikely(seq_buf_has_overflowed(&s->seq))) {
                s->seq.len = save_len;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to