lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <173506642113.399.14882143596480911485.tip-bot2@tip-bot2>
Date: Tue, 24 Dec 2024 18:53:41 -0000
From: "tip-bot2 for Lyude Paul" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Lyude Paul <lyude@...hat.com>, Alice Ryhl <aliceryhl@...gle.com>,
 Boqun Feng <boqun.feng@...il.com>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: [tip: locking/core] rust: sync: Add MutexGuard type alias

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     37624dde4768ec25d2f9798aa75bf32e18c0eae2
Gitweb:        https://git.kernel.org/tip/37624dde4768ec25d2f9798aa75bf32e18c0eae2
Author:        Lyude Paul <lyude@...hat.com>
AuthorDate:    Wed, 20 Nov 2024 17:26:28 -05:00
Committer:     Boqun Feng <boqun.feng@...il.com>
CommitterDate: Thu, 19 Dec 2024 14:04:42 -08:00

rust: sync: Add MutexGuard type alias

A simple helper alias for code that needs to deal with Guard types returned
from Mutexes.

Signed-off-by: Lyude Paul <lyude@...hat.com>
Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
Signed-off-by: Boqun Feng <boqun.feng@...il.com>
Link: https://lore.kernel.org/r/20241120222742.2490495-2-lyude@redhat.com
---
 rust/kernel/sync.rs            | 2 +-
 rust/kernel/sync/lock/mutex.rs | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/rust/kernel/sync.rs b/rust/kernel/sync.rs
index 1eab7eb..2721b5c 100644
--- a/rust/kernel/sync.rs
+++ b/rust/kernel/sync.rs
@@ -16,7 +16,7 @@ pub mod poll;
 pub use arc::{Arc, ArcBorrow, UniqueArc};
 pub use condvar::{new_condvar, CondVar, CondVarTimeoutResult};
 pub use lock::global::{global_lock, GlobalGuard, GlobalLock, GlobalLockBackend, GlobalLockedBy};
-pub use lock::mutex::{new_mutex, Mutex};
+pub use lock::mutex::{new_mutex, Mutex, MutexGuard};
 pub use lock::spinlock::{new_spinlock, SpinLock};
 pub use locked_by::LockedBy;
 
diff --git a/rust/kernel/sync/lock/mutex.rs b/rust/kernel/sync/lock/mutex.rs
index 0e946eb..10a70c0 100644
--- a/rust/kernel/sync/lock/mutex.rs
+++ b/rust/kernel/sync/lock/mutex.rs
@@ -86,6 +86,14 @@ pub use new_mutex;
 /// [`struct mutex`]: srctree/include/linux/mutex.h
 pub type Mutex<T> = super::Lock<T, MutexBackend>;
 
+/// A [`Guard`] acquired from locking a [`Mutex`].
+///
+/// This is simply a type alias for a [`Guard`] returned from locking a [`Mutex`]. It will unlock
+/// the [`Mutex`] upon being dropped.
+///
+/// [`Guard`]: super::Guard
+pub type MutexGuard<'a, T> = super::Guard<'a, T, MutexBackend>;
+
 /// A kernel `struct mutex` lock backend.
 pub struct MutexBackend;
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ