Re: [PATCH v2 06/15] tools lib traceevent: Add support for more printk format specifiers

From: Namhyung Kim
Date: Tue Jul 07 2020 - 11:09:34 EST


On Fri, Jul 3, 2020 at 3:57 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> From: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@xxxxxxxxx>
>
> The printk format specifiers used in event's print format files extend
> the standard printf formats. There are a lot of new options related to
> printing pointers and kernel specific structures. Currently trace-cmd
> does not support many of them.
>
> Support for these new printk specifiers is added to the pretty_print()
> function:
> - UUID/GUID address: %pU[bBlL]
> - Raw buffer as a hex string: %*ph[CDN]
>
> These are improved:
> - MAC address: %pMF, %pM and %pmR
> - IPv4 adderss: %p[Ii]4[hnbl]
>
> Function pretty_print() is refactored. The logic for printing pointers
> %p[...] is moved to its own function.
>
> Link: https://lore.kernel.org/linux-trace-devel/20200515053754.3695335-1-tz.stoyanov@xxxxxxxxx
> Link: http://lore.kernel.org/linux-trace-devel/20200625100516.365338-7-tz.stoyanov@xxxxxxxxx
>
> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207605
> Reported-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
> Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@xxxxxxxxx>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
> ---
[SNIP]
> +static int parse_ip4_print_args(struct tep_handle *tep,
> + const char *ptr, bool *reverse)
> +{
> + int ret = 0;
> +
> + *reverse = false;
> +
> + /* hnbl */
> + switch (*ptr) {
> + case 'h':
> + if (tep->file_bigendian)
> + *reverse = false;
> + else
> + *reverse = true;
> + ret++;
> + break;

Indentation is broken..

> + case 'l':
> + *reverse = true;
> + ret++;
> + break;

Ditto.

Thanks
Namhyung


> + case 'n':
> + case 'b':
> + ret++;
> + /* fall through */
> + default:
> + *reverse = false;
> + break;
> + }
> +
> + return ret;
> }