mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-22 00:43:24 +00:00
Refactor Rwlock to take type parameter
This commit is contained in:
committed by
Tate, Hongliang Tian
parent
ac1a6be05d
commit
495c93c2ad
@ -2,7 +2,7 @@
|
||||
|
||||
use core::sync::atomic::Ordering;
|
||||
|
||||
use ostd::sync::{RwLockReadGuard, RwLockWriteGuard};
|
||||
use ostd::sync::{PreemptDisabled, RwLockReadGuard, RwLockWriteGuard};
|
||||
|
||||
use super::{group::AtomicGid, user::AtomicUid, Gid, Uid};
|
||||
use crate::{
|
||||
@ -387,11 +387,11 @@ impl Credentials_ {
|
||||
|
||||
// ******* Supplementary groups methods *******
|
||||
|
||||
pub(super) fn groups(&self) -> RwLockReadGuard<BTreeSet<Gid>> {
|
||||
pub(super) fn groups(&self) -> RwLockReadGuard<BTreeSet<Gid>, PreemptDisabled> {
|
||||
self.supplementary_gids.read()
|
||||
}
|
||||
|
||||
pub(super) fn groups_mut(&self) -> RwLockWriteGuard<BTreeSet<Gid>> {
|
||||
pub(super) fn groups_mut(&self) -> RwLockWriteGuard<BTreeSet<Gid>, PreemptDisabled> {
|
||||
self.supplementary_gids.write()
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use aster_rights::{Dup, Read, TRights, Write};
|
||||
use aster_rights_proc::require;
|
||||
use ostd::sync::{RwLockReadGuard, RwLockWriteGuard};
|
||||
use ostd::sync::{PreemptDisabled, RwLockReadGuard, RwLockWriteGuard};
|
||||
|
||||
use super::{capabilities::CapSet, credentials_::Credentials_, Credentials, Gid, Uid};
|
||||
use crate::prelude::*;
|
||||
@ -239,7 +239,7 @@ impl<R: TRights> Credentials<R> {
|
||||
///
|
||||
/// This method requires the `Read` right.
|
||||
#[require(R > Read)]
|
||||
pub fn groups(&self) -> RwLockReadGuard<BTreeSet<Gid>> {
|
||||
pub fn groups(&self) -> RwLockReadGuard<BTreeSet<Gid>, PreemptDisabled> {
|
||||
self.0.groups()
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ impl<R: TRights> Credentials<R> {
|
||||
///
|
||||
/// This method requires the `Write` right.
|
||||
#[require(R > Write)]
|
||||
pub fn groups_mut(&self) -> RwLockWriteGuard<BTreeSet<Gid>> {
|
||||
pub fn groups_mut(&self) -> RwLockWriteGuard<BTreeSet<Gid>, PreemptDisabled> {
|
||||
self.0.groups_mut()
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user