Nikita Shubin via B4 Relay <devnull+n.shubin.yadro....@kernel.org>
writes:

> From: Nikita Shubin <n.shu...@yadro.com>
>
> Add GUSE (FUSE based kernel module similiar to CUSE) based backend.
>
> This allows transparent usage of Linux GPIO UAPI based tools like
> in kernel tools/gpio or libgpiod.
>
> libgpiod requires some modification to allow "/sys/class/guse" in
> gpiod_check_gpiochip_device().
>
> It requires guse module to be loaded and providing DEVICE()->id
> for GPIO module, for example:
>
> ```
> DEVICE(&s->gpio)->id = g_strdup("aspeed-gpio0");
> ```
>
> The id should be provided to gpiodev with any `devname` that doesn't
> exists in /dev:
>
> ```
> -gpiodev guse,id=aspeed-gpio0,devname=gpiochip10
> ```
>
> That /dev/gpiochip10 can be used in the same way we usually operate with
> gpiochip's.
>
> Link: 
> http://git.maquefel.me/?p=qemu-gpiodev/libgpiod.git;a=shortlog;h=refs/heads/nshubin/guse-fix
> Link: http://git.maquefel.me/?p=qemu-gpiodev/guse.git;a=summary
> Link: 
> http://git.maquefel.me/?p=qemu-gpiodev/libfuse.git;a=shortlog;h=refs/heads/nshubin/guse
> Signed-off-by: Nikita Shubin <n.shu...@yadro.com>

[...]

> diff --git a/qapi/gpio.json b/qapi/gpio.json
> index 
> 1c2b7af36813ff52cbb3a44e64a2e5a5d8658d62..e3cdca793260212622a30947eaea61bd523e98fb
>  100644
> --- a/qapi/gpio.json
> +++ b/qapi/gpio.json
> @@ -21,12 +21,36 @@
>  ##
>  # @GpiodevBackendKind:
>  #
> -# @chardev: chardevs
> +# @chardev: Gpio dev over chardev backend
> +# @gusedev: Gpio dev over GUSE FUSE module
>  #
>  # Since: 9.2

10.1

>  ##
>  { 'enum': 'GpiodevBackendKind',
> -  'data': [ 'chardev' ] }
> +  'data': [ 'chardev',
> +            { 'name': 'gusedev', 'if': 'CONFIG_LINUX' } ] }
> +
> +##
> +# @GpiodevGusedev:
> +#
> +# Configuration info for guse gpiodevs.
> +#
> +# @devname: Name of device created in /dev

Existing names for similar things elsewhere:

* @dev in AudiodevAlsaPerDirectionOptions

* @device in ChardevHostdev

* @devname in NetdevNetmapOptions

* @vhostdev in NetdevVhostUserOptions

* @sev-device in SevCommonProperties

* @filename in RngRandomProperties

* @path in BlockdevOptionsNvmeIoUring,
  BlockdevOptionsVirtioBlkVhostVdpa, TPMPassthroughOptions

What a mess.

@filename and @path are clearly bad.

I'd prefer @device or @gpio-device, or maybe @dev.

> +#
> +# Since: 9.2
> +##
> +  { 'struct': 'GpiodevGusedev',
> +    'data': { 'devname': 'str' } }
> +
> +##
> +# @GpiodevGusedevWrapper:
> +#
> +# @data: Configuration info for chardev gpiodevs
> +#
> +# Since: 9.2
> +##
> +{ 'struct': 'GpiodevGusedevWrapper',
> +  'data': { 'data': 'GpiodevGusedev' } }

Avoid the wrapper?

>  
>  ##
>  # @GpiodevChardev:
> @@ -65,4 +89,5 @@
>  { 'union': 'GpiodevBackend',
>    'base': { 'type': 'GpiodevBackendKind' },
>    'discriminator': 'type',
> -  'data': { 'chardev': 'GpiodevChardevWrapper' } }
> \ No newline at end of file
> +  'data': { 'chardev': 'GpiodevChardevWrapper',
> +            'gusedev': { 'type': 'GpiodevGusedevWrapper', 'if': 
> 'CONFIG_LINUX' } } }
> \ No newline at end of file

Please add a newline at the end of the file.


Reply via email to