[PATCH v4 5/6] tests: check decoding of GPIO v2 ioctls

Kent Gibson warthog618 at gmail.com
Mon Jan 25 00:53:14 UTC 2021


On Sun, Jan 24, 2021 at 06:33:40PM +0300, Dmitry V. Levin wrote:
> On Sat, Jan 23, 2021 at 09:56:44AM +0800, Kent Gibson wrote:
> > Add tests for decoding of GPIO v2 ioctls.
> > 
> > Signed-off-by: Kent Gibson <warthog618 at gmail.com>
> [...]
> > +static void
> > +print_gpio_v2_line_attr(struct_gpio_v2_line_attribute *attr)
> > +{
> > +	printf("{");
> > +	switch (attr->id) {
> > +	case GPIO_V2_LINE_ATTR_ID_FLAGS:
> > +		printf("flags=%#" PRIx64 NRAW(" /* GPIO_V2_LINE_FLAG_??? */"),
> > +		       attr->flags);
> 
> If the kernel headers are used, this wouldn't necessarily be PRIx64 any
> longer, I suggest using %#jx instead.
> 

My usual solution for this one is to cast the attr->flags to uint64_t,
as we are sure it is 64-bit.

Cheers,
Kent.


More information about the Strace-devel mailing list