[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241107020831.1561063-14-alistair.francis@wdc.com>
Date: Thu, 7 Nov 2024 12:08:31 +1000
From: Alistair Francis <alistair23@...il.com>
To: alex.gaynor@...il.com,
benno.lossin@...ton.me,
gary@...yguo.net,
linux-kernel@...r.kernel.org,
ojeda@...nel.org,
rust-for-linux@...r.kernel.org,
bjorn3_gh@...tonmail.com,
alistair.francis@....com,
me@...enk.dev,
a.hindborg@...nel.org,
tmgross@...ch.edu,
boqun.feng@...il.com,
aliceryhl@...gle.com
Cc: alistair23@...il.com
Subject: [PATCH 13/13] rust: helpers: Remove uaccess helpers
Now that we support wrap-static-fns we no longer need the custom helper.
Signed-off-by: Alistair Francis <alistair.francis@....com>
---
rust/bindgen_static_functions | 3 +++
rust/bindings/bindings_helper.h | 1 +
rust/helpers/helpers.c | 6 ++----
rust/helpers/uaccess.c | 15 ---------------
4 files changed, 6 insertions(+), 19 deletions(-)
delete mode 100644 rust/helpers/uaccess.c
diff --git a/rust/bindgen_static_functions b/rust/bindgen_static_functions
index 396e2eac88e5c..4807fecb2f192 100644
--- a/rust/bindgen_static_functions
+++ b/rust/bindgen_static_functions
@@ -26,3 +26,6 @@
--allowlist-function get_task_struct
--allowlist-function put_task_struct
+
+--allowlist-function copy_from_user
+--allowlist-function copy_to_user
diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h
index 1d1d921fd55e9..600ac0046a95f 100644
--- a/rust/bindings/bindings_helper.h
+++ b/rust/bindings/bindings_helper.h
@@ -23,6 +23,7 @@
#include <linux/sched/signal.h>
#include <linux/sched/task.h>
#include <linux/slab.h>
+#include <linux/uaccess.h>
#include <linux/wait.h>
#include <linux/workqueue.h>
diff --git a/rust/helpers/helpers.c b/rust/helpers/helpers.c
index 2af11499da454..e4e42e0ef946a 100644
--- a/rust/helpers/helpers.c
+++ b/rust/helpers/helpers.c
@@ -1,8 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
/*
- * Non-trivial C macros cannot be used in Rust. Similarly, inlined C functions
- * cannot be called either. This file explicitly creates functions ("helpers")
- * that wrap those so that they can be called from Rust.
+ * Non-trivial C macros cannot be used in Rust. This file explicitly creates
+ * functions ("helpers") that wrap those so that they can be called from Rust.
*
* Sorted alphabetically.
*/
@@ -14,6 +13,5 @@
#include "slab.c"
#include "spinlock.c"
#include "task.c"
-#include "uaccess.c"
#include "wait.c"
#include "workqueue.c"
diff --git a/rust/helpers/uaccess.c b/rust/helpers/uaccess.c
deleted file mode 100644
index f49076f813cd6..0000000000000
--- a/rust/helpers/uaccess.c
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-
-#include <linux/uaccess.h>
-
-unsigned long rust_helper_copy_from_user(void *to, const void __user *from,
- unsigned long n)
-{
- return copy_from_user(to, from, n);
-}
-
-unsigned long rust_helper_copy_to_user(void __user *to, const void *from,
- unsigned long n)
-{
- return copy_to_user(to, from, n);
-}
--
2.47.0
Powered by blists - more mailing lists