[PATCH] ptp.c: print field names and use macros form print_fields.h
Dmitry V. Levin
ldv at altlinux.org
Fri Mar 9 23:26:17 UTC 2018
On Thu, Mar 08, 2018 at 07:23:43PM +0530, Harsha Sharma wrote:
> * ptp.c: print field names with field values for PTP_PEROUT_REQUEST
> and use macros from print_fields.h
Thanks.
> ---
> ptp.c | 27 ++++++++++++++++-----------
> 1 file changed, 16 insertions(+), 11 deletions(-)
>
> diff --git a/ptp.c b/ptp.c
> index 3cb3ae87..476d70c7 100644
> --- a/ptp.c
> +++ b/ptp.c
> @@ -34,6 +34,7 @@
> # include <linux/ioctl.h>
> # include <linux/ptp_clock.h>
>
> +#include "print_fields.h"
> # include "xlat/ptp_flags_options.h"
There is a small indentation mismatch here.
> int
> @@ -51,7 +52,8 @@ ptp_ioctl(struct tcb *const tcp, const unsigned int code,
> if (umove_or_printaddr(tcp, arg, &extts))
> break;
>
> - tprintf("{index=%d, flags=", extts.index);
> + PRINT_FIELD_D("{", extts, index);
> + tprints(", flags=");
> printflags(ptp_flags_options, extts.flags, "PTP_???");
If you started using macros from print_fields.h, it would be more
consistent if you used PRINT_FIELD_FLAGS here and in other places.
> tprints("}");
> break;
> @@ -64,12 +66,12 @@ ptp_ioctl(struct tcb *const tcp, const unsigned int code,
> if (umove_or_printaddr(tcp, arg, &perout))
> break;
>
> - tprintf("{start={%" PRId64 ", %" PRIu32 "}"
> - ", period={%" PRId64 ", %" PRIu32 "}"
> - ", index=%d, flags=",
> + tprintf("{start={sec=%" PRId64 ", nsec=%" PRIu32 "}"
> + ", period={sec=%" PRId64 ", nsec=%" PRIu32 "}",
> (int64_t)perout.start.sec, perout.start.nsec,
> - (int64_t)perout.period.sec, perout.period.nsec,
> - perout.index);
> + (int64_t)perout.period.sec, perout.period.nsec);
> + PRINT_FIELD_D(", ", perout, index);
Likewise, it would be more consistent if you used PRINT_FIELD_U and
PRINT_FIELD_D for printing fields of struct ptp_clock_time here and in
other places.
--
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20180310/d7159eef/attachment.bin>
More information about the Strace-devel
mailing list