File tree Expand file tree Collapse file tree 4 files changed +29
-6
lines changed Expand file tree Collapse file tree 4 files changed +29
-6
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ use self::socket::Socket;
9
9
use self :: thread:: Thread ;
10
10
use self :: ucred:: Ucred ;
11
11
use self :: uio:: Uio ;
12
- use self :: vnode:: { Vnode , VnodeOp , VopUnlock } ;
12
+ use self :: vnode:: { Vnode , VnodeOp , VopUnlock , VopVector } ;
13
13
use core:: ffi:: { c_char, c_int} ;
14
14
use core:: num:: NonZero ;
15
15
use okf:: fd:: OpenFlags ;
@@ -68,6 +68,7 @@ impl okf::Kernel for Kernel {
68
68
type Vnode = Vnode ;
69
69
type VnodeOp = VnodeOp ;
70
70
type VopUnlock = VopUnlock ;
71
+ type VopVector = VopVector ;
71
72
72
73
#[ offset( 0x419040 ) ]
73
74
unsafe fn fget (
Original file line number Diff line number Diff line change
1
+ use crate :: Kernel ;
1
2
use core:: ffi:: c_int;
2
3
3
4
/// Implementation of [`okf::vnode::Vnode`] for 11.00.
4
5
#[ repr( C ) ]
5
- pub struct Vnode { }
6
+ pub struct Vnode {
7
+ pad1 : [ u8 ; 0x10 ] ,
8
+ ops : * mut VopVector ,
9
+ }
10
+
11
+ impl okf:: vnode:: Vnode < Kernel > for Vnode {
12
+ fn ops ( & self ) -> & ' static VopVector {
13
+ unsafe { & * self . ops }
14
+ }
15
+ }
16
+
17
+ /// Implementation of [`okf::vnode::VopVector`] for 11.00.
18
+ #[ repr( C ) ]
19
+ pub struct VopVector { }
6
20
7
- impl okf:: vnode:: Vnode for Vnode { }
21
+ impl okf:: vnode:: VopVector for VopVector { }
8
22
9
23
/// Implementation of [`okf::vnode::VnodeOp`] for 11.00.
10
24
#[ repr( C ) ]
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ use self::socket::{SockAddr, Socket};
11
11
use self :: thread:: Thread ;
12
12
use self :: ucred:: Ucred ;
13
13
use self :: uio:: { Uio , UioSeg } ;
14
- use self :: vnode:: { Vnode , VnodeOp , VopUnlock } ;
14
+ use self :: vnode:: { Vnode , VnodeOp , VopUnlock , VopVector } ;
15
15
use core:: alloc:: { GlobalAlloc , Layout } ;
16
16
use core:: ffi:: { c_char, c_int} ;
17
17
use core:: marker:: PhantomData ;
@@ -72,9 +72,10 @@ pub trait Kernel: MappedKernel {
72
72
type Thread : Thread < Self > ;
73
73
type Ucred : Ucred ;
74
74
type Uio : Uio < Self > ;
75
- type Vnode : Vnode ;
75
+ type Vnode : Vnode < Self > ;
76
76
type VnodeOp : VnodeOp ;
77
77
type VopUnlock : VopUnlock ;
78
+ type VopVector : VopVector ;
78
79
79
80
fn var < O : StaticOff > ( self , off : O ) -> O :: Ops {
80
81
let value = unsafe { self . addr ( ) . add ( off. value ( ) ) } ;
Original file line number Diff line number Diff line change 1
1
pub use self :: op:: * ;
2
+ use crate :: Kernel ;
2
3
3
4
mod op;
4
5
5
6
/// Represents `vnode` structure.
6
- pub trait Vnode : Sized { }
7
+ pub trait Vnode < K : Kernel > : Sized {
8
+ /// Returns `v_op`.
9
+ fn ops ( & self ) -> & ' static K :: VopVector ;
10
+ }
11
+
12
+ /// Represents `vop_vector` structure.
13
+ pub trait VopVector : Sized { }
You can’t perform that action at this time.
0 commit comments