如何开发一个Rust内核模块
use kernel::prelude::*;
module! {
type: RustHello,
name: "rust_hello",
author: "Rust for Linux Contributors",
description: "Rust hello sample",
license: "GPL",
}
struct RustHello {
numbers: Vec<i32>,
}
pub trait Module: Sized + Sync {
/// Called at module initialization time.
///
/// Use this method to perform whatever setup or registration your module
/// should do.
///
/// Equivalent to the `module_init` macro in the C API.
fn init(module: &'static ThisModule) -> error::Result<Self>;
}