Re: [PATCH v2] rust: sync: add accessor for the lock behind a given guard

From: Fiona Behrens
Date: Wed Feb 05 2025 - 13:52:52 EST


Alice Ryhl <aliceryhl@xxxxxxxxxx> writes:

> Binder has some methods where the caller provides a lock guard, and
> Binder needs to be able to assert that the guard is associated with the
> right lock. To enable this, add an accessor to obtain a reference to the
> underlying lock that you can pass to `ptr::eq`.
>
> Signed-off-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

Reviewed-by: Fiona Behrens <me@xxxxxxxxxx>

Thanks,
Fiona

> ---
> Changes in v2:
> - Rename to lock_ref() to avoid confusion with lock().
> - Rebase on v6.14-rc1.
> - Link to v1: https://lore.kernel.org/r/20250130-guard-get-lock-v1-1-8ed87899920a@xxxxxxxxxx
> ---