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: Add cpumask helpers

In order to prepare for adding Rust abstractions for cpumask, add
the required helpers for inline cpumask functions that cannot be
called by rust code directly.

Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Yury Norov [NVIDIA] <yury.norov@gmail.com>

authored by

Viresh Kumar and committed by
Yury Norov
73656765 1e7933a5

+47
+1
rust/bindings/bindings_helper.h
··· 10 10 #include <linux/blk-mq.h> 11 11 #include <linux/blk_types.h> 12 12 #include <linux/blkdev.h> 13 + #include <linux/cpumask.h> 13 14 #include <linux/cred.h> 14 15 #include <linux/device/faux.h> 15 16 #include <linux/errname.h>
+45
rust/helpers/cpumask.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + 3 + #include <linux/cpumask.h> 4 + 5 + void rust_helper_cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp) 6 + { 7 + cpumask_set_cpu(cpu, dstp); 8 + } 9 + 10 + void rust_helper_cpumask_clear_cpu(int cpu, struct cpumask *dstp) 11 + { 12 + cpumask_clear_cpu(cpu, dstp); 13 + } 14 + 15 + void rust_helper_cpumask_setall(struct cpumask *dstp) 16 + { 17 + cpumask_setall(dstp); 18 + } 19 + 20 + unsigned int rust_helper_cpumask_weight(struct cpumask *srcp) 21 + { 22 + return cpumask_weight(srcp); 23 + } 24 + 25 + void rust_helper_cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp) 26 + { 27 + cpumask_copy(dstp, srcp); 28 + } 29 + 30 + bool rust_helper_alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) 31 + { 32 + return alloc_cpumask_var(mask, flags); 33 + } 34 + 35 + bool rust_helper_zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags) 36 + { 37 + return zalloc_cpumask_var(mask, flags); 38 + } 39 + 40 + #ifndef CONFIG_CPUMASK_OFFSTACK 41 + void rust_helper_free_cpumask_var(cpumask_var_t mask) 42 + { 43 + free_cpumask_var(mask); 44 + } 45 + #endif
+1
rust/helpers/helpers.c
··· 11 11 #include "bug.c" 12 12 #include "build_assert.c" 13 13 #include "build_bug.c" 14 + #include "cpumask.c" 14 15 #include "cred.c" 15 16 #include "device.c" 16 17 #include "err.c"