Skip to content

Commit 1a40243

Browse files
htejuntorvalds
authored andcommitted
tracing: use %*pb[l] to print bitmaps including cpumasks and nodemasks
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]>
1 parent dfbcbf4 commit 1a40243

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

kernel/trace/trace.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -3353,12 +3353,12 @@ tracing_cpumask_read(struct file *filp, char __user *ubuf,
33533353

33543354
mutex_lock(&tracing_cpumask_update_lock);
33553355

3356-
len = cpumask_scnprintf(mask_str, count, tr->tracing_cpumask);
3357-
if (count - len < 2) {
3356+
len = snprintf(mask_str, count, "%*pb\n",
3357+
cpumask_pr_args(tr->tracing_cpumask));
3358+
if (len >= count) {
33583359
count = -EINVAL;
33593360
goto out_err;
33603361
}
3361-
len += sprintf(mask_str + len, "\n");
33623362
count = simple_read_from_buffer(ubuf, count, ppos, mask_str, NR_CPUS+1);
33633363

33643364
out_err:

kernel/trace/trace_seq.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void trace_seq_bitmask(struct trace_seq *s, const unsigned long *maskp,
120120

121121
__trace_seq_init(s);
122122

123-
seq_buf_bitmask(&s->seq, maskp, nmaskbits);
123+
seq_buf_printf(&s->seq, "%*pb", nmaskbits, maskp);
124124

125125
if (unlikely(seq_buf_has_overflowed(&s->seq))) {
126126
s->seq.len = save_len;

0 commit comments

Comments
 (0)