Skip to content

Commit

Permalink
tracing: use %*pb[l] to print bitmaps including cpumasks and nodemasks
Browse files Browse the repository at this point in the history
printk and friends can now format 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.

Signed-off-by: Tejun Heo <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Ingo Molnar <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
htejun authored and torvalds committed Feb 14, 2015
1 parent dfbcbf4 commit 1a40243
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions kernel/trace/trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -3353,12 +3353,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:
Expand Down
2 changes: 1 addition & 1 deletion kernel/trace/trace_seq.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1a40243

Please sign in to comment.