[PATCH v2 4/6] Add GPIO v2 ioctl decoding

Dmitry V. Levin ldv at altlinux.org
Wed Jan 20 16:15:26 UTC 2021


On Wed, Jan 20, 2021 at 07:32:49PM +0800, Kent Gibson wrote:
> On Wed, Jan 20, 2021 at 01:43:15PM +0300, Dmitry V. Levin wrote:
[...]
> > I suppose it's still worth printing the structure in
> > print_gpio_v2_line_attribute even if the padding is non-zero, this would
> > be consistent with print_gpio_v2_line_config, print_gpio_v2_line_info,
> > and print_gpio_v2_line_request.
> 
> Not sure what you mean.  The line info differs from the other two as the
> struct gpio_v2_line_config_attribute includes the mask field.  There is
> structure wrapping around that, but not the attribute itself.  For the
> line info there is just the list of attributes associated with the line
> listed in the attrs array.

OK, let's have a look at examples.

This is a line from tests/ioctl_gpio-success.dir/log:

ioctl(-1, GPIO_V2_GET_LINEINFO_IOCTL, {offset=56} => {name="line name", consumer="line consumer", flags=GPIO_V2_LINE_FLAG_ACTIVE_LOW|GPIO_V2_LINE_FLAG_BIAS_PULL_UP, num_attrs=1, attrs=[{padding=0xfeedface, debounce_period_us=3735928559}]}) = 42 (INJECTED)

Everything looks as expected.
This is another line from the same file:

ioctl(-1, GPIO_V2_GET_LINEINFO_IOCTL, {offset=57} => {name="line name", consumer="line consumer", flags=GPIO_V2_LINE_FLAG_ACTIVE_LOW|GPIO_V2_LINE_FLAG_BIAS_PULL_UP, num_attrs=11, attrs=[flags=0xafeddeadd0d00000 /* GPIO_V2_LINE_FLAG_??? */, values=0xafeddeadd0d00001, debounce_period_us=3503292418, (id=4)=0xafeddeadd0d00003, (id=5)=0xafeddeadd0d00004, (id=6)=0xafeddeadd0d00005, (id=7)=0xafeddeadd0d00006, (id=8)=0xafeddeadd0d00007, (id=9)=0xafeddeadd0d00008, (id=10)=0xafeddeadd0d00009]}) = 42 (INJECTED)

Here you can see this "attrs=[flags=...", but since "attrs" is an array,
it cannot have named fields as a structure or a union.

Also, print_gpio_v2_line_config_attribute prints
struct gpio_v2_line_config_attribute.attr field without printing its name
(there is no attr= printed).


-- 
ldv


More information about the Strace-devel mailing list