Re: [PATCH 1/2] rust: add a wrapper for the `num_possible_cpus` C function
From: Dirk Behme
Date: Mon Feb 16 2026 - 03:24:28 EST
On 15.02.2026 21:10, Andreas Hindborg wrote:
This function returns the max number of CPUs that can be online.
Signed-off-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
---
rust/helpers/helpers.c | 1 +
rust/helpers/num_cpus.c | 8 ++++++++
rust/kernel/lib.rs | 6 ++++++
3 files changed, 15 insertions(+)
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 79c72762ad9c4..a19d6562fcb3a 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -35,6 +35,7 @@
#include "maple_tree.c"
#include "mm.c"
#include "mutex.c"
+#include "num_cpus.c"
#include "of.c"
#include "page.c"
#include "pci.c"
diff --git a/rust/helpers/num_cpus.c b/rust/helpers/num_cpus.c
new file mode 100644
index 0000000000000..daddacb0418d8
--- /dev/null
+++ b/rust/helpers/num_cpus.c
@@ -0,0 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/cpumask.h>
+
+unsigned int rust_helper_num_possible_cpus(void)
Should we add `__rust_helper` here?
Thanks
Dirk