All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Kent Gibson <warthog618@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-gpio@vger.kernel.org, Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [libgpiod][RFC 0/6] first draft of libgpiod v2.0 API
Date: Sat, 10 Apr 2021 16:51:51 +0200	[thread overview]
Message-ID: <20210410145157.30718-1-brgl@bgdev.pl> (raw)

This series introduces an entirely reworked API for the core C part of
libgpiod. It's not fully functional as the bindings are not modified,
and starting from patch 5, even the tests stop working. This is on
purpose as I'd like to reach an agreement on the interface before
spending time on reworking the tests.

My plan for the development of v2.0 is to keep the changes in a separate
branch until all bits & pieces are complete and then rearrange them into
a bisectable series that will be merged into the master branch.

A couple points regarding the design of the new API:
- all objects have become opaque and can only be accessed using dedicated
  functions
- line objects as well as bulk containers have been removed
- line requests are now configured using three types of structures: attributes,
  line config and request config structures, which follows the kernel API
- line request handles have now a lifetime separate from the parent chips to
  leverage the separation of chip and request file descriptors
- line events are now opaque but they can be stored in a dedicated container
  so that memory allocations are not necessary everytime an event is read from
  the kernel
- the library code has been split into several compilation units for easier
  maintenance

The new API is completely documented in include/gpiod.h doxygen comments.

Please let me know what you think. I am aware that these patches are huge and
difficult to review but I'm really only expecting a general API review - all
other implementation details can be improved later.

The branch from which this series was generated can be found on my github:
  https://github.com/brgl/libgpiod-private/tree/topic/core-lib-API-v2

Bartosz Golaszewski (6):
  treewide: rename chip property accessors
  core: add refcounting helpers
  core: implement line_info objects
  core: rework line events
  core: rework line requests
  core: implement line watch events

 bindings/cxx/chip.cpp         |    6 +-
 bindings/python/gpiodmodule.c |   14 +-
 include/gpiod.h               | 1224 +++++++++++++++++---------------
 lib/Makefile.am               |   15 +-
 lib/attr.c                    |  232 ++++++
 lib/chip.c                    |  234 +++++++
 lib/config.c                  |  158 +++++
 lib/core.c                    | 1240 ---------------------------------
 lib/event.c                   |  218 ++++++
 lib/handle.c                  |  126 ++++
 lib/helpers.c                 |  302 --------
 lib/info.c                    |  171 +++++
 lib/internal.c                |  147 ++++
 lib/internal.h                |   43 ++
 lib/mask.c                    |   43 ++
 lib/misc.c                    |   80 +++
 lib/request.c                 |  118 ++++
 lib/watch.c                   |   96 +++
 tests/gpiod-test.h            |    5 +
 tests/tests-chip.c            |   33 +-
 tests/tests-event.c           |  470 +++++++++----
 tests/tests-line.c            |  425 ++++++++---
 tools/gpio-tools-test.bats    |   12 +-
 tools/gpiodetect.c            |   17 +-
 tools/gpiofind.c              |    3 +-
 tools/gpioget.c               |   57 +-
 tools/gpioinfo.c              |   58 +-
 tools/gpiomon.c               |  130 ++--
 tools/gpioset.c               |   85 ++-
 tools/tools-common.c          |    8 +-
 tools/tools-common.h          |    2 +-
 31 files changed, 3255 insertions(+), 2517 deletions(-)
 create mode 100644 lib/attr.c
 create mode 100644 lib/chip.c
 create mode 100644 lib/config.c
 delete mode 100644 lib/core.c
 create mode 100644 lib/event.c
 create mode 100644 lib/handle.c
 delete mode 100644 lib/helpers.c
 create mode 100644 lib/info.c
 create mode 100644 lib/internal.c
 create mode 100644 lib/mask.c
 create mode 100644 lib/request.c
 create mode 100644 lib/watch.c

-- 
2.30.1


             reply	other threads:[~2021-04-10 14:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-10 14:51 Bartosz Golaszewski [this message]
2021-04-10 14:51 ` [libgpiod][RFC 1/6] treewide: rename chip property accessors Bartosz Golaszewski
2021-04-10 14:51 ` [libgpiod][RFC 2/6] core: add refcounting helpers Bartosz Golaszewski
2021-04-10 14:51 ` [libgpiod][RFC 3/6] core: implement line_info objects Bartosz Golaszewski
2021-04-10 14:51 ` [libgpiod][RFC 4/6] core: rework line events Bartosz Golaszewski
2021-04-10 14:51 ` [libgpiod][RFC 5/6] core: rework line requests Bartosz Golaszewski
2021-04-10 14:51 ` [libgpiod][RFC 6/6] core: implement line watch events Bartosz Golaszewski
2021-04-14 14:15 ` [libgpiod][RFC 0/6] first draft of libgpiod v2.0 API Kent Gibson
2021-04-16  9:36   ` Bartosz Golaszewski
2021-04-17  7:23     ` Kent Gibson
2021-04-17 11:31       ` Bartosz Golaszewski
2021-04-18  3:48         ` Kent Gibson
2021-04-18 21:12           ` Bartosz Golaszewski
2021-04-19  1:17             ` Kent Gibson
2021-04-21 20:04               ` Bartosz Golaszewski
2021-04-22  2:32                 ` Kent Gibson
2021-04-22  9:24                   ` Bartosz Golaszewski
2021-04-23  1:38                     ` Kent Gibson
2021-04-28  9:19                       ` Bartosz Golaszewski
2021-04-28 10:34                         ` Kent Gibson
2021-04-30 17:52                           ` Bartosz Golaszewski
2021-05-01  0:15                             ` Kent Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210410145157.30718-1-brgl@bgdev.pl \
    --to=brgl@bgdev.pl \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=warthog618@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.