try implement 02_module_params in rust

params: in module! macro don't exist yet
This commit is contained in:
Florian RICHER 2025-03-02 17:51:18 +01:00
parent 0d471911dd
commit a407e656b6
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
4 changed files with 43 additions and 10 deletions

View file

@ -1,24 +1,24 @@
use kernel::prelude::*;
module! {
type: RustOutOfTree,
name: "test_module",
type: BasicModule,
name: "basic_module",
author: "Florian RICHER <florian.richer@protonmail.com>",
description: "Un module noyau qui affiche un message",
license: "GPL",
}
struct RustOutOfTree;
struct BasicModule;
impl kernel::Module for RustOutOfTree {
impl kernel::Module for BasicModule {
fn init(_module: &'static ThisModule) -> Result<Self> {
pr_info!("Bonjour! Le module est chargé.\n");
Ok(RustOutOfTree)
Ok(BasicModule)
}
}
impl Drop for RustOutOfTree {
impl Drop for BasicModule {
fn drop(&mut self) {
pr_info!("Au revoir! Le module est déchargé.\n");
}