Skip to content

Commit 5f1193d

Browse files
Darksonnfbq
authored andcommitted
rust: task: Add __rust_helper to helpers
This is needed to inline these helpers into Rust code. Reviewed-by: Boqun Feng <boqun.feng@gmail.com> Reviewed-by: Gary Guo <gary@garyguo.net> Signed-off-by: Alice Ryhl <aliceryhl@google.com> Signed-off-by: Boqun Feng <boqun.feng@gmail.com> Link: https://patch.msgid.link/20260105-define-rust-helper-v2-21-51da5f454a67@google.com
1 parent d4ad4de commit 5f1193d

2 files changed

Lines changed: 13 additions & 13 deletions

File tree

rust/helpers/signal.c

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

33
#include <linux/sched/signal.h>
44

5-
int rust_helper_signal_pending(struct task_struct *t)
5+
__rust_helper int rust_helper_signal_pending(struct task_struct *t)
66
{
77
return signal_pending(t);
88
}

rust/helpers/task.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,60 @@
33
#include <linux/kernel.h>
44
#include <linux/sched/task.h>
55

6-
void rust_helper_might_resched(void)
6+
__rust_helper void rust_helper_might_resched(void)
77
{
88
might_resched();
99
}
1010

11-
struct task_struct *rust_helper_get_current(void)
11+
__rust_helper struct task_struct *rust_helper_get_current(void)
1212
{
1313
return current;
1414
}
1515

16-
void rust_helper_get_task_struct(struct task_struct *t)
16+
__rust_helper void rust_helper_get_task_struct(struct task_struct *t)
1717
{
1818
get_task_struct(t);
1919
}
2020

21-
void rust_helper_put_task_struct(struct task_struct *t)
21+
__rust_helper void rust_helper_put_task_struct(struct task_struct *t)
2222
{
2323
put_task_struct(t);
2424
}
2525

26-
kuid_t rust_helper_task_uid(struct task_struct *task)
26+
__rust_helper kuid_t rust_helper_task_uid(struct task_struct *task)
2727
{
2828
return task_uid(task);
2929
}
3030

31-
kuid_t rust_helper_task_euid(struct task_struct *task)
31+
__rust_helper kuid_t rust_helper_task_euid(struct task_struct *task)
3232
{
3333
return task_euid(task);
3434
}
3535

3636
#ifndef CONFIG_USER_NS
37-
uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_t uid)
37+
__rust_helper uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_t uid)
3838
{
3939
return from_kuid(to, uid);
4040
}
4141
#endif /* CONFIG_USER_NS */
4242

43-
bool rust_helper_uid_eq(kuid_t left, kuid_t right)
43+
__rust_helper bool rust_helper_uid_eq(kuid_t left, kuid_t right)
4444
{
4545
return uid_eq(left, right);
4646
}
4747

48-
kuid_t rust_helper_current_euid(void)
48+
__rust_helper kuid_t rust_helper_current_euid(void)
4949
{
5050
return current_euid();
5151
}
5252

53-
struct user_namespace *rust_helper_current_user_ns(void)
53+
__rust_helper struct user_namespace *rust_helper_current_user_ns(void)
5454
{
5555
return current_user_ns();
5656
}
5757

58-
pid_t rust_helper_task_tgid_nr_ns(struct task_struct *tsk,
59-
struct pid_namespace *ns)
58+
__rust_helper pid_t rust_helper_task_tgid_nr_ns(struct task_struct *tsk,
59+
struct pid_namespace *ns)
6060
{
6161
return task_tgid_nr_ns(tsk, ns);
6262
}

0 commit comments

Comments
 (0)