From: Erik Schilling <erik.schilling@linaro.org>
To: Linux-GPIO <linux-gpio@vger.kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
Manos Pitsidianakis <manos.pitsidianakis@linaro.org>,
Kent Gibson <warthog618@gmail.com>,
Erik Schilling <erik.schilling@linaro.org>
Subject: [libgpiod][PATCH v2 0/3] bindings: rust: fix modeling of line_info lifetimes
Date: Fri, 29 Sep 2023 15:18:14 +0200 [thread overview]
Message-ID: <20230929-rust-line-info-soundness-v2-0-9782b7f20f26@linaro.org> (raw)
While reviewing the bindings for thread-safety, I realized that the
bindings did not properly model the lifetimes of non-owned line_info
instances.
This fixes that. It might be a bit mind bending. I tried to provide
lengthy comments to clarify what happens.
To: Linux-GPIO <linux-gpio@vger.kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Cc: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Erik Schilling <erik.schilling@linaro.org>
---
Changes in v2:
- Removed unneeded temporary variables
- Added missing SAFETY comment
- Renamed owning wrapper to `Event`, non-owning to `EventRef`
- Renamed existing clone methods to try_clone()
- Slightly tweaked try_clone() documentation
- Dropped version bump commit
- Added Fixes tag
- CC'd Kent - suggested by vireshk since he reviewed his commits
- Link to v1: https://lore.kernel.org/r/20230927-rust-line-info-soundness-v1-0-990dce6f18ab@linaro.org
---
Erik Schilling (3):
bindings: rust: fix soundness of line_info modeling
bindings: rust: rename {event,settings}_clone to try_clone
bindings: rust: allow cloning line::InfoRef -> line::Info
.../libgpiod/examples/buffered_event_lifetimes.rs | 2 +-
bindings/rust/libgpiod/src/chip.rs | 8 +-
bindings/rust/libgpiod/src/edge_event.rs | 3 +-
bindings/rust/libgpiod/src/info_event.rs | 8 +-
bindings/rust/libgpiod/src/lib.rs | 1 +
bindings/rust/libgpiod/src/line_info.rs | 140 +++++++++++++++------
bindings/rust/libgpiod/src/line_settings.rs | 4 +-
bindings/rust/libgpiod/tests/line_info.rs | 53 ++++++++
bindings/rust/libgpiod/tests/line_request.rs | 2 +-
9 files changed, 173 insertions(+), 48 deletions(-)
---
base-commit: ced90e79217793957b11414f47f8aa8a77c7a2d5
change-id: 20230927-rust-line-info-soundness-14c08e0d26e9
Best regards,
--
Erik Schilling <erik.schilling@linaro.org>
next reply other threads:[~2023-09-29 13:18 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-29 13:18 Erik Schilling [this message]
2023-09-29 13:18 ` [libgpiod][PATCH v2 1/3] bindings: rust: fix soundness of line_info modeling Erik Schilling
2023-10-03 8:58 ` Viresh Kumar
2023-10-03 9:17 ` Erik Schilling
2023-10-03 9:30 ` Viresh Kumar
2023-09-29 13:18 ` [libgpiod][PATCH v2 2/3] bindings: rust: rename {event,settings}_clone to try_clone Erik Schilling
2023-10-03 9:00 ` Viresh Kumar
2023-09-29 13:18 ` [libgpiod][PATCH v2 3/3] bindings: rust: allow cloning line::InfoRef -> line::Info Erik Schilling
2023-10-03 9:01 ` Viresh Kumar
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=20230929-rust-line-info-soundness-v2-0-9782b7f20f26@linaro.org \
--to=erik.schilling@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=manos.pitsidianakis@linaro.org \
--cc=viresh.kumar@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).