[PATCH v2 0/6] Add GPIO chardev ioctl decoding

Kent Gibson warthog618 at gmail.com
Mon Jan 11 15:09:06 UTC 2021


This patch set implements decoding of the GPIO character device ioctls
first added in Linux v4.8, extended in v5.5 and v5.7, and the v2 ioctls
added in v5.10, and a minor update for v5.11.

The first patch adds a helper method used to print arrays of uint8,
as found in the GPIO API.
The second and third patches add the decoding of the GPIO ioctls and
corresponding tests.
the fourth and fifth patches add the decoding of the GPIO v2 ioctls and
corresponding tests.
The sixth patch adds decoding of the
GPIO_V2_LINE_FLAG_EVENT_CLOCK_REALTIME flag which is on track to be added
in Linux v5.11.

There is some duplicate code in gpio_ioctl.c and tests/ioctl_gpio.c to
allow the complete decoders and tests to compile on old kernels.
Perhaps that should be relocated into types/gpio.h?

Cheers,
Kent.

Changes v1 -> v2:
 - drop MPERS_DEFS include
 - switch to standard types instead of __u64 et al
 - fix mixed usage of tabs and spaces in xlat files
 - rework decoders to use {input} => {output} pattern for IOWR ioctls
 - add tests

Kent Gibson (6):
  Add print_uint8_array_member() helper
  Add GPIO ioctl decoding
  tests: check decoding of GPIO ioctls
  Add GPIO v2 ioctl decoding
  tests: check decoding of GPIO v2 ioctls
  Add GPIO uAPI realtime clock flag

 Makefile.am                           |   1 +
 configure.ac                          |   1 +
 defs.h                                |   5 +
 gpio_ioctl.c                          | 563 ++++++++++++++++++
 ioctl.c                               |   4 +
 tests/.gitignore                      |  16 +
 tests/Makefile.am                     |   8 +
 tests/gen_tests.in                    |  16 +
 tests/ioctl_gpio-Xabbrev.c            |   2 +
 tests/ioctl_gpio-Xraw.c               |   2 +
 tests/ioctl_gpio-Xverbose.c           |   2 +
 tests/ioctl_gpio-success-Xabbrev.c    |   2 +
 tests/ioctl_gpio-success-Xraw.c       |   2 +
 tests/ioctl_gpio-success-Xverbose.c   |   2 +
 tests/ioctl_gpio-success-v-Xabbrev.c  |   2 +
 tests/ioctl_gpio-success-v-Xraw.c     |   2 +
 tests/ioctl_gpio-success-v-Xverbose.c |   2 +
 tests/ioctl_gpio-success-v.c          |   2 +
 tests/ioctl_gpio-success.c            |   2 +
 tests/ioctl_gpio-v-Xabbrev.c          |   2 +
 tests/ioctl_gpio-v-Xraw.c             |   2 +
 tests/ioctl_gpio-v-Xverbose.c         |   2 +
 tests/ioctl_gpio-v.c                  |   2 +
 tests/ioctl_gpio.c                    | 809 ++++++++++++++++++++++++++
 tests/pure_executables.list           |   8 +
 util.c                                |  18 +
 xlat/gpio_event_flags.in              |   3 +
 xlat/gpio_handle_flags.in             |   8 +
 xlat/gpio_line_flags.in               |   8 +
 xlat/gpio_v2_line_attr_ids.in         |   5 +
 xlat/gpio_v2_line_flags.in            |  14 +
 31 files changed, 1517 insertions(+)
 create mode 100644 gpio_ioctl.c
 create mode 100644 tests/ioctl_gpio-Xabbrev.c
 create mode 100644 tests/ioctl_gpio-Xraw.c
 create mode 100644 tests/ioctl_gpio-Xverbose.c
 create mode 100644 tests/ioctl_gpio-success-Xabbrev.c
 create mode 100644 tests/ioctl_gpio-success-Xraw.c
 create mode 100644 tests/ioctl_gpio-success-Xverbose.c
 create mode 100644 tests/ioctl_gpio-success-v-Xabbrev.c
 create mode 100644 tests/ioctl_gpio-success-v-Xraw.c
 create mode 100644 tests/ioctl_gpio-success-v-Xverbose.c
 create mode 100644 tests/ioctl_gpio-success-v.c
 create mode 100644 tests/ioctl_gpio-success.c
 create mode 100644 tests/ioctl_gpio-v-Xabbrev.c
 create mode 100644 tests/ioctl_gpio-v-Xraw.c
 create mode 100644 tests/ioctl_gpio-v-Xverbose.c
 create mode 100644 tests/ioctl_gpio-v.c
 create mode 100644 tests/ioctl_gpio.c
 create mode 100644 xlat/gpio_event_flags.in
 create mode 100644 xlat/gpio_handle_flags.in
 create mode 100644 xlat/gpio_line_flags.in
 create mode 100644 xlat/gpio_v2_line_attr_ids.in
 create mode 100644 xlat/gpio_v2_line_flags.in

-- 
2.30.0



More information about the Strace-devel mailing list