Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: kbuild: split up helpers.c

This patch splits up the rust helpers C file. When rebasing patch sets on
upstream linux, merge conflicts in helpers.c is common and time consuming
[1]. Thus, split the file so that each kernel component can live in a
separate file.

This patch lists helper files explicitly and thus conflicts in the file
list is still likely. However, they should be more simple to resolve than
the conflicts usually seen in helpers.c.

[ Removed `README.md` and undeleted the original comment since now,
in v3 of the series, we have a `helpers.c` again; which also allows
us to keep the "Sorted alphabetically" line and makes the diff easier.

In addition, updated the Documentation/ mentions of the file, reworded
title and removed blank lines at the end of `page.c`. - Miguel ]

Link: https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/Splitting.20up.20helpers.2Ec/near/426694012 [1]
Signed-off-by: Andreas Hindborg <a.hindborg@samsung.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Dirk Behme <dirk.behme@de.bosch.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <benno.lossin@proton.me>
Link: https://lore.kernel.org/r/20240815103016.2771842-1-nmi@metaspace.dk
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>

authored by

Andreas Hindborg and committed by
Miguel Ojeda
87634653 f1385dc6

+301 -244
+2 -2
Documentation/rust/general-information.rst
··· 75 75 .. code-block:: 76 76 77 77 rust/bindings/ 78 - (rust/helpers.c) 78 + (rust/helpers/) 79 79 80 80 include/ -----+ <-+ 81 81 | | ··· 112 112 113 113 For parts of the C header that ``bindgen`` does not auto generate, e.g. C 114 114 ``inline`` functions or non-trivial macros, it is acceptable to add a small 115 - wrapper function to ``rust/helpers.c`` to make it available for the Rust side as 115 + wrapper function to ``rust/helpers/`` to make it available for the Rust side as 116 116 well. 117 117 118 118 Abstractions
+3 -3
rust/Makefile
··· 8 8 9 9 # Missing prototypes are expected in the helpers since these are exported 10 10 # for Rust only, thus there is no header nor prototypes. 11 - obj-$(CONFIG_RUST) += helpers.o 12 - CFLAGS_REMOVE_helpers.o = -Wmissing-prototypes -Wmissing-declarations 11 + obj-$(CONFIG_RUST) += helpers/helpers.o 12 + CFLAGS_REMOVE_helpers/helpers.o = -Wmissing-prototypes -Wmissing-declarations 13 13 14 14 always-$(CONFIG_RUST) += libmacros.so 15 15 no-clean-files += libmacros.so ··· 299 299 -I$(objtree)/$(obj) -Wno-missing-prototypes -Wno-missing-declarations 300 300 $(obj)/bindings/bindings_helpers_generated.rs: private bindgen_target_extra = ; \ 301 301 sed -Ei 's/pub fn rust_helper_([a-zA-Z0-9_]*)/#[link_name="rust_helper_\1"]\n pub fn \1/g' $@ 302 - $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers.c FORCE 302 + $(obj)/bindings/bindings_helpers_generated.rs: $(src)/helpers/helpers.c FORCE 303 303 $(call if_changed_dep,bindgen) 304 304 305 305 quiet_cmd_exports = EXPORTS $@
-239
rust/helpers.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Non-trivial C macros cannot be used in Rust. Similarly, inlined C functions 4 - * cannot be called either. This file explicitly creates functions ("helpers") 5 - * that wrap those so that they can be called from Rust. 6 - * 7 - * Even though Rust kernel modules should never use the bindings directly, some 8 - * of these helpers need to be exported because Rust generics and inlined 9 - * functions may not get their code generated in the crate where they are 10 - * defined. Other helpers, called from non-inline functions, may not be 11 - * exported, in principle. However, in general, the Rust compiler does not 12 - * guarantee codegen will be performed for a non-inline function either. 13 - * Therefore, this file exports all the helpers. In the future, this may be 14 - * revisited to reduce the number of exports after the compiler is informed 15 - * about the places codegen is required. 16 - * 17 - * All symbols are exported as GPL-only to guarantee no GPL-only feature is 18 - * accidentally exposed. 19 - * 20 - * Sorted alphabetically. 21 - */ 22 - 23 - #include <kunit/test-bug.h> 24 - #include <linux/bug.h> 25 - #include <linux/build_bug.h> 26 - #include <linux/device.h> 27 - #include <linux/err.h> 28 - #include <linux/errname.h> 29 - #include <linux/gfp.h> 30 - #include <linux/highmem.h> 31 - #include <linux/mutex.h> 32 - #include <linux/refcount.h> 33 - #include <linux/sched/signal.h> 34 - #include <linux/slab.h> 35 - #include <linux/spinlock.h> 36 - #include <linux/wait.h> 37 - #include <linux/workqueue.h> 38 - 39 - __noreturn void rust_helper_BUG(void) 40 - { 41 - BUG(); 42 - } 43 - EXPORT_SYMBOL_GPL(rust_helper_BUG); 44 - 45 - unsigned long rust_helper_copy_from_user(void *to, const void __user *from, 46 - unsigned long n) 47 - { 48 - return copy_from_user(to, from, n); 49 - } 50 - EXPORT_SYMBOL_GPL(rust_helper_copy_from_user); 51 - 52 - unsigned long rust_helper_copy_to_user(void __user *to, const void *from, 53 - unsigned long n) 54 - { 55 - return copy_to_user(to, from, n); 56 - } 57 - EXPORT_SYMBOL_GPL(rust_helper_copy_to_user); 58 - 59 - void rust_helper_mutex_lock(struct mutex *lock) 60 - { 61 - mutex_lock(lock); 62 - } 63 - EXPORT_SYMBOL_GPL(rust_helper_mutex_lock); 64 - 65 - void rust_helper___spin_lock_init(spinlock_t *lock, const char *name, 66 - struct lock_class_key *key) 67 - { 68 - #ifdef CONFIG_DEBUG_SPINLOCK 69 - __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG); 70 - #else 71 - spin_lock_init(lock); 72 - #endif 73 - } 74 - EXPORT_SYMBOL_GPL(rust_helper___spin_lock_init); 75 - 76 - void rust_helper_spin_lock(spinlock_t *lock) 77 - { 78 - spin_lock(lock); 79 - } 80 - EXPORT_SYMBOL_GPL(rust_helper_spin_lock); 81 - 82 - void rust_helper_spin_unlock(spinlock_t *lock) 83 - { 84 - spin_unlock(lock); 85 - } 86 - EXPORT_SYMBOL_GPL(rust_helper_spin_unlock); 87 - 88 - void rust_helper_init_wait(struct wait_queue_entry *wq_entry) 89 - { 90 - init_wait(wq_entry); 91 - } 92 - EXPORT_SYMBOL_GPL(rust_helper_init_wait); 93 - 94 - int rust_helper_signal_pending(struct task_struct *t) 95 - { 96 - return signal_pending(t); 97 - } 98 - EXPORT_SYMBOL_GPL(rust_helper_signal_pending); 99 - 100 - struct page *rust_helper_alloc_pages(gfp_t gfp_mask, unsigned int order) 101 - { 102 - return alloc_pages(gfp_mask, order); 103 - } 104 - EXPORT_SYMBOL_GPL(rust_helper_alloc_pages); 105 - 106 - void *rust_helper_kmap_local_page(struct page *page) 107 - { 108 - return kmap_local_page(page); 109 - } 110 - EXPORT_SYMBOL_GPL(rust_helper_kmap_local_page); 111 - 112 - void rust_helper_kunmap_local(const void *addr) 113 - { 114 - kunmap_local(addr); 115 - } 116 - EXPORT_SYMBOL_GPL(rust_helper_kunmap_local); 117 - 118 - refcount_t rust_helper_REFCOUNT_INIT(int n) 119 - { 120 - return (refcount_t)REFCOUNT_INIT(n); 121 - } 122 - EXPORT_SYMBOL_GPL(rust_helper_REFCOUNT_INIT); 123 - 124 - void rust_helper_refcount_inc(refcount_t *r) 125 - { 126 - refcount_inc(r); 127 - } 128 - EXPORT_SYMBOL_GPL(rust_helper_refcount_inc); 129 - 130 - bool rust_helper_refcount_dec_and_test(refcount_t *r) 131 - { 132 - return refcount_dec_and_test(r); 133 - } 134 - EXPORT_SYMBOL_GPL(rust_helper_refcount_dec_and_test); 135 - 136 - __force void *rust_helper_ERR_PTR(long err) 137 - { 138 - return ERR_PTR(err); 139 - } 140 - EXPORT_SYMBOL_GPL(rust_helper_ERR_PTR); 141 - 142 - bool rust_helper_IS_ERR(__force const void *ptr) 143 - { 144 - return IS_ERR(ptr); 145 - } 146 - EXPORT_SYMBOL_GPL(rust_helper_IS_ERR); 147 - 148 - long rust_helper_PTR_ERR(__force const void *ptr) 149 - { 150 - return PTR_ERR(ptr); 151 - } 152 - EXPORT_SYMBOL_GPL(rust_helper_PTR_ERR); 153 - 154 - const char *rust_helper_errname(int err) 155 - { 156 - return errname(err); 157 - } 158 - EXPORT_SYMBOL_GPL(rust_helper_errname); 159 - 160 - struct task_struct *rust_helper_get_current(void) 161 - { 162 - return current; 163 - } 164 - EXPORT_SYMBOL_GPL(rust_helper_get_current); 165 - 166 - void rust_helper_get_task_struct(struct task_struct *t) 167 - { 168 - get_task_struct(t); 169 - } 170 - EXPORT_SYMBOL_GPL(rust_helper_get_task_struct); 171 - 172 - void rust_helper_put_task_struct(struct task_struct *t) 173 - { 174 - put_task_struct(t); 175 - } 176 - EXPORT_SYMBOL_GPL(rust_helper_put_task_struct); 177 - 178 - struct kunit *rust_helper_kunit_get_current_test(void) 179 - { 180 - return kunit_get_current_test(); 181 - } 182 - EXPORT_SYMBOL_GPL(rust_helper_kunit_get_current_test); 183 - 184 - void rust_helper_init_work_with_key(struct work_struct *work, work_func_t func, 185 - bool onstack, const char *name, 186 - struct lock_class_key *key) 187 - { 188 - __init_work(work, onstack); 189 - work->data = (atomic_long_t)WORK_DATA_INIT(); 190 - lockdep_init_map(&work->lockdep_map, name, key, 0); 191 - INIT_LIST_HEAD(&work->entry); 192 - work->func = func; 193 - } 194 - EXPORT_SYMBOL_GPL(rust_helper_init_work_with_key); 195 - 196 - void * __must_check __realloc_size(2) 197 - rust_helper_krealloc(const void *objp, size_t new_size, gfp_t flags) 198 - { 199 - return krealloc(objp, new_size, flags); 200 - } 201 - EXPORT_SYMBOL_GPL(rust_helper_krealloc); 202 - 203 - /* 204 - * `bindgen` binds the C `size_t` type as the Rust `usize` type, so we can 205 - * use it in contexts where Rust expects a `usize` like slice (array) indices. 206 - * `usize` is defined to be the same as C's `uintptr_t` type (can hold any 207 - * pointer) but not necessarily the same as `size_t` (can hold the size of any 208 - * single object). Most modern platforms use the same concrete integer type for 209 - * both of them, but in case we find ourselves on a platform where 210 - * that's not true, fail early instead of risking ABI or 211 - * integer-overflow issues. 212 - * 213 - * If your platform fails this assertion, it means that you are in 214 - * danger of integer-overflow bugs (even if you attempt to add 215 - * `--no-size_t-is-usize`). It may be easiest to change the kernel ABI on 216 - * your platform such that `size_t` matches `uintptr_t` (i.e., to increase 217 - * `size_t`, because `uintptr_t` has to be at least as big as `size_t`). 218 - */ 219 - static_assert( 220 - sizeof(size_t) == sizeof(uintptr_t) && 221 - __alignof__(size_t) == __alignof__(uintptr_t), 222 - "Rust code expects C `size_t` to match Rust `usize`" 223 - ); 224 - 225 - // This will soon be moved to a separate file, so no need to merge with above. 226 - #include <linux/blk-mq.h> 227 - #include <linux/blkdev.h> 228 - 229 - void *rust_helper_blk_mq_rq_to_pdu(struct request *rq) 230 - { 231 - return blk_mq_rq_to_pdu(rq); 232 - } 233 - EXPORT_SYMBOL_GPL(rust_helper_blk_mq_rq_to_pdu); 234 - 235 - struct request *rust_helper_blk_mq_rq_from_pdu(void *pdu) 236 - { 237 - return blk_mq_rq_from_pdu(pdu); 238 - } 239 - EXPORT_SYMBOL_GPL(rust_helper_blk_mq_rq_from_pdu);
+16
rust/helpers/blk.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/blk-mq.h> 4 + #include <linux/blkdev.h> 5 + 6 + void *rust_helper_blk_mq_rq_to_pdu(struct request *rq) 7 + { 8 + return blk_mq_rq_to_pdu(rq); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_blk_mq_rq_to_pdu); 11 + 12 + struct request *rust_helper_blk_mq_rq_from_pdu(void *pdu) 13 + { 14 + return blk_mq_rq_from_pdu(pdu); 15 + } 16 + EXPORT_SYMBOL_GPL(rust_helper_blk_mq_rq_from_pdu);
+9
rust/helpers/bug.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/bug.h> 4 + 5 + __noreturn void rust_helper_BUG(void) 6 + { 7 + BUG(); 8 + } 9 + EXPORT_SYMBOL_GPL(rust_helper_BUG);
+25
rust/helpers/build_assert.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/build_bug.h> 4 + 5 + /* 6 + * `bindgen` binds the C `size_t` type as the Rust `usize` type, so we can 7 + * use it in contexts where Rust expects a `usize` like slice (array) indices. 8 + * `usize` is defined to be the same as C's `uintptr_t` type (can hold any 9 + * pointer) but not necessarily the same as `size_t` (can hold the size of any 10 + * single object). Most modern platforms use the same concrete integer type for 11 + * both of them, but in case we find ourselves on a platform where 12 + * that's not true, fail early instead of risking ABI or 13 + * integer-overflow issues. 14 + * 15 + * If your platform fails this assertion, it means that you are in 16 + * danger of integer-overflow bugs (even if you attempt to add 17 + * `--no-size_t-is-usize`). It may be easiest to change the kernel ABI on 18 + * your platform such that `size_t` matches `uintptr_t` (i.e., to increase 19 + * `size_t`, because `uintptr_t` has to be at least as big as `size_t`). 20 + */ 21 + static_assert( 22 + sizeof(size_t) == sizeof(uintptr_t) && 23 + __alignof__(size_t) == __alignof__(uintptr_t), 24 + "Rust code expects C `size_t` to match Rust `usize`" 25 + );
+10
rust/helpers/build_bug.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/errname.h> 5 + 6 + const char *rust_helper_errname(int err) 7 + { 8 + return errname(err); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_errname);
+22
rust/helpers/err.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/err.h> 4 + #include <linux/export.h> 5 + 6 + __force void *rust_helper_ERR_PTR(long err) 7 + { 8 + return ERR_PTR(err); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_ERR_PTR); 11 + 12 + bool rust_helper_IS_ERR(__force const void *ptr) 13 + { 14 + return IS_ERR(ptr); 15 + } 16 + EXPORT_SYMBOL_GPL(rust_helper_IS_ERR); 17 + 18 + long rust_helper_PTR_ERR(__force const void *ptr) 19 + { 20 + return PTR_ERR(ptr); 21 + } 22 + EXPORT_SYMBOL_GPL(rust_helper_PTR_ERR);
+38
rust/helpers/helpers.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + /* 3 + * Non-trivial C macros cannot be used in Rust. Similarly, inlined C functions 4 + * cannot be called either. This file explicitly creates functions ("helpers") 5 + * that wrap those so that they can be called from Rust. 6 + * 7 + * Even though Rust kernel modules should never use the bindings directly, some 8 + * of these helpers need to be exported because Rust generics and inlined 9 + * functions may not get their code generated in the crate where they are 10 + * defined. Other helpers, called from non-inline functions, may not be 11 + * exported, in principle. However, in general, the Rust compiler does not 12 + * guarantee codegen will be performed for a non-inline function either. 13 + * Therefore, this file exports all the helpers. In the future, this may be 14 + * revisited to reduce the number of exports after the compiler is informed 15 + * about the places codegen is required. 16 + * 17 + * All symbols are exported as GPL-only to guarantee no GPL-only feature is 18 + * accidentally exposed. 19 + * 20 + * Sorted alphabetically. 21 + */ 22 + 23 + #include "blk.c" 24 + #include "bug.c" 25 + #include "build_assert.c" 26 + #include "build_bug.c" 27 + #include "err.c" 28 + #include "kunit.c" 29 + #include "mutex.c" 30 + #include "page.c" 31 + #include "refcount.c" 32 + #include "signal.c" 33 + #include "slab.c" 34 + #include "spinlock.c" 35 + #include "task.c" 36 + #include "uaccess.c" 37 + #include "wait.c" 38 + #include "workqueue.c"
+10
rust/helpers/kunit.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <kunit/test-bug.h> 4 + #include <linux/export.h> 5 + 6 + struct kunit *rust_helper_kunit_get_current_test(void) 7 + { 8 + return kunit_get_current_test(); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_kunit_get_current_test);
+10
rust/helpers/mutex.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/mutex.h> 5 + 6 + void rust_helper_mutex_lock(struct mutex *lock) 7 + { 8 + mutex_lock(lock); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_mutex_lock);
+22
rust/helpers/page.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/gfp.h> 4 + #include <linux/highmem.h> 5 + 6 + struct page *rust_helper_alloc_pages(gfp_t gfp_mask, unsigned int order) 7 + { 8 + return alloc_pages(gfp_mask, order); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_alloc_pages); 11 + 12 + void *rust_helper_kmap_local_page(struct page *page) 13 + { 14 + return kmap_local_page(page); 15 + } 16 + EXPORT_SYMBOL_GPL(rust_helper_kmap_local_page); 17 + 18 + void rust_helper_kunmap_local(const void *addr) 19 + { 20 + kunmap_local(addr); 21 + } 22 + EXPORT_SYMBOL_GPL(rust_helper_kunmap_local);
+22
rust/helpers/refcount.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/refcount.h> 5 + 6 + refcount_t rust_helper_REFCOUNT_INIT(int n) 7 + { 8 + return (refcount_t)REFCOUNT_INIT(n); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_REFCOUNT_INIT); 11 + 12 + void rust_helper_refcount_inc(refcount_t *r) 13 + { 14 + refcount_inc(r); 15 + } 16 + EXPORT_SYMBOL_GPL(rust_helper_refcount_inc); 17 + 18 + bool rust_helper_refcount_dec_and_test(refcount_t *r) 19 + { 20 + return refcount_dec_and_test(r); 21 + } 22 + EXPORT_SYMBOL_GPL(rust_helper_refcount_dec_and_test);
+10
rust/helpers/signal.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/sched/signal.h> 5 + 6 + int rust_helper_signal_pending(struct task_struct *t) 7 + { 8 + return signal_pending(t); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_signal_pending);
+10
rust/helpers/slab.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/slab.h> 4 + 5 + void * __must_check __realloc_size(2) 6 + rust_helper_krealloc(const void *objp, size_t new_size, gfp_t flags) 7 + { 8 + return krealloc(objp, new_size, flags); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_krealloc);
+27
rust/helpers/spinlock.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/spinlock.h> 5 + 6 + void rust_helper___spin_lock_init(spinlock_t *lock, const char *name, 7 + struct lock_class_key *key) 8 + { 9 + #ifdef CONFIG_DEBUG_SPINLOCK 10 + __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG); 11 + #else 12 + spin_lock_init(lock); 13 + #endif 14 + } 15 + EXPORT_SYMBOL_GPL(rust_helper___spin_lock_init); 16 + 17 + void rust_helper_spin_lock(spinlock_t *lock) 18 + { 19 + spin_lock(lock); 20 + } 21 + EXPORT_SYMBOL_GPL(rust_helper_spin_lock); 22 + 23 + void rust_helper_spin_unlock(spinlock_t *lock) 24 + { 25 + spin_unlock(lock); 26 + } 27 + EXPORT_SYMBOL_GPL(rust_helper_spin_unlock);
+22
rust/helpers/task.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/sched/task.h> 5 + 6 + struct task_struct *rust_helper_get_current(void) 7 + { 8 + return current; 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_get_current); 11 + 12 + void rust_helper_get_task_struct(struct task_struct *t) 13 + { 14 + get_task_struct(t); 15 + } 16 + EXPORT_SYMBOL_GPL(rust_helper_get_task_struct); 17 + 18 + void rust_helper_put_task_struct(struct task_struct *t) 19 + { 20 + put_task_struct(t); 21 + } 22 + EXPORT_SYMBOL_GPL(rust_helper_put_task_struct);
+17
rust/helpers/uaccess.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/uaccess.h> 4 + 5 + unsigned long rust_helper_copy_from_user(void *to, const void __user *from, 6 + unsigned long n) 7 + { 8 + return copy_from_user(to, from, n); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_copy_from_user); 11 + 12 + unsigned long rust_helper_copy_to_user(void __user *to, const void *from, 13 + unsigned long n) 14 + { 15 + return copy_to_user(to, from, n); 16 + } 17 + EXPORT_SYMBOL_GPL(rust_helper_copy_to_user);
+10
rust/helpers/wait.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/wait.h> 5 + 6 + void rust_helper_init_wait(struct wait_queue_entry *wq_entry) 7 + { 8 + init_wait(wq_entry); 9 + } 10 + EXPORT_SYMBOL_GPL(rust_helper_init_wait);
+16
rust/helpers/workqueue.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/export.h> 4 + #include <linux/workqueue.h> 5 + 6 + void rust_helper_init_work_with_key(struct work_struct *work, work_func_t func, 7 + bool onstack, const char *name, 8 + struct lock_class_key *key) 9 + { 10 + __init_work(work, onstack); 11 + work->data = (atomic_long_t)WORK_DATA_INIT(); 12 + lockdep_init_map(&work->lockdep_map, name, key, 0); 13 + INIT_LIST_HEAD(&work->entry); 14 + work->func = func; 15 + } 16 + EXPORT_SYMBOL_GPL(rust_helper_init_work_with_key);