Skip to content

Commit

Permalink
rust: samples: fix init argument
Browse files Browse the repository at this point in the history
After commit c96b547:
    rust: Add `name` argument to Module::init()
init needs a name argument. Since both rust samples were made
    before that, they fail to compile.
  • Loading branch information
Bruno-Eduardo committed Oct 17, 2024
1 parent de1c5a8 commit 1a71d54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion samples/rust/rust_minimal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//! Rust minimal sample.

use kernel::prelude::*;
use kernel::str::CStr;

module! {
type: RustMinimal,
Expand All @@ -17,7 +18,7 @@ struct RustMinimal {
}

impl kernel::Module for RustMinimal {
fn init(_module: &'static ThisModule) -> Result<Self> {
fn init(_name: &'static CStr, _module: &'static ThisModule) -> Result<Self> {
pr_info!("Rust minimal sample (init)\n");
pr_info!("Am I built-in? {}\n", !cfg!(MODULE));

Expand Down
2 changes: 1 addition & 1 deletion samples/rust/rust_print.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn arc_print() -> Result {
}

impl kernel::Module for RustPrint {
fn init(_module: &'static ThisModule) -> Result<Self> {
fn init(_name: &'static CStr, _module: &'static ThisModule) -> Result<Self> {
pr_info!("Rust printing macros sample (init)\n");

pr_emerg!("Emergency message (level 0) without args\n");
Expand Down

0 comments on commit 1a71d54

Please sign in to comment.