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

Kent Gibson warthog618 at gmail.com
Sat Jan 23 01:56:39 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.

Cheers,
Kent.

Changes v3 -> v4:
 - remove redundant clamping already performed by PRINT_FIELD_ARRAY_UPTO
 - use exiting() instead of !entering()
 
Changes v2 -> v3:
 - fix decoding of GPIO_GET_LINEINFO_UNWATCH_IOCTL
 - move common in-fill types into types/gpio.h
 - use PRINT_FIELD_ARRAY_UPTO instead of print_local_array_ex
 - use PRINT_FIELD_ARRAY instead of print_local_array
 - drop unused parameters from helper functions
 - make function parameters const where possible
 - improve formatting of line attributes
 - don't bother casting void pointers
 - a few minor code layout tidy ups

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                          | 452 ++++++++++++++++
 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                    | 739 ++++++++++++++++++++++++++
 tests/pure_executables.list           |   8 +
 types/gpio.h                          | 111 ++++
 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 +
 32 files changed, 1447 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 types/gpio.h
 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


base-commit: 84b3b271bd50a85fbe0f96396568b245b6952cba
-- 
2.30.0



More information about the Strace-devel mailing list