Skip to content

Commit 4b6c6bc

Browse files
committed
Merge tag 'vfs-7.0-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs
Pull vfs rust updates from Christian Brauner: "Allow inlining C helpers into Rust when using LTO: Add the __rust_helper annotation to all VFS-related Rust helper functions. Currently, C helpers cannot be inlined into Rust code even under LTO because LLVM detects slightly different codegen options between the C and Rust compilation units (differing null-pointer-check flags, builtin lists, and target feature strings). The __rust_helper macro is the first step toward fixing this: it is currently #defined to nothing, but a follow-up series will change it to __always_inline when compiling with LTO (while keeping it empty for bindgen, which ignores inline functions). This picks up the VFS portion (fs, pid_namespace, poll) of a larger tree-wide series" * tag 'vfs-7.0-rc1.rust' of git://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs: rust: poll: add __rust_helper to helpers rust: pid_namespace: add __rust_helper to helpers rust: fs: add __rust_helper to helpers
2 parents 6252e91 + 5334fc2 commit 4b6c6bc

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

rust/helpers/fs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
#include <linux/fs.h>
88

9-
struct file *rust_helper_get_file(struct file *f)
9+
__rust_helper struct file *rust_helper_get_file(struct file *f)
1010
{
1111
return get_file(f);
1212
}

rust/helpers/pid_namespace.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
#include <linux/pid_namespace.h>
44
#include <linux/cleanup.h>
55

6-
struct pid_namespace *rust_helper_get_pid_ns(struct pid_namespace *ns)
6+
__rust_helper struct pid_namespace *
7+
rust_helper_get_pid_ns(struct pid_namespace *ns)
78
{
89
return get_pid_ns(ns);
910
}
1011

11-
void rust_helper_put_pid_ns(struct pid_namespace *ns)
12+
__rust_helper void rust_helper_put_pid_ns(struct pid_namespace *ns)
1213
{
1314
put_pid_ns(ns);
1415
}
1516

1617
/* Get a reference on a task's pid namespace. */
17-
struct pid_namespace *rust_helper_task_get_pid_ns(struct task_struct *task)
18+
__rust_helper struct pid_namespace *
19+
rust_helper_task_get_pid_ns(struct task_struct *task)
1820
{
1921
struct pid_namespace *pid_ns;
2022

rust/helpers/poll.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
#include <linux/export.h>
44
#include <linux/poll.h>
55

6-
void rust_helper_poll_wait(struct file *filp, wait_queue_head_t *wait_address,
7-
poll_table *p)
6+
__rust_helper void rust_helper_poll_wait(struct file *filp,
7+
wait_queue_head_t *wait_address,
8+
poll_table *p)
89
{
910
poll_wait(filp, wait_address, p);
1011
}

0 commit comments

Comments
 (0)