Skip to content

Commit 15de856

Browse files
committedOct 14, 2024
rust_out_of_tree: use the new allocation APIs
Required since Linux's commit 85d72be1b31d ("rust: alloc: remove `VecExt` extension") [1]. Equivalent to Linux's commit 48dd88851bc5 ("rust: treewide: switch to the kernel `Vec` type"). Link: https://lore.kernel.org/rust-for-linux/20241004154149.93856-1-dakr@kernel.org/ [1] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
1 parent 47b0a7d commit 15de856

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎rust_out_of_tree.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ module! {
1313
}
1414

1515
struct RustOutOfTree {
16-
numbers: Vec<i32>,
16+
numbers: KVec<i32>,
1717
}
1818

1919
impl kernel::Module for RustOutOfTree {
2020
fn init(_module: &'static ThisModule) -> Result<Self> {
2121
pr_info!("Rust out-of-tree sample (init)\n");
2222

23-
let mut numbers = Vec::new();
23+
let mut numbers = KVec::new();
2424
numbers.push(72, GFP_KERNEL)?;
2525
numbers.push(108, GFP_KERNEL)?;
2626
numbers.push(200, GFP_KERNEL)?;

0 commit comments

Comments
 (0)
Please sign in to comment.