This repository was archived by the owner on Mar 7, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 13 files changed +20
-36
lines changed Expand file tree Collapse file tree 13 files changed +20
-36
lines changed Original file line number Diff line number Diff line change 1
- extern crate bindgen;
2
- extern crate cc;
3
- extern crate shlex;
1
+ use bindgen;
2
+ use cc;
3
+ use shlex;
4
4
5
5
use std:: env;
6
6
use std:: path:: PathBuf ;
Original file line number Diff line number Diff line change 1
1
#![ no_std]
2
2
#![ feature( alloc, const_str_as_bytes) ]
3
3
4
- extern crate alloc;
5
4
use alloc:: borrow:: ToOwned ;
6
5
use alloc:: string:: String ;
7
6
8
- # [ macro_use ]
9
- extern crate linux_kernel_module;
7
+ use linux_kernel_module ;
8
+ use linux_kernel_module:: println ;
10
9
11
10
struct HelloWorldModule {
12
11
message : String ,
@@ -28,7 +27,7 @@ impl Drop for HelloWorldModule {
28
27
}
29
28
}
30
29
31
- kernel_module ! (
30
+ linux_kernel_module :: kernel_module!(
32
31
HelloWorldModule ,
33
32
author: "Alex Gaynor and Geoffrey Thomas" ,
34
33
description: "An extremely simple kernel module" ,
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ use core::default::Default;
3
3
use core:: marker;
4
4
use core:: mem;
5
5
6
+ use bitflags;
7
+
6
8
use crate :: bindings;
7
9
use crate :: c_types;
8
10
use crate :: error;
@@ -24,7 +26,7 @@ pub trait FileSystem {
24
26
const FLAGS : FileSystemFlags ;
25
27
}
26
28
27
- bitflags ! {
29
+ bitflags:: bitflags ! {
28
30
pub struct FileSystemFlags : c_types:: c_int {
29
31
const FS_REQUIRES_DEV = bindings:: FS_REQUIRES_DEV as c_types:: c_int;
30
32
const FS_BINARY_MOUNTDATA = bindings:: FS_BINARY_MOUNTDATA as c_types:: c_int;
@@ -34,12 +36,6 @@ bitflags! {
34
36
}
35
37
}
36
38
37
- impl FileSystemFlags {
38
- pub const fn const_empty ( ) -> FileSystemFlags {
39
- FileSystemFlags { bits : 0 }
40
- }
41
- }
42
-
43
39
extern "C" fn fill_super_callback < T : FileSystem > (
44
40
_sb : * mut bindings:: super_block ,
45
41
_data : * mut c_types:: c_void ,
Original file line number Diff line number Diff line change 1
1
#![ no_std]
2
- #![ feature( allocator_api, const_fn , alloc_error_handler) ]
2
+ #![ feature( allocator_api, alloc_error_handler) ]
3
3
4
- #[ macro_use]
5
4
extern crate alloc;
6
- #[ macro_use]
7
- extern crate bitflags;
8
5
9
6
use core:: panic:: PanicInfo ;
10
7
@@ -14,7 +11,6 @@ mod c_types;
14
11
pub mod chrdev;
15
12
mod error;
16
13
pub mod filesystem;
17
- #[ macro_use]
18
14
pub mod printk;
19
15
pub mod sysctl;
20
16
mod types;
@@ -53,7 +49,7 @@ macro_rules! kernel_module {
53
49
}
54
50
55
51
$(
56
- kernel_module!( @attribute $name, $value) ;
52
+ $crate :: kernel_module!( @attribute $name, $value) ;
57
53
) *
58
54
} ;
59
55
Original file line number Diff line number Diff line change 1
1
use alloc:: boxed:: Box ;
2
+ use alloc:: vec;
2
3
use core:: mem;
3
4
use core:: ptr;
4
5
use core:: sync:: atomic;
Original file line number Diff line number Diff line change
1
+ use alloc:: vec;
1
2
use alloc:: vec:: Vec ;
2
3
use core:: u32;
3
4
Original file line number Diff line number Diff line change 1
1
#![ no_std]
2
2
#![ feature( const_str_as_bytes) ]
3
3
4
- #[ macro_use]
5
- extern crate linux_kernel_module;
4
+ use linux_kernel_module;
6
5
7
6
struct ChrdevTestModule {
8
7
_dev : linux_kernel_module:: chrdev:: DeviceNumberRegion ,
@@ -19,7 +18,7 @@ impl linux_kernel_module::KernelModule for ChrdevTestModule {
19
18
}
20
19
}
21
20
22
- kernel_module ! (
21
+ linux_kernel_module :: kernel_module!(
23
22
ChrdevTestModule ,
24
23
author: "Alex Gaynor and Geoffrey Thomas" ,
25
24
description: "A module for testing character devices" ,
Original file line number Diff line number Diff line change 1
- extern crate kernel_module_tests;
2
-
3
1
use kernel_module_tests:: with_kernel_module;
4
2
use std:: fs;
5
3
Original file line number Diff line number Diff line change 1
1
#![ no_std]
2
2
#![ feature( const_str_as_bytes) ]
3
3
4
- #[ macro_use]
5
- extern crate linux_kernel_module;
4
+ use linux_kernel_module:: { self , println} ;
6
5
7
6
struct PrintkTestModule ;
8
7
@@ -16,7 +15,7 @@ impl linux_kernel_module::KernelModule for PrintkTestModule {
16
15
}
17
16
}
18
17
19
- kernel_module ! (
18
+ linux_kernel_module :: kernel_module!(
20
19
PrintkTestModule ,
21
20
author: "Alex Gaynor and Geoffrey Thomas" ,
22
21
description: "A module for testing println!()" ,
Original file line number Diff line number Diff line change 1
- extern crate kernel_module_tests;
2
-
3
1
use std:: process:: Command ;
4
2
5
3
use kernel_module_tests:: with_kernel_module;
You can’t perform that action at this time.
0 commit comments