@@ -7,22 +7,9 @@ use core::convert::TryInto;
7
7
use serde:: Serialize ;
8
8
use serde_json_core;
9
9
10
- use linux_kernel_module:: sysctl:: { Sysctl , SysctlStorage } ;
10
+ use linux_kernel_module:: sysctl:: Sysctl ;
11
11
use linux_kernel_module:: Mode ;
12
12
use linux_kernel_module:: error;
13
- use linux_kernel_module:: println;
14
- use linux_kernel_module:: user_ptr:: UserSlicePtrWriter ;
15
-
16
- struct Reference ( & ' static AtomicBool ) ;
17
-
18
- impl SysctlStorage for Reference {
19
- fn store_value ( & self , data : & [ u8 ] ) -> ( usize , error:: KernelResult < ( ) > ) {
20
- self . 0 . store_value ( & * data)
21
- }
22
- fn read_value ( & self , data : & mut UserSlicePtrWriter ) -> ( usize , error:: KernelResult < ( ) > ) {
23
- self . 0 . read_value ( & mut * data)
24
- }
25
- }
26
13
27
14
static A : AtomicBool = AtomicBool :: new ( false ) ;
28
15
static B : AtomicBool = AtomicBool :: new ( false ) ;
@@ -56,9 +43,9 @@ impl linux_kernel_module::chrdev::FileOperations for JsonChrdev {
56
43
}
57
44
58
45
struct JsonSysctlModule {
59
- _a : Sysctl < Reference > ,
60
- _b : Sysctl < Reference > ,
61
- _c : Sysctl < Reference > ,
46
+ _a : Sysctl < & ' static AtomicBool > ,
47
+ _b : Sysctl < & ' static AtomicBool > ,
48
+ _c : Sysctl < & ' static AtomicBool > ,
62
49
_chrdev_registration : linux_kernel_module:: chrdev:: Registration ,
63
50
}
64
51
@@ -78,19 +65,19 @@ impl linux_kernel_module::KernelModule for JsonSysctlModule {
78
65
_a : Sysctl :: register (
79
66
"json-sysctl\x00 " ,
80
67
"a\x00 " ,
81
- Reference ( & A ) ,
68
+ & A ,
82
69
Mode :: from_int ( 0o666 ) ,
83
70
) ?,
84
71
_b : Sysctl :: register (
85
72
"json-sysctl\x00 " ,
86
73
"b\x00 " ,
87
- Reference ( & B ) ,
74
+ & B ,
88
75
Mode :: from_int ( 0o666 ) ,
89
76
) ?,
90
77
_c : Sysctl :: register (
91
78
"json-sysctl\x00 " ,
92
79
"c\x00 " ,
93
- Reference ( & C ) ,
80
+ & C ,
94
81
Mode :: from_int ( 0o666 ) ,
95
82
) ?,
96
83
_chrdev_registration : chrdev_registration,
0 commit comments