Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Header that contains the code (mostly headers) for which Rust bindings
4 * will be automatically generated by `bindgen`.
5 *
6 * Sorted alphabetically.
7 */
8
9/*
10 * First, avoid forward references to `enum` types.
11 *
12 * This workarounds a `bindgen` issue with them:
13 * <https://github.com/rust-lang/rust-bindgen/issues/3179>.
14 *
15 * Without this, the generated Rust type may be the wrong one (`i32`) or
16 * the proper one (typically `c_uint`) depending on how the headers are
17 * included, which in turn may depend on the particular kernel configuration
18 * or the architecture.
19 *
20 * The alternative would be to use casts and likely an
21 * `#[allow(clippy::unnecessary_cast)]` in the Rust source files. Instead,
22 * this approach allows us to keep the correct code in the source files and
23 * simply remove this section when the issue is fixed upstream and we bump
24 * the minimum `bindgen` version.
25 *
26 * This workaround may not be possible in some cases, depending on how the C
27 * headers are set up.
28 */
29#include <linux/hrtimer_types.h>
30
31#include <linux/acpi.h>
32#include <drm/drm_device.h>
33#include <drm/drm_drv.h>
34#include <drm/drm_file.h>
35#include <drm/drm_gem.h>
36#include <drm/drm_ioctl.h>
37#include <kunit/test.h>
38#include <linux/auxiliary_bus.h>
39#include <linux/bitmap.h>
40#include <linux/blk-mq.h>
41#include <linux/blk_types.h>
42#include <linux/blkdev.h>
43#include <linux/clk.h>
44#include <linux/completion.h>
45#include <linux/configfs.h>
46#include <linux/cpu.h>
47#include <linux/cpufreq.h>
48#include <linux/cpumask.h>
49#include <linux/cred.h>
50#include <linux/debugfs.h>
51#include <linux/device/faux.h>
52#include <linux/dma-direction.h>
53#include <linux/dma-mapping.h>
54#include <linux/errname.h>
55#include <linux/ethtool.h>
56#include <linux/fdtable.h>
57#include <linux/file.h>
58#include <linux/firmware.h>
59#include <linux/interrupt.h>
60#include <linux/fs.h>
61#include <linux/ioport.h>
62#include <linux/jiffies.h>
63#include <linux/jump_label.h>
64#include <linux/mdio.h>
65#include <linux/mm.h>
66#include <linux/miscdevice.h>
67#include <linux/of_device.h>
68#include <linux/pci.h>
69#include <linux/phy.h>
70#include <linux/pid_namespace.h>
71#include <linux/platform_device.h>
72#include <linux/pm_opp.h>
73#include <linux/poll.h>
74#include <linux/property.h>
75#include <linux/random.h>
76#include <linux/refcount.h>
77#include <linux/regulator/consumer.h>
78#include <linux/sched.h>
79#include <linux/security.h>
80#include <linux/slab.h>
81#include <linux/task_work.h>
82#include <linux/tracepoint.h>
83#include <linux/wait.h>
84#include <linux/workqueue.h>
85#include <linux/xarray.h>
86#include <trace/events/rust_sample.h>
87
88#if defined(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
89// Used by `#[export]` in `drivers/gpu/drm/drm_panic_qr.rs`.
90#include <drm/drm_panic.h>
91#endif
92
93/* `bindgen` gets confused at certain things. */
94const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN;
95const size_t RUST_CONST_HELPER_ARCH_KMALLOC_MINALIGN = ARCH_KMALLOC_MINALIGN;
96const size_t RUST_CONST_HELPER_PAGE_SIZE = PAGE_SIZE;
97const gfp_t RUST_CONST_HELPER_GFP_ATOMIC = GFP_ATOMIC;
98const gfp_t RUST_CONST_HELPER_GFP_KERNEL = GFP_KERNEL;
99const gfp_t RUST_CONST_HELPER_GFP_KERNEL_ACCOUNT = GFP_KERNEL_ACCOUNT;
100const gfp_t RUST_CONST_HELPER_GFP_NOWAIT = GFP_NOWAIT;
101const gfp_t RUST_CONST_HELPER___GFP_ZERO = __GFP_ZERO;
102const gfp_t RUST_CONST_HELPER___GFP_HIGHMEM = ___GFP_HIGHMEM;
103const gfp_t RUST_CONST_HELPER___GFP_NOWARN = ___GFP_NOWARN;
104const blk_features_t RUST_CONST_HELPER_BLK_FEAT_ROTATIONAL = BLK_FEAT_ROTATIONAL;
105const fop_flags_t RUST_CONST_HELPER_FOP_UNSIGNED_OFFSET = FOP_UNSIGNED_OFFSET;
106
107const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
108
109const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
110const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
111const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
112
113#if IS_ENABLED(CONFIG_ANDROID_BINDER_IPC_RUST)
114#include "../../drivers/android/binder/rust_binder.h"
115#include "../../drivers/android/binder/rust_binder_events.h"
116#include "../../drivers/android/binder/page_range_helper.h"
117#endif