Skip to content
This repository was archived by the owner on Mar 7, 2021. It is now read-only.

Commit cf1c265

Browse files
authored
Start marking all the projects as 2018 edition (#92)
* Start marking all the projects as 2018 edition * Change use statements for 2018
1 parent d8c6e90 commit cf1c265

File tree

15 files changed

+30
-24
lines changed

15 files changed

+30
-24
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "linux-kernel-module"
33
version = "0.1.0"
44
authors = ["Alex Gaynor <alex.gaynor@gmail.com>"]
5+
edition = "2018"
56

67
[dependencies]
78
bitflags = "1"

hello-world/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
name = "hello-world"
33
version = "0.1.0"
44
authors = ["Geoffrey Thomas <geofft@ldpreload.com>"]
5+
edition = "2018"
56

67
[lib]
78
crate-type = ["staticlib"]

src/allocator.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use core::alloc::{GlobalAlloc, Layout};
2+
use core::ptr;
23

3-
use bindings;
4-
use c_types;
4+
use crate::bindings;
5+
use crate::c_types;
56

67
pub struct KernelAllocator;
78

@@ -10,7 +11,7 @@ unsafe impl GlobalAlloc for KernelAllocator {
1011
// krealloc is used instead of kmalloc because kmalloc is an inline function and can't be
1112
// bound to as a result
1213
return bindings::krealloc(
13-
0 as *const c_types::c_void,
14+
ptr::null(),
1415
layout.size(),
1516
bindings::GFP_KERNEL,
1617
) as *mut u8;

src/bindings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case, improper_ctypes)]
22

3-
use c_types;
3+
use crate::c_types;
44

55
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
66

src/chrdev.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
use core::ops::Range;
22

3-
use bindings;
4-
use c_types;
5-
use error;
3+
use crate::bindings;
4+
use crate::c_types;
5+
use crate::error;
66

77
pub struct DeviceNumberRegion {
88
dev: bindings::dev_t,

src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use bindings;
2-
use c_types;
1+
use crate::bindings;
2+
use crate::c_types;
33

44
pub struct Error(c_types::c_int);
55

src/filesystem.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use core::default::Default;
33
use core::marker;
44
use core::mem;
55

6-
use bindings;
7-
use c_types;
8-
use error;
6+
use crate::bindings;
7+
use crate::c_types;
8+
use crate::error;
99

1010
pub struct FileSystemRegistration<T: FileSystem> {
1111
_phantom: marker::PhantomData<T>,

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ pub mod sysctl;
2020
mod types;
2121
pub mod user_ptr;
2222

23-
pub use error::{Error, KernelResult};
24-
pub use types::Mode;
23+
pub use crate::error::{Error, KernelResult};
24+
pub use crate::types::Mode;
2525

2626
pub type _InitResult = c_types::c_int;
2727

src/printk.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use core::cmp;
22
use core::fmt;
33

4-
use c_types::c_int;
4+
use crate::c_types::c_int;
55

66
pub struct KernelConsole;
77

src/sysctl.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use core::mem;
33
use core::ptr;
44
use core::sync::atomic;
55

6-
use bindings;
7-
use c_types;
8-
use error;
9-
use types;
10-
use user_ptr::{UserSlicePtr, UserSlicePtrWriter};
6+
use crate::bindings;
7+
use crate::c_types;
8+
use crate::error;
9+
use crate::types;
10+
use crate::user_ptr::{UserSlicePtr, UserSlicePtrWriter};
1111

1212
pub trait SysctlStorage: Sync {
1313
fn store_value(&self, data: &[u8]) -> (usize, error::KernelResult<()>);

0 commit comments

Comments
 (0)