File tree Expand file tree Collapse file tree 3 files changed +30
-10
lines changed Expand file tree Collapse file tree 3 files changed +30
-10
lines changed Original file line number Diff line number Diff line change
1
+ use crate :: lock:: Mtx ;
2
+ use crate :: Kernel ;
1
3
use okf:: queue:: TailQueueEntry ;
2
4
3
5
/// Implementation of [`okf::mount::Mount`] for 11.00.
4
6
#[ repr( C ) ]
5
7
pub struct Mount {
6
- pad1 : [ u8 ; 0x28 ] ,
8
+ mtx : Mtx ,
9
+ pad1 : [ u8 ; 0x8 ] ,
7
10
entry : TailQueueEntry < Self > ,
8
11
pad2 : [ u8 ; 0x48 ] ,
9
12
flags : u64 ,
10
13
}
11
14
12
- impl okf:: mount:: Mount for Mount {
13
- fn entry ( & self ) -> & TailQueueEntry < Self > {
15
+ impl okf:: mount:: Mount < Kernel > for Mount {
16
+ fn mtx ( & self ) -> * mut Mtx {
17
+ & self . mtx as * const Mtx as * mut Mtx
18
+ }
19
+
20
+ unsafe fn entry ( & self ) -> & TailQueueEntry < Self > {
14
21
& self . entry
15
22
}
16
23
17
- fn entry_mut ( & mut self ) -> & mut TailQueueEntry < Self > {
24
+ unsafe fn entry_mut ( & mut self ) -> & mut TailQueueEntry < Self > {
18
25
& mut self . entry
19
26
}
20
27
21
- fn flags ( & self ) -> u64 {
28
+ unsafe fn flags ( & self ) -> u64 {
22
29
self . flags
23
30
}
24
31
}
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ pub trait Kernel: MappedKernel {
55
55
type File : File ;
56
56
type LockObject : LockObject ;
57
57
type Malloc : Malloc ;
58
- type Mount : Mount ;
58
+ type Mount : Mount < Self > ;
59
59
type Mtx : Mtx < Self > ;
60
60
type Pcpu : Pcpu < Self > ;
61
61
type Socket : Socket ;
Original file line number Diff line number Diff line change 1
1
use crate :: queue:: TailQueueEntry ;
2
+ use crate :: Kernel ;
2
3
3
4
/// Represents `mount` structure.
4
- pub trait Mount : Sized {
5
+ pub trait Mount < K : Kernel > : Sized {
6
+ /// Returns `mnt_mtx`.
7
+ fn mtx ( & self ) -> * mut K :: Mtx ;
8
+
5
9
/// Returns `mnt_list`.
6
- fn entry ( & self ) -> & TailQueueEntry < Self > ;
10
+ ///
11
+ /// # Safety
12
+ /// [`Kernel::MOUNTLIST_MTX`] must be locked.
13
+ unsafe fn entry ( & self ) -> & TailQueueEntry < Self > ;
7
14
8
15
/// Returns mutable `mnt_list`.
9
- fn entry_mut ( & mut self ) -> & mut TailQueueEntry < Self > ;
16
+ ///
17
+ /// # Safety
18
+ /// [`Kernel::MOUNTLIST_MTX`] must be locked.
19
+ unsafe fn entry_mut ( & mut self ) -> & mut TailQueueEntry < Self > ;
10
20
11
21
/// Returns the value of `mnt_flag`.
12
- fn flags ( & self ) -> u64 ;
22
+ ///
23
+ /// # Safety
24
+ /// [`Mount::mtx()`] must be locked.
25
+ unsafe fn flags ( & self ) -> u64 ;
13
26
}
You can’t perform that action at this time.
0 commit comments