diff options
author | Daniel Borkmann <daniel@iogearbox.net> | 2017-02-02 11:09:54 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-03 15:50:18 -0500 |
commit | 3898fac1f488c76e0eef5b5267b4ba8112a82ac4 (patch) | |
tree | fc6ee165a3338409580a8784111f53c10b22c6d5 /kernel/trace/trace_output.c | |
parent | f38c5ad79f1eb5569843ea24ac7f4cabccc3c657 (diff) |
trace: rename trace_print_hex_seq arg and add kdoc
Steven suggested to improve trace_print_hex_seq() a bit after commit
2acae0d5b0f7 ("trace: add variant without spacing in trace_print_hex_seq")
in two ways: i) by adding a kdoc comment for the helper function
itself and ii) by renaming 'spacing' argument into 'concatenate'
to better denote that we don't add spaces between each hex bytes.
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 30a144b1b9ee..aea6a1218c7d 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c | |||
@@ -162,15 +162,26 @@ trace_print_bitmask_seq(struct trace_seq *p, void *bitmask_ptr, | |||
162 | } | 162 | } |
163 | EXPORT_SYMBOL_GPL(trace_print_bitmask_seq); | 163 | EXPORT_SYMBOL_GPL(trace_print_bitmask_seq); |
164 | 164 | ||
165 | /** | ||
166 | * trace_print_hex_seq - print buffer as hex sequence | ||
167 | * @p: trace seq struct to write to | ||
168 | * @buf: The buffer to print | ||
169 | * @buf_len: Length of @buf in bytes | ||
170 | * @concatenate: Print @buf as single hex string or with spacing | ||
171 | * | ||
172 | * Prints the passed buffer as a hex sequence either as a whole, | ||
173 | * single hex string if @concatenate is true or with spacing after | ||
174 | * each byte in case @concatenate is false. | ||
175 | */ | ||
165 | const char * | 176 | const char * |
166 | trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len, | 177 | trace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len, |
167 | bool spacing) | 178 | bool concatenate) |
168 | { | 179 | { |
169 | int i; | 180 | int i; |
170 | const char *ret = trace_seq_buffer_ptr(p); | 181 | const char *ret = trace_seq_buffer_ptr(p); |
171 | 182 | ||
172 | for (i = 0; i < buf_len; i++) | 183 | for (i = 0; i < buf_len; i++) |
173 | trace_seq_printf(p, "%s%2.2x", !spacing || i == 0 ? "" : " ", | 184 | trace_seq_printf(p, "%s%2.2x", concatenate || i == 0 ? "" : " ", |
174 | buf[i]); | 185 | buf[i]); |
175 | trace_seq_putc(p, 0); | 186 | trace_seq_putc(p, 0); |
176 | 187 | ||