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

PR #67 rebase #79

Merged
merged 3 commits into from
May 6, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
matrix:
include:
- dist: trusty
- dist: xenial

language: rust
Expand Down
3 changes: 2 additions & 1 deletion hello-world/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#![no_std]
#![feature(alloc)]
#![feature(alloc, const_str_as_bytes)]

extern crate alloc;
use alloc::borrow::ToOwned;
Expand Down Expand Up @@ -27,6 +27,7 @@ impl Drop for HelloWorldModule {
println!("Goodbye kernel module!");
}
}

kernel_module!(
HelloWorldModule,
author: "Alex Gaynor and Geoffrey Thomas",
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ macro_rules! kernel_module {
#[link_section = ".modinfo"]
#[allow(non_upper_case_globals)]
// TODO: Generate a name the same way the kernel's `__MODULE_INFO` does.
// TODO: This needs to be a `&'static [u8]`, since the kernel defines this as a
// `const char []`.
pub static $name: &'static str = concat!(stringify!($name), "=", $value);
// TODO: This needs to be a `[u8; _]`, since the kernel defines this as a `const char []`.
// See https://github.com/rust-lang/rfcs/pull/2545
pub static $name: &'static [u8] = concat!(stringify!($name), "=", $value, '\0').as_bytes();
};
}

Expand Down
1 change: 1 addition & 0 deletions tests/printk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![feature(const_str_as_bytes)]

#[macro_use]
extern crate linux_kernel_module;
Expand Down
1 change: 1 addition & 0 deletions tests/sysctl/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#![no_std]
#![feature(const_str_as_bytes)]

use core::sync::atomic::AtomicBool;

Expand Down
1 change: 1 addition & 0 deletions x86_64-linux-kernel-module.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"relocation-model": "static",
"relro-level": "full",
"needs-plt": true,
"target-c-int-width": "32",
"target-endian": "little",
"target-family": "unix",
Expand Down