bpf: Support 'X' in bpf_seq_printf() helper
authorYonghong Song <yhs@fb.com>
Tue, 23 Jun 2020 23:08:07 +0000 (16:08 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 25 Jun 2020 01:37:58 +0000 (18:37 -0700)
'X' tells kernel to print hex with upper case letters.
/proc/net/tcp{4,6} seq_file show() used this, and
supports it in bpf_seq_printf() helper too.

Signed-off-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200623230807.3988014-1-yhs@fb.com
kernel/trace/bpf_trace.c

index a3ac7de..b44505f 100644 (file)
@@ -681,7 +681,8 @@ BPF_CALL_5(bpf_seq_printf, struct seq_file *, m, char *, fmt, u32, fmt_size,
                }
 
                if (fmt[i] != 'i' && fmt[i] != 'd' &&
-                   fmt[i] != 'u' && fmt[i] != 'x') {
+                   fmt[i] != 'u' && fmt[i] != 'x' &&
+                   fmt[i] != 'X') {
                        err = -EINVAL;
                        goto out;
                }