Resguardo inicial

This commit is contained in:
lastdragon
2026-09-06 12:53:21 -06:00
parent 662efe3c2a
commit ad2088d178
94853 changed files with 43200404 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/acpi.h>
#include <acpi/acpi_bus.h>
__rust_helper bool rust_helper_acpi_of_match_device(const struct acpi_device *adev,
const struct of_device_id *of_match_table,
const struct of_device_id **of_id)
{
return acpi_of_match_device(adev, of_match_table, of_id);
}
__rust_helper struct acpi_device *rust_helper_to_acpi_device_node(struct fwnode_handle *fwnode)
{
return to_acpi_device_node(fwnode);
}
File diff suppressed because it is too large Load Diff
+87
View File
@@ -0,0 +1,87 @@
// SPDX-License-Identifier: GPL-2.0
#include <asm/barrier.h>
#include <asm/rwonce.h>
#include <linux/atomic.h>
#define GEN_READ_HELPER(tname, type) \
__rust_helper type rust_helper_atomic_##tname##_read(type *ptr) \
{ \
return READ_ONCE(*ptr); \
}
#define GEN_SET_HELPER(tname, type) \
__rust_helper void rust_helper_atomic_##tname##_set(type *ptr, type val) \
{ \
WRITE_ONCE(*ptr, val); \
}
#define GEN_READ_ACQUIRE_HELPER(tname, type) \
__rust_helper type rust_helper_atomic_##tname##_read_acquire(type *ptr) \
{ \
return smp_load_acquire(ptr); \
}
#define GEN_SET_RELEASE_HELPER(tname, type) \
__rust_helper void rust_helper_atomic_##tname##_set_release(type *ptr, type val)\
{ \
smp_store_release(ptr, val); \
}
#define GEN_READ_SET_HELPERS(tname, type) \
GEN_READ_HELPER(tname, type) \
GEN_SET_HELPER(tname, type) \
GEN_READ_ACQUIRE_HELPER(tname, type) \
GEN_SET_RELEASE_HELPER(tname, type) \
GEN_READ_SET_HELPERS(i8, s8)
GEN_READ_SET_HELPERS(i16, s16)
GEN_READ_SET_HELPERS(ptr, const void *)
/*
* xchg helpers depend on ARCH_SUPPORTS_ATOMIC_RMW and on the
* architecture provding xchg() support for i8 and i16.
*
* The architectures that currently support Rust (x86_64, armv7,
* arm64, riscv, and loongarch) satisfy these requirements.
*/
#define GEN_XCHG_HELPER(tname, type, suffix) \
__rust_helper type \
rust_helper_atomic_##tname##_xchg##suffix(type *ptr, type new) \
{ \
return xchg##suffix(ptr, new); \
}
#define GEN_XCHG_HELPERS(tname, type) \
GEN_XCHG_HELPER(tname, type, ) \
GEN_XCHG_HELPER(tname, type, _acquire) \
GEN_XCHG_HELPER(tname, type, _release) \
GEN_XCHG_HELPER(tname, type, _relaxed) \
GEN_XCHG_HELPERS(i8, s8)
GEN_XCHG_HELPERS(i16, s16)
GEN_XCHG_HELPERS(ptr, const void *)
/*
* try_cmpxchg helpers depend on ARCH_SUPPORTS_ATOMIC_RMW and on the
* architecture provding try_cmpxchg() support for i8 and i16.
*
* The architectures that currently support Rust (x86_64, armv7,
* arm64, riscv, and loongarch) satisfy these requirements.
*/
#define GEN_TRY_CMPXCHG_HELPER(tname, type, suffix) \
__rust_helper bool \
rust_helper_atomic_##tname##_try_cmpxchg##suffix(type *ptr, type *old, type new)\
{ \
return try_cmpxchg##suffix(ptr, old, new); \
}
#define GEN_TRY_CMPXCHG_HELPERS(tname, type) \
GEN_TRY_CMPXCHG_HELPER(tname, type, ) \
GEN_TRY_CMPXCHG_HELPER(tname, type, _acquire) \
GEN_TRY_CMPXCHG_HELPER(tname, type, _release) \
GEN_TRY_CMPXCHG_HELPER(tname, type, _relaxed) \
GEN_TRY_CMPXCHG_HELPERS(i8, s8)
GEN_TRY_CMPXCHG_HELPERS(i16, s16)
GEN_TRY_CMPXCHG_HELPERS(ptr, const void *)
+15
View File
@@ -0,0 +1,15 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/auxiliary_bus.h>
__rust_helper void
rust_helper_auxiliary_device_uninit(struct auxiliary_device *adev)
{
return auxiliary_device_uninit(adev);
}
__rust_helper void
rust_helper_auxiliary_device_delete(struct auxiliary_device *adev)
{
return auxiliary_device_delete(adev);
}
+18
View File
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-2.0
#include <asm/barrier.h>
__rust_helper void rust_helper_smp_mb(void)
{
smp_mb();
}
__rust_helper void rust_helper_smp_wmb(void)
{
smp_wmb();
}
__rust_helper void rust_helper_smp_rmb(void)
{
smp_rmb();
}
+27
View File
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2025 Google LLC.
*/
#include <linux/list_lru.h>
#include <linux/task_work.h>
__rust_helper unsigned long rust_helper_list_lru_count(struct list_lru *lru)
{
return list_lru_count(lru);
}
__rust_helper unsigned long rust_helper_list_lru_walk(struct list_lru *lru,
list_lru_walk_cb isolate,
void *cb_arg,
unsigned long nr_to_walk)
{
return list_lru_walk(lru, isolate, cb_arg, nr_to_walk);
}
__rust_helper void rust_helper_init_task_work(struct callback_head *twork,
task_work_func_t func)
{
init_task_work(twork, func);
}
+10
View File
@@ -0,0 +1,10 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/bitmap.h>
__rust_helper
void rust_helper_bitmap_copy_and_extend(unsigned long *to, const unsigned long *from,
unsigned int count, unsigned int size)
{
bitmap_copy_and_extend(to, from, count, size);
}
+69
View File
@@ -0,0 +1,69 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/bitops.h>
#include <linux/find.h>
__rust_helper
void rust_helper___set_bit(unsigned long nr, unsigned long *addr)
{
__set_bit(nr, addr);
}
__rust_helper
void rust_helper___clear_bit(unsigned long nr, unsigned long *addr)
{
__clear_bit(nr, addr);
}
__rust_helper
void rust_helper_set_bit(unsigned long nr, volatile unsigned long *addr)
{
set_bit(nr, addr);
}
__rust_helper
void rust_helper_clear_bit(unsigned long nr, volatile unsigned long *addr)
{
clear_bit(nr, addr);
}
/*
* The rust_helper_ prefix is intentionally omitted below so that the
* declarations in include/linux/find.h are compatible with these helpers.
*
* Note that the below #ifdefs mean that the helper is only created if C does
* not provide a definition.
*/
#ifdef find_first_zero_bit
__rust_helper
unsigned long _find_first_zero_bit(const unsigned long *p, unsigned long size)
{
return find_first_zero_bit(p, size);
}
#endif /* find_first_zero_bit */
#ifdef find_next_zero_bit
__rust_helper
unsigned long _find_next_zero_bit(const unsigned long *addr,
unsigned long size, unsigned long offset)
{
return find_next_zero_bit(addr, size, offset);
}
#endif /* find_next_zero_bit */
#ifdef find_first_bit
__rust_helper
unsigned long _find_first_bit(const unsigned long *addr, unsigned long size)
{
return find_first_bit(addr, size);
}
#endif /* find_first_bit */
#ifdef find_next_bit
__rust_helper
unsigned long _find_next_bit(const unsigned long *addr, unsigned long size,
unsigned long offset)
{
return find_next_bit(addr, size, offset);
}
#endif /* find_next_bit */
+14
View File
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/blk-mq.h>
#include <linux/blkdev.h>
__rust_helper void *rust_helper_blk_mq_rq_to_pdu(struct request *rq)
{
return blk_mq_rq_to_pdu(rq);
}
__rust_helper struct request *rust_helper_blk_mq_rq_from_pdu(void *pdu)
{
return blk_mq_rq_from_pdu(pdu);
}
+13
View File
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/bug.h>
__rust_helper __noreturn void rust_helper_BUG(void)
{
BUG();
}
__rust_helper bool rust_helper_WARN_ON(bool cond)
{
return WARN_ON(cond);
}
+25
View File
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/build_bug.h>
/*
* `bindgen` binds the C `size_t` type as the Rust `usize` type, so we can
* use it in contexts where Rust expects a `usize` like slice (array) indices.
* `usize` is defined to be the same as C's `uintptr_t` type (can hold any
* pointer) but not necessarily the same as `size_t` (can hold the size of any
* single object). Most modern platforms use the same concrete integer type for
* both of them, but in case we find ourselves on a platform where
* that's not true, fail early instead of risking ABI or
* integer-overflow issues.
*
* If your platform fails this assertion, it means that you are in
* danger of integer-overflow bugs (even if you attempt to add
* `--no-size_t-is-usize`). It may be easiest to change the kernel ABI on
* your platform such that `size_t` matches `uintptr_t` (i.e., to increase
* `size_t`, because `uintptr_t` has to be at least as big as `size_t`).
*/
static_assert(
sizeof(size_t) == sizeof(uintptr_t) &&
__alignof__(size_t) == __alignof__(uintptr_t),
"Rust code expects C `size_t` to match Rust `usize`"
);
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/errname.h>
__rust_helper const char *rust_helper_errname(int err)
{
return errname(err);
}
+68
View File
@@ -0,0 +1,68 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/clk.h>
/*
* The "inline" implementation of below helpers are only available when
* CONFIG_HAVE_CLK or CONFIG_HAVE_CLK_PREPARE aren't set.
*/
#ifndef CONFIG_HAVE_CLK
__rust_helper struct clk *rust_helper_clk_get(struct device *dev,
const char *id)
{
return clk_get(dev, id);
}
__rust_helper void rust_helper_clk_put(struct clk *clk)
{
clk_put(clk);
}
__rust_helper int rust_helper_clk_enable(struct clk *clk)
{
return clk_enable(clk);
}
__rust_helper void rust_helper_clk_disable(struct clk *clk)
{
clk_disable(clk);
}
__rust_helper unsigned long rust_helper_clk_get_rate(struct clk *clk)
{
return clk_get_rate(clk);
}
__rust_helper int rust_helper_clk_set_rate(struct clk *clk, unsigned long rate)
{
return clk_set_rate(clk, rate);
}
#endif
#ifndef CONFIG_HAVE_CLK_PREPARE
__rust_helper int rust_helper_clk_prepare(struct clk *clk)
{
return clk_prepare(clk);
}
__rust_helper void rust_helper_clk_unprepare(struct clk *clk)
{
clk_unprepare(clk);
}
#endif
__rust_helper struct clk *rust_helper_clk_get_optional(struct device *dev,
const char *id)
{
return clk_get_optional(dev, id);
}
__rust_helper int rust_helper_clk_prepare_enable(struct clk *clk)
{
return clk_prepare_enable(clk);
}
__rust_helper void rust_helper_clk_disable_unprepare(struct clk *clk)
{
clk_disable_unprepare(clk);
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/completion.h>
__rust_helper void rust_helper_init_completion(struct completion *x)
{
init_completion(x);
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/smp.h>
__rust_helper unsigned int rust_helper_raw_smp_processor_id(void)
{
return raw_smp_processor_id();
}
+11
View File
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/cpufreq.h>
#ifdef CONFIG_CPU_FREQ
__rust_helper void
rust_helper_cpufreq_register_em_with_opp(struct cpufreq_policy *policy)
{
cpufreq_register_em_with_opp(policy);
}
#endif
+83
View File
@@ -0,0 +1,83 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/cpumask.h>
__rust_helper
void rust_helper_cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
{
cpumask_set_cpu(cpu, dstp);
}
__rust_helper
void rust_helper___cpumask_set_cpu(unsigned int cpu, struct cpumask *dstp)
{
__cpumask_set_cpu(cpu, dstp);
}
__rust_helper
void rust_helper_cpumask_clear_cpu(int cpu, struct cpumask *dstp)
{
cpumask_clear_cpu(cpu, dstp);
}
__rust_helper
void rust_helper___cpumask_clear_cpu(int cpu, struct cpumask *dstp)
{
__cpumask_clear_cpu(cpu, dstp);
}
__rust_helper
bool rust_helper_cpumask_test_cpu(int cpu, struct cpumask *srcp)
{
return cpumask_test_cpu(cpu, srcp);
}
__rust_helper
void rust_helper_cpumask_setall(struct cpumask *dstp)
{
cpumask_setall(dstp);
}
__rust_helper
bool rust_helper_cpumask_empty(struct cpumask *srcp)
{
return cpumask_empty(srcp);
}
__rust_helper
bool rust_helper_cpumask_full(struct cpumask *srcp)
{
return cpumask_full(srcp);
}
__rust_helper
unsigned int rust_helper_cpumask_weight(struct cpumask *srcp)
{
return cpumask_weight(srcp);
}
__rust_helper
void rust_helper_cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp)
{
cpumask_copy(dstp, srcp);
}
__rust_helper
bool rust_helper_alloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
{
return alloc_cpumask_var(mask, flags);
}
__rust_helper
bool rust_helper_zalloc_cpumask_var(cpumask_var_t *mask, gfp_t flags)
{
return zalloc_cpumask_var(mask, flags);
}
#ifndef CONFIG_CPUMASK_OFFSTACK
__rust_helper
void rust_helper_free_cpumask_var(cpumask_var_t mask)
{
free_cpumask_var(mask);
}
#endif
+13
View File
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/cred.h>
__rust_helper const struct cred *rust_helper_get_cred(const struct cred *cred)
{
return get_cred(cred);
}
__rust_helper void rust_helper_put_cred(const struct cred *cred)
{
put_cred(cred);
}
+32
View File
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/device.h>
__rust_helper int rust_helper_devm_add_action(struct device *dev,
void (*action)(void *),
void *data)
{
return devm_add_action(dev, action, data);
}
__rust_helper int rust_helper_devm_add_action_or_reset(struct device *dev,
void (*action)(void *),
void *data)
{
return devm_add_action_or_reset(dev, action, data);
}
__rust_helper void *rust_helper_dev_get_drvdata(const struct device *dev)
{
return dev_get_drvdata(dev);
}
__rust_helper void rust_helper_dev_set_drvdata(struct device *dev, void *data)
{
dev_set_drvdata(dev, data);
}
__rust_helper const char *rust_helper_dev_name(const struct device *dev)
{
return dev_name(dev);
}
+14
View File
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/dma-resv.h>
__rust_helper
int rust_helper_dma_resv_lock(struct dma_resv *obj, struct ww_acquire_ctx *ctx)
{
return dma_resv_lock(obj, ctx);
}
__rust_helper void rust_helper_dma_resv_unlock(struct dma_resv *obj)
{
dma_resv_unlock(obj);
}
+51
View File
@@ -0,0 +1,51 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/dma-mapping.h>
__rust_helper void *rust_helper_dma_alloc_attrs(struct device *dev, size_t size,
dma_addr_t *dma_handle,
gfp_t flag, unsigned long attrs)
{
return dma_alloc_attrs(dev, size, dma_handle, flag, attrs);
}
__rust_helper void rust_helper_dma_free_attrs(struct device *dev, size_t size,
void *cpu_addr,
dma_addr_t dma_handle,
unsigned long attrs)
{
dma_free_attrs(dev, size, cpu_addr, dma_handle, attrs);
}
__rust_helper int rust_helper_dma_set_mask_and_coherent(struct device *dev,
u64 mask)
{
return dma_set_mask_and_coherent(dev, mask);
}
__rust_helper int rust_helper_dma_set_mask(struct device *dev, u64 mask)
{
return dma_set_mask(dev, mask);
}
__rust_helper int rust_helper_dma_set_coherent_mask(struct device *dev, u64 mask)
{
return dma_set_coherent_mask(dev, mask);
}
__rust_helper int rust_helper_dma_map_sgtable(struct device *dev, struct sg_table *sgt,
enum dma_data_direction dir, unsigned long attrs)
{
return dma_map_sgtable(dev, sgt, dir, attrs);
}
__rust_helper size_t rust_helper_dma_max_mapping_size(struct device *dev)
{
return dma_max_mapping_size(dev);
}
__rust_helper void rust_helper_dma_set_max_seg_size(struct device *dev,
unsigned int size)
{
dma_set_max_seg_size(dev, size);
}
+78
View File
@@ -0,0 +1,78 @@
// SPDX-License-Identifier: GPL-2.0
#include <drm/drm_gem.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_vma_manager.h>
#ifdef CONFIG_DRM
__rust_helper void rust_helper_drm_gem_object_get(struct drm_gem_object *obj)
{
drm_gem_object_get(obj);
}
__rust_helper void rust_helper_drm_gem_object_put(struct drm_gem_object *obj)
{
drm_gem_object_put(obj);
}
__rust_helper __u64
rust_helper_drm_vma_node_offset_addr(struct drm_vma_offset_node *node)
{
return drm_vma_node_offset_addr(node);
}
#ifdef CONFIG_DRM_GEM_SHMEM_HELPER
__rust_helper void
rust_helper_drm_gem_shmem_object_free(struct drm_gem_object *obj)
{
return drm_gem_shmem_object_free(obj);
}
__rust_helper void
rust_helper_drm_gem_shmem_object_print_info(struct drm_printer *p, unsigned int indent,
const struct drm_gem_object *obj)
{
drm_gem_shmem_object_print_info(p, indent, obj);
}
__rust_helper int
rust_helper_drm_gem_shmem_object_pin(struct drm_gem_object *obj)
{
return drm_gem_shmem_object_pin(obj);
}
__rust_helper void
rust_helper_drm_gem_shmem_object_unpin(struct drm_gem_object *obj)
{
drm_gem_shmem_object_unpin(obj);
}
__rust_helper struct sg_table *
rust_helper_drm_gem_shmem_object_get_sg_table(struct drm_gem_object *obj)
{
return drm_gem_shmem_object_get_sg_table(obj);
}
__rust_helper int
rust_helper_drm_gem_shmem_object_vmap(struct drm_gem_object *obj,
struct iosys_map *map)
{
return drm_gem_shmem_object_vmap(obj, map);
}
__rust_helper void
rust_helper_drm_gem_shmem_object_vunmap(struct drm_gem_object *obj,
struct iosys_map *map)
{
drm_gem_shmem_object_vunmap(obj, map);
}
__rust_helper int
rust_helper_drm_gem_shmem_object_mmap(struct drm_gem_object *obj, struct vm_area_struct *vma)
{
return drm_gem_shmem_object_mmap(obj, vma);
}
#endif /* CONFIG_DRM_GEM_SHMEM_HELPER */
#endif /* CONFIG_DRM */
+26
View File
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-2.0 or MIT
#ifdef CONFIG_RUST_DRM_GPUVM
#include <drm/drm_gpuvm.h>
__rust_helper
struct drm_gpuvm_bo *rust_helper_drm_gpuvm_bo_get(struct drm_gpuvm_bo *vm_bo)
{
return drm_gpuvm_bo_get(vm_bo);
}
__rust_helper
struct drm_gpuvm *rust_helper_drm_gpuvm_get(struct drm_gpuvm *obj)
{
return drm_gpuvm_get(obj);
}
__rust_helper
bool rust_helper_drm_gpuvm_is_extobj(struct drm_gpuvm *gpuvm,
struct drm_gem_object *obj)
{
return drm_gpuvm_is_extobj(gpuvm, obj);
}
#endif // CONFIG_RUST_DRM_GPUVM
+18
View File
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/err.h>
__rust_helper __force void *rust_helper_ERR_PTR(long err)
{
return ERR_PTR(err);
}
__rust_helper bool rust_helper_IS_ERR(__force const void *ptr)
{
return IS_ERR(ptr);
}
__rust_helper long rust_helper_PTR_ERR(__force const void *ptr)
{
return PTR_ERR(ptr);
}
+12
View File
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2024 Google LLC.
*/
#include <linux/fs.h>
__rust_helper struct file *rust_helper_get_file(struct file *f)
{
return get_file(f);
}
+17
View File
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/gpu_buddy.h>
#ifdef CONFIG_GPU_BUDDY
__rust_helper u64 rust_helper_gpu_buddy_block_offset(const struct gpu_buddy_block *block)
{
return gpu_buddy_block_offset(block);
}
__rust_helper unsigned int rust_helper_gpu_buddy_block_order(struct gpu_buddy_block *block)
{
return gpu_buddy_block_order(block);
}
#endif /* CONFIG_GPU_BUDDY */
+102
View File
@@ -0,0 +1,102 @@
// 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.
*
* Sorted alphabetically.
*/
#include <linux/compiler_types.h>
#ifdef __BINDGEN__
// Omit `inline` for bindgen as it ignores inline functions.
#define __rust_helper
#else
// The helper functions are all inline functions.
//
// We use `__always_inline` here to bypass LLVM inlining checks, in case the
// helpers are inlined directly into Rust CGUs.
//
// The LLVM inlining checks are false positives:
// * LLVM doesn't want to inline functions compiled with
// `-fno-delete-null-pointer-checks` with code compiled without.
// The C CGUs all have this enabled and Rust CGUs don't. Inlining is okay
// since this is one of the hardening features that does not change the ABI,
// and we shouldn't have null pointer dereferences in these helpers.
// * LLVM doesn't want to inline functions with different list of builtins. C
// side has `-fno-builtin-wcslen`; `wcslen` is not a Rust builtin, so they
// should be compatible, but LLVM does not perform inlining due to attributes
// mismatch.
// * clang and Rust doesn't have the exact target string. Clang generates
// `+cmov,+cx8,+fxsr` but Rust doesn't enable them (in fact, Rust will
// complain if `-Ctarget-feature=+cmov,+cx8,+fxsr` is used). x86-64 always
// enable these features, so they are in fact the same target string, but
// LLVM doesn't understand this and so inlining is inhibited. This can be
// bypassed with `--ignore-tti-inline-compatible`, but this is a hidden
// option.
#define __rust_helper __always_inline
#endif
#include "acpi.c"
#include "atomic.c"
#include "atomic_ext.c"
#include "auxiliary.c"
#include "barrier.c"
#include "binder.c"
#include "bitmap.c"
#include "bitops.c"
#include "blk.c"
#include "bug.c"
#include "build_assert.c"
#include "build_bug.c"
#include "clk.c"
#include "completion.c"
#include "cpu.c"
#include "cpufreq.c"
#include "cpumask.c"
#include "cred.c"
#include "device.c"
#include "dma.c"
#include "dma-resv.c"
#include "drm.c"
#include "drm_gpuvm.c"
#include "err.c"
#include "irq.c"
#include "fs.c"
#include "gpu.c"
#include "io.c"
#include "jump_label.c"
#include "kunit.c"
#include "list.c"
#include "maple_tree.c"
#include "mm.c"
#include "mutex.c"
#include "of.c"
#include "page.c"
#include "pci.c"
#include "pid_namespace.c"
#include "platform.c"
#include "poll.c"
#include "processor.c"
#include "property.c"
#include "pwm.c"
#include "rbtree.c"
#include "rcu.c"
#include "refcount.c"
#include "regulator.c"
#include "scatterlist.c"
#include "security.c"
#include "signal.c"
#include "slab.c"
#include "spinlock.c"
#include "string.c"
#include "sync.c"
#include "task.c"
#include "time.c"
#include "uaccess.c"
#include "usb.c"
#include "vmalloc.c"
#include "wait.c"
#include "workqueue.c"
#include "xarray.c"
+148
View File
@@ -0,0 +1,148 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/io.h>
#include <linux/ioport.h>
#ifdef CONFIG_HAS_IOMEM
__rust_helper void __iomem *rust_helper_ioremap(phys_addr_t offset, size_t size)
{
return ioremap(offset, size);
}
__rust_helper void __iomem *rust_helper_ioremap_np(phys_addr_t offset,
size_t size)
{
return ioremap_np(offset, size);
}
__rust_helper void rust_helper_iounmap(void __iomem *addr)
{
iounmap(addr);
}
#endif /* CONFIG_HAS_IOMEM */
__rust_helper u8 rust_helper_readb(const void __iomem *addr)
{
return readb(addr);
}
__rust_helper u16 rust_helper_readw(const void __iomem *addr)
{
return readw(addr);
}
__rust_helper u32 rust_helper_readl(const void __iomem *addr)
{
return readl(addr);
}
#ifdef CONFIG_64BIT
__rust_helper u64 rust_helper_readq(const void __iomem *addr)
{
return readq(addr);
}
#endif
__rust_helper void rust_helper_writeb(u8 value, void __iomem *addr)
{
writeb(value, addr);
}
__rust_helper void rust_helper_writew(u16 value, void __iomem *addr)
{
writew(value, addr);
}
__rust_helper void rust_helper_writel(u32 value, void __iomem *addr)
{
writel(value, addr);
}
#ifdef CONFIG_64BIT
__rust_helper void rust_helper_writeq(u64 value, void __iomem *addr)
{
writeq(value, addr);
}
#endif
__rust_helper u8 rust_helper_readb_relaxed(const void __iomem *addr)
{
return readb_relaxed(addr);
}
__rust_helper u16 rust_helper_readw_relaxed(const void __iomem *addr)
{
return readw_relaxed(addr);
}
__rust_helper u32 rust_helper_readl_relaxed(const void __iomem *addr)
{
return readl_relaxed(addr);
}
#ifdef CONFIG_64BIT
__rust_helper u64 rust_helper_readq_relaxed(const void __iomem *addr)
{
return readq_relaxed(addr);
}
#endif
__rust_helper void rust_helper_writeb_relaxed(u8 value, void __iomem *addr)
{
writeb_relaxed(value, addr);
}
__rust_helper void rust_helper_writew_relaxed(u16 value, void __iomem *addr)
{
writew_relaxed(value, addr);
}
__rust_helper void rust_helper_writel_relaxed(u32 value, void __iomem *addr)
{
writel_relaxed(value, addr);
}
#ifdef CONFIG_64BIT
__rust_helper void rust_helper_writeq_relaxed(u64 value, void __iomem *addr)
{
writeq_relaxed(value, addr);
}
#endif
__rust_helper resource_size_t rust_helper_resource_size(struct resource *res)
{
return resource_size(res);
}
__rust_helper struct resource *
rust_helper_request_mem_region(resource_size_t start, resource_size_t n,
const char *name)
{
return request_mem_region(start, n, name);
}
__rust_helper void rust_helper_release_mem_region(resource_size_t start,
resource_size_t n)
{
release_mem_region(start, n);
}
__rust_helper struct resource *rust_helper_request_region(resource_size_t start,
resource_size_t n,
const char *name)
{
return request_region(start, n, name);
}
__rust_helper struct resource *
rust_helper_request_muxed_region(resource_size_t start, resource_size_t n,
const char *name)
{
return request_muxed_region(start, n, name);
}
__rust_helper void rust_helper_release_region(resource_size_t start,
resource_size_t n)
{
release_region(start, n);
}
+11
View File
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/interrupt.h>
__rust_helper int rust_helper_request_irq(unsigned int irq,
irq_handler_t handler,
unsigned long flags, const char *name,
void *dev)
{
return request_irq(irq, handler, flags, name, dev);
}
+14
View File
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2024 Google LLC.
*/
#include <linux/jump_label.h>
#ifndef CONFIG_JUMP_LABEL
__rust_helper int rust_helper_static_key_count(struct static_key *key)
{
return static_key_count(key);
}
#endif
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <kunit/test-bug.h>
__rust_helper struct kunit *rust_helper_kunit_get_current_test(void)
{
return kunit_get_current_test();
}
+17
View File
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
/*
* Helpers for C circular doubly linked list implementation.
*/
#include <linux/list.h>
__rust_helper void rust_helper_INIT_LIST_HEAD(struct list_head *list)
{
INIT_LIST_HEAD(list);
}
__rust_helper void rust_helper_list_add_tail(struct list_head *new, struct list_head *head)
{
list_add_tail(new, head);
}
+9
View File
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/maple_tree.h>
__rust_helper void rust_helper_mt_init_flags(struct maple_tree *mt,
unsigned int flags)
{
mt_init_flags(mt, flags);
}
+50
View File
@@ -0,0 +1,50 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/mm.h>
#include <linux/sched/mm.h>
__rust_helper void rust_helper_mmgrab(struct mm_struct *mm)
{
mmgrab(mm);
}
__rust_helper void rust_helper_mmdrop(struct mm_struct *mm)
{
mmdrop(mm);
}
__rust_helper void rust_helper_mmget(struct mm_struct *mm)
{
mmget(mm);
}
__rust_helper bool rust_helper_mmget_not_zero(struct mm_struct *mm)
{
return mmget_not_zero(mm);
}
__rust_helper void rust_helper_mmap_read_lock(struct mm_struct *mm)
{
mmap_read_lock(mm);
}
__rust_helper bool rust_helper_mmap_read_trylock(struct mm_struct *mm)
{
return mmap_read_trylock(mm);
}
__rust_helper void rust_helper_mmap_read_unlock(struct mm_struct *mm)
{
mmap_read_unlock(mm);
}
__rust_helper struct vm_area_struct *
rust_helper_vma_lookup(struct mm_struct *mm, unsigned long addr)
{
return vma_lookup(mm, addr);
}
__rust_helper void rust_helper_vma_end_read(struct vm_area_struct *vma)
{
vma_end_read(vma);
}
+30
View File
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/mutex.h>
__rust_helper void rust_helper_mutex_lock(struct mutex *lock)
{
mutex_lock(lock);
}
__rust_helper int rust_helper_mutex_trylock(struct mutex *lock)
{
return mutex_trylock(lock);
}
__rust_helper void rust_helper___mutex_init(struct mutex *mutex,
const char *name,
struct lock_class_key *key)
{
__mutex_init(mutex, name, key);
}
__rust_helper void rust_helper_mutex_assert_is_held(struct mutex *mutex)
{
lockdep_assert_held(mutex);
}
__rust_helper void rust_helper_mutex_destroy(struct mutex *lock)
{
mutex_destroy(lock);
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/of.h>
__rust_helper bool rust_helper_is_of_node(const struct fwnode_handle *fwnode)
{
return is_of_node(fwnode);
}
+28
View File
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/gfp.h>
#include <linux/highmem.h>
#include <linux/mm.h>
__rust_helper struct page *rust_helper_alloc_pages(gfp_t gfp_mask,
unsigned int order)
{
return alloc_pages(gfp_mask, order);
}
__rust_helper void *rust_helper_kmap_local_page(struct page *page)
{
return kmap_local_page(page);
}
__rust_helper void rust_helper_kunmap_local(const void *addr)
{
kunmap_local(addr);
}
#ifndef NODE_NOT_IN_PAGE_FLAGS
__rust_helper int rust_helper_page_to_nid(const struct page *page)
{
return page_to_nid(page);
}
#endif
+46
View File
@@ -0,0 +1,46 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/pci.h>
__rust_helper u16 rust_helper_pci_dev_id(struct pci_dev *dev)
{
return PCI_DEVID(dev->bus->number, dev->devfn);
}
__rust_helper resource_size_t
rust_helper_pci_resource_start(struct pci_dev *pdev, int bar)
{
return pci_resource_start(pdev, bar);
}
__rust_helper resource_size_t rust_helper_pci_resource_len(struct pci_dev *pdev,
int bar)
{
return pci_resource_len(pdev, bar);
}
__rust_helper bool rust_helper_dev_is_pci(const struct device *dev)
{
return dev_is_pci(dev);
}
#ifndef CONFIG_PCI_MSI
__rust_helper int rust_helper_pci_alloc_irq_vectors(struct pci_dev *dev,
unsigned int min_vecs,
unsigned int max_vecs,
unsigned int flags)
{
return pci_alloc_irq_vectors(dev, min_vecs, max_vecs, flags);
}
__rust_helper void rust_helper_pci_free_irq_vectors(struct pci_dev *dev)
{
pci_free_irq_vectors(dev);
}
__rust_helper int rust_helper_pci_irq_vector(struct pci_dev *pdev,
unsigned int nvec)
{
return pci_irq_vector(pdev, nvec);
}
#endif
+28
View File
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/pid_namespace.h>
#include <linux/cleanup.h>
__rust_helper struct pid_namespace *
rust_helper_get_pid_ns(struct pid_namespace *ns)
{
return get_pid_ns(ns);
}
__rust_helper void rust_helper_put_pid_ns(struct pid_namespace *ns)
{
put_pid_ns(ns);
}
/* Get a reference on a task's pid namespace. */
__rust_helper struct pid_namespace *
rust_helper_task_get_pid_ns(struct task_struct *task)
{
struct pid_namespace *pid_ns;
guard(rcu)();
pid_ns = task_active_pid_ns(task);
if (pid_ns)
get_pid_ns(pid_ns);
return pid_ns;
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/platform_device.h>
__rust_helper bool rust_helper_dev_is_platform(const struct device *dev)
{
return dev_is_platform(dev);
}
+11
View File
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/export.h>
#include <linux/poll.h>
__rust_helper void rust_helper_poll_wait(struct file *filp,
wait_queue_head_t *wait_address,
poll_table *p)
{
poll_wait(filp, wait_address, p);
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/processor.h>
__rust_helper void rust_helper_cpu_relax(void)
{
cpu_relax();
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/property.h>
__rust_helper void rust_helper_fwnode_handle_put(struct fwnode_handle *fwnode)
{
fwnode_handle_put(fwnode);
}
+20
View File
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2025 Samsung Electronics Co., Ltd.
// Author: Michal Wilczynski <m.wilczynski@samsung.com>
#include <linux/pwm.h>
__rust_helper struct device *rust_helper_pwmchip_parent(const struct pwm_chip *chip)
{
return pwmchip_parent(chip);
}
__rust_helper void *rust_helper_pwmchip_get_drvdata(struct pwm_chip *chip)
{
return pwmchip_get_drvdata(chip);
}
__rust_helper void rust_helper_pwmchip_set_drvdata(struct pwm_chip *chip, void *data)
{
pwmchip_set_drvdata(chip, data);
}
+20
View File
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/rbtree.h>
__rust_helper void rust_helper_rb_link_node(struct rb_node *node,
struct rb_node *parent,
struct rb_node **rb_link)
{
rb_link_node(node, parent, rb_link);
}
__rust_helper struct rb_node *rust_helper_rb_first(const struct rb_root *root)
{
return rb_first(root);
}
__rust_helper struct rb_node *rust_helper_rb_last(const struct rb_root *root)
{
return rb_last(root);
}
+13
View File
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/rcupdate.h>
__rust_helper void rust_helper_rcu_read_lock(void)
{
rcu_read_lock();
}
__rust_helper void rust_helper_rcu_read_unlock(void)
{
rcu_read_unlock();
}
+28
View File
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/refcount.h>
__rust_helper refcount_t rust_helper_REFCOUNT_INIT(int n)
{
return (refcount_t)REFCOUNT_INIT(n);
}
__rust_helper void rust_helper_refcount_set(refcount_t *r, int n)
{
refcount_set(r, n);
}
__rust_helper void rust_helper_refcount_inc(refcount_t *r)
{
refcount_inc(r);
}
__rust_helper void rust_helper_refcount_dec(refcount_t *r)
{
refcount_dec(r);
}
__rust_helper bool rust_helper_refcount_dec_and_test(refcount_t *r)
{
return refcount_dec_and_test(r);
}
+57
View File
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/regulator/consumer.h>
#ifndef CONFIG_REGULATOR
__rust_helper void rust_helper_regulator_put(struct regulator *regulator)
{
regulator_put(regulator);
}
__rust_helper int rust_helper_regulator_set_voltage(struct regulator *regulator,
int min_uV, int max_uV)
{
return regulator_set_voltage(regulator, min_uV, max_uV);
}
__rust_helper int rust_helper_regulator_get_voltage(struct regulator *regulator)
{
return regulator_get_voltage(regulator);
}
__rust_helper struct regulator *rust_helper_regulator_get(struct device *dev,
const char *id)
{
return regulator_get(dev, id);
}
__rust_helper int rust_helper_regulator_enable(struct regulator *regulator)
{
return regulator_enable(regulator);
}
__rust_helper int rust_helper_regulator_disable(struct regulator *regulator)
{
return regulator_disable(regulator);
}
__rust_helper int rust_helper_regulator_is_enabled(struct regulator *regulator)
{
return regulator_is_enabled(regulator);
}
__rust_helper int rust_helper_devm_regulator_get_enable(struct device *dev,
const char *id)
{
return devm_regulator_get_enable(dev, id);
}
__rust_helper int
rust_helper_devm_regulator_get_enable_optional(struct device *dev,
const char *id)
{
return devm_regulator_get_enable_optional(dev, id);
}
#endif
+26
View File
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/dma-direction.h>
__rust_helper dma_addr_t rust_helper_sg_dma_address(struct scatterlist *sg)
{
return sg_dma_address(sg);
}
__rust_helper unsigned int rust_helper_sg_dma_len(struct scatterlist *sg)
{
return sg_dma_len(sg);
}
__rust_helper struct scatterlist *rust_helper_sg_next(struct scatterlist *sg)
{
return sg_next(sg);
}
__rust_helper void rust_helper_dma_unmap_sgtable(struct device *dev,
struct sg_table *sgt,
enum dma_data_direction dir,
unsigned long attrs)
{
return dma_unmap_sgtable(dev, sgt, dir, attrs);
}
+48
View File
@@ -0,0 +1,48 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/security.h>
#ifndef CONFIG_SECURITY
__rust_helper void rust_helper_security_cred_getsecid(const struct cred *c,
u32 *secid)
{
security_cred_getsecid(c, secid);
}
__rust_helper int rust_helper_security_secid_to_secctx(u32 secid,
struct lsm_context *cp)
{
return security_secid_to_secctx(secid, cp);
}
__rust_helper void rust_helper_security_release_secctx(struct lsm_context *cp)
{
security_release_secctx(cp);
}
__rust_helper int
rust_helper_security_binder_set_context_mgr(const struct cred *mgr)
{
return security_binder_set_context_mgr(mgr);
}
__rust_helper int
rust_helper_security_binder_transaction(const struct cred *from,
const struct cred *to)
{
return security_binder_transaction(from, to);
}
__rust_helper int
rust_helper_security_binder_transfer_binder(const struct cred *from,
const struct cred *to)
{
return security_binder_transfer_binder(from, to);
}
__rust_helper int rust_helper_security_binder_transfer_file(
const struct cred *from, const struct cred *to, const struct file *file)
{
return security_binder_transfer_file(from, to, file);
}
#endif
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/sched/signal.h>
__rust_helper int rust_helper_signal_pending(struct task_struct *t)
{
return signal_pending(t);
}
+17
View File
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/slab.h>
__rust_helper void *__must_check __realloc_size(2)
rust_helper_krealloc_node_align(const void *objp, size_t new_size, unsigned long align,
gfp_t flags, int node)
{
return krealloc_node_align(objp, new_size, align, flags, node);
}
__rust_helper void *__must_check __realloc_size(2)
rust_helper_kvrealloc_node_align(const void *p, size_t size, unsigned long align,
gfp_t flags, int node)
{
return kvrealloc_node_align(p, size, align, flags, node);
}
+38
View File
@@ -0,0 +1,38 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/spinlock.h>
__rust_helper void rust_helper___spin_lock_init(spinlock_t *lock,
const char *name,
struct lock_class_key *key)
{
#ifdef CONFIG_DEBUG_SPINLOCK
# if defined(CONFIG_PREEMPT_RT)
__spin_lock_init(lock, name, key, false);
# else /*!CONFIG_PREEMPT_RT */
__raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG);
# endif /* CONFIG_PREEMPT_RT */
#else /* !CONFIG_DEBUG_SPINLOCK */
spin_lock_init(lock);
#endif /* CONFIG_DEBUG_SPINLOCK */
}
__rust_helper void rust_helper_spin_lock(spinlock_t *lock)
{
spin_lock(lock);
}
__rust_helper void rust_helper_spin_unlock(spinlock_t *lock)
{
spin_unlock(lock);
}
__rust_helper int rust_helper_spin_trylock(spinlock_t *lock)
{
return spin_trylock(lock);
}
__rust_helper void rust_helper_spin_assert_is_held(spinlock_t *lock)
{
lockdep_assert_held(lock);
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/string.h>
__rust_helper void *rust_helper_memchr(const void *s, int c, size_t n)
{
return memchr(s, c, n);
}
+13
View File
@@ -0,0 +1,13 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/lockdep.h>
__rust_helper void rust_helper_lockdep_register_key(struct lock_class_key *k)
{
lockdep_register_key(k);
}
__rust_helper void rust_helper_lockdep_unregister_key(struct lock_class_key *k)
{
lockdep_unregister_key(k);
}
+62
View File
@@ -0,0 +1,62 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/kernel.h>
#include <linux/sched/task.h>
__rust_helper void rust_helper_might_resched(void)
{
might_resched();
}
__rust_helper struct task_struct *rust_helper_get_current(void)
{
return current;
}
__rust_helper void rust_helper_get_task_struct(struct task_struct *t)
{
get_task_struct(t);
}
__rust_helper void rust_helper_put_task_struct(struct task_struct *t)
{
put_task_struct(t);
}
__rust_helper kuid_t rust_helper_task_uid(struct task_struct *task)
{
return task_uid(task);
}
__rust_helper kuid_t rust_helper_task_euid(struct task_struct *task)
{
return task_euid(task);
}
#ifndef CONFIG_USER_NS
__rust_helper uid_t rust_helper_from_kuid(struct user_namespace *to, kuid_t uid)
{
return from_kuid(to, uid);
}
#endif /* CONFIG_USER_NS */
__rust_helper bool rust_helper_uid_eq(kuid_t left, kuid_t right)
{
return uid_eq(left, right);
}
__rust_helper kuid_t rust_helper_current_euid(void)
{
return current_euid();
}
__rust_helper struct user_namespace *rust_helper_current_user_ns(void)
{
return current_user_ns();
}
__rust_helper pid_t rust_helper_task_tgid_nr_ns(struct task_struct *tsk,
struct pid_namespace *ns)
{
return task_tgid_nr_ns(tsk, ns);
}
+40
View File
@@ -0,0 +1,40 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/delay.h>
#include <linux/ktime.h>
#include <linux/timekeeping.h>
__rust_helper void rust_helper_fsleep(unsigned long usecs)
{
fsleep(usecs);
}
__rust_helper ktime_t rust_helper_ktime_get_real(void)
{
return ktime_get_real();
}
__rust_helper ktime_t rust_helper_ktime_get_boottime(void)
{
return ktime_get_boottime();
}
__rust_helper ktime_t rust_helper_ktime_get_clocktai(void)
{
return ktime_get_clocktai();
}
__rust_helper s64 rust_helper_ktime_to_us(const ktime_t kt)
{
return ktime_to_us(kt);
}
__rust_helper s64 rust_helper_ktime_to_ms(const ktime_t kt)
{
return ktime_to_ms(kt);
}
__rust_helper void rust_helper_udelay(unsigned long usec)
{
udelay(usec);
}
+29
View File
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/uaccess.h>
__rust_helper unsigned long
rust_helper_copy_from_user(void *to, const void __user *from, unsigned long n)
{
return copy_from_user(to, from, n);
}
__rust_helper unsigned long
rust_helper_copy_to_user(void __user *to, const void *from, unsigned long n)
{
return copy_to_user(to, from, n);
}
#ifdef INLINE_COPY_USER
__rust_helper
unsigned long rust_helper__copy_from_user(void *to, const void __user *from, unsigned long n)
{
return _inline_copy_from_user(to, from, n);
}
__rust_helper
unsigned long rust_helper__copy_to_user(void __user *to, const void *from, unsigned long n)
{
return _inline_copy_to_user(to, from, n);
}
#endif
+9
View File
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/usb.h>
__rust_helper struct usb_device *
rust_helper_interface_to_usbdev(struct usb_interface *intf)
{
return interface_to_usbdev(intf);
}
+16
View File
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/mm.h>
#include <linux/vmalloc.h>
__rust_helper void *__must_check __realloc_size(2)
rust_helper_vrealloc_node_align(const void *p, size_t size, unsigned long align,
gfp_t flags, int node)
{
return vrealloc_node_align(p, size, align, flags, node);
}
__rust_helper bool rust_helper_is_vmalloc_addr(const void *x)
{
return is_vmalloc_addr(x);
}
+8
View File
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/wait.h>
__rust_helper void rust_helper_init_wait(struct wait_queue_entry *wq_entry)
{
init_wait(wq_entry);
}
+16
View File
@@ -0,0 +1,16 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/workqueue.h>
__rust_helper void rust_helper_init_work_with_key(struct work_struct *work,
work_func_t func,
bool onstack,
const char *name,
struct lock_class_key *key)
{
__init_work(work, onstack);
work->data = (atomic_long_t)WORK_DATA_INIT();
lockdep_init_map(&work->lockdep_map, name, key, 0);
INIT_LIST_HEAD(&work->entry);
work->func = func;
}
+28
View File
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/xarray.h>
__rust_helper int rust_helper_xa_err(void *entry)
{
return xa_err(entry);
}
__rust_helper void rust_helper_xa_init_flags(struct xarray *xa, gfp_t flags)
{
return xa_init_flags(xa, flags);
}
__rust_helper int rust_helper_xa_trylock(struct xarray *xa)
{
return xa_trylock(xa);
}
__rust_helper void rust_helper_xa_lock(struct xarray *xa)
{
return xa_lock(xa);
}
__rust_helper void rust_helper_xa_unlock(struct xarray *xa)
{
return xa_unlock(xa);
}