bindings_helper.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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. * First, avoid forward references to `enum` types.
  10. *
  11. * This workarounds a `bindgen` issue with them:
  12. * <https://github.com/rust-lang/rust-bindgen/issues/3179>.
  13. *
  14. * Without this, the generated Rust type may be the wrong one (`i32`) or
  15. * the proper one (typically `c_uint`) depending on how the headers are
  16. * included, which in turn may depend on the particular kernel configuration
  17. * or the architecture.
  18. *
  19. * The alternative would be to use casts and likely an
  20. * `#[allow(clippy::unnecessary_cast)]` in the Rust source files. Instead,
  21. * this approach allows us to keep the correct code in the source files and
  22. * simply remove this section when the issue is fixed upstream and we bump
  23. * the minimum `bindgen` version.
  24. *
  25. * This workaround may not be possible in some cases, depending on how the C
  26. * headers are set up.
  27. */
  28. #include <linux/hrtimer_types.h>
  29. #include <linux/acpi.h>
  30. #include <drm/drm_device.h>
  31. #include <drm/drm_drv.h>
  32. #include <drm/drm_file.h>
  33. #include <drm/drm_gem.h>
  34. #include <drm/drm_ioctl.h>
  35. #include <kunit/test.h>
  36. #include <linux/auxiliary_bus.h>
  37. #include <linux/bitmap.h>
  38. #include <linux/blk-mq.h>
  39. #include <linux/blk_types.h>
  40. #include <linux/blkdev.h>
  41. #include <linux/clk.h>
  42. #include <linux/completion.h>
  43. #include <linux/configfs.h>
  44. #include <linux/cpu.h>
  45. #include <linux/cpufreq.h>
  46. #include <linux/cpumask.h>
  47. #include <linux/cred.h>
  48. #include <linux/debugfs.h>
  49. #include <linux/device/faux.h>
  50. #include <linux/dma-direction.h>
  51. #include <linux/dma-mapping.h>
  52. #include <linux/errname.h>
  53. #include <linux/ethtool.h>
  54. #include <linux/fdtable.h>
  55. #include <linux/file.h>
  56. #include <linux/firmware.h>
  57. #include <linux/fs.h>
  58. #include <linux/i2c.h>
  59. #include <linux/interrupt.h>
  60. #include <linux/io-pgtable.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/pwm.h>
  76. #include <linux/random.h>
  77. #include <linux/refcount.h>
  78. #include <linux/regulator/consumer.h>
  79. #include <linux/sched.h>
  80. #include <linux/security.h>
  81. #include <linux/slab.h>
  82. #include <linux/sys_soc.h>
  83. #include <linux/task_work.h>
  84. #include <linux/tracepoint.h>
  85. #include <linux/usb.h>
  86. #include <linux/wait.h>
  87. #include <linux/workqueue.h>
  88. #include <linux/xarray.h>
  89. #include <trace/events/rust_sample.h>
  90. /*
  91. * The driver-core Rust code needs to know about some C driver-core private
  92. * structures.
  93. */
  94. #include <../../drivers/base/base.h>
  95. #if defined(CONFIG_DRM_PANIC_SCREEN_QR_CODE)
  96. // Used by `#[export]` in `drivers/gpu/drm/drm_panic_qr.rs`.
  97. #include <drm/drm_panic.h>
  98. #endif
  99. /* `bindgen` gets confused at certain things. */
  100. const size_t RUST_CONST_HELPER_ARCH_SLAB_MINALIGN = ARCH_SLAB_MINALIGN;
  101. const size_t RUST_CONST_HELPER_ARCH_KMALLOC_MINALIGN = ARCH_KMALLOC_MINALIGN;
  102. const size_t RUST_CONST_HELPER_PAGE_SIZE = PAGE_SIZE;
  103. const gfp_t RUST_CONST_HELPER_GFP_ATOMIC = GFP_ATOMIC;
  104. const gfp_t RUST_CONST_HELPER_GFP_KERNEL = GFP_KERNEL;
  105. const gfp_t RUST_CONST_HELPER_GFP_KERNEL_ACCOUNT = GFP_KERNEL_ACCOUNT;
  106. const gfp_t RUST_CONST_HELPER_GFP_NOWAIT = GFP_NOWAIT;
  107. const gfp_t RUST_CONST_HELPER___GFP_ZERO = __GFP_ZERO;
  108. const gfp_t RUST_CONST_HELPER___GFP_HIGHMEM = ___GFP_HIGHMEM;
  109. const gfp_t RUST_CONST_HELPER___GFP_NOWARN = ___GFP_NOWARN;
  110. const blk_features_t RUST_CONST_HELPER_BLK_FEAT_ROTATIONAL = BLK_FEAT_ROTATIONAL;
  111. const fop_flags_t RUST_CONST_HELPER_FOP_UNSIGNED_OFFSET = FOP_UNSIGNED_OFFSET;
  112. const xa_mark_t RUST_CONST_HELPER_XA_PRESENT = XA_PRESENT;
  113. const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC = XA_FLAGS_ALLOC;
  114. const gfp_t RUST_CONST_HELPER_XA_FLAGS_ALLOC1 = XA_FLAGS_ALLOC1;
  115. const vm_flags_t RUST_CONST_HELPER_VM_MERGEABLE = VM_MERGEABLE;
  116. const vm_flags_t RUST_CONST_HELPER_VM_READ = VM_READ;
  117. const vm_flags_t RUST_CONST_HELPER_VM_WRITE = VM_WRITE;
  118. const vm_flags_t RUST_CONST_HELPER_VM_EXEC = VM_EXEC;
  119. const vm_flags_t RUST_CONST_HELPER_VM_SHARED = VM_SHARED;
  120. const vm_flags_t RUST_CONST_HELPER_VM_MAYREAD = VM_MAYREAD;
  121. const vm_flags_t RUST_CONST_HELPER_VM_MAYWRITE = VM_MAYWRITE;
  122. const vm_flags_t RUST_CONST_HELPER_VM_MAYEXEC = VM_MAYEXEC;
  123. const vm_flags_t RUST_CONST_HELPER_VM_MAYSHARE = VM_MAYEXEC;
  124. const vm_flags_t RUST_CONST_HELPER_VM_PFNMAP = VM_PFNMAP;
  125. const vm_flags_t RUST_CONST_HELPER_VM_IO = VM_IO;
  126. const vm_flags_t RUST_CONST_HELPER_VM_DONTCOPY = VM_DONTCOPY;
  127. const vm_flags_t RUST_CONST_HELPER_VM_DONTEXPAND = VM_DONTEXPAND;
  128. const vm_flags_t RUST_CONST_HELPER_VM_LOCKONFAULT = VM_LOCKONFAULT;
  129. const vm_flags_t RUST_CONST_HELPER_VM_ACCOUNT = VM_ACCOUNT;
  130. const vm_flags_t RUST_CONST_HELPER_VM_NORESERVE = VM_NORESERVE;
  131. const vm_flags_t RUST_CONST_HELPER_VM_HUGETLB = VM_HUGETLB;
  132. const vm_flags_t RUST_CONST_HELPER_VM_SYNC = VM_SYNC;
  133. const vm_flags_t RUST_CONST_HELPER_VM_ARCH_1 = VM_ARCH_1;
  134. const vm_flags_t RUST_CONST_HELPER_VM_WIPEONFORK = VM_WIPEONFORK;
  135. const vm_flags_t RUST_CONST_HELPER_VM_DONTDUMP = VM_DONTDUMP;
  136. const vm_flags_t RUST_CONST_HELPER_VM_SOFTDIRTY = VM_SOFTDIRTY;
  137. const vm_flags_t RUST_CONST_HELPER_VM_MIXEDMAP = VM_MIXEDMAP;
  138. const vm_flags_t RUST_CONST_HELPER_VM_HUGEPAGE = VM_HUGEPAGE;
  139. const vm_flags_t RUST_CONST_HELPER_VM_NOHUGEPAGE = VM_NOHUGEPAGE;
  140. #if IS_ENABLED(CONFIG_ANDROID_BINDER_IPC_RUST)
  141. #include "../../drivers/android/binder/rust_binder.h"
  142. #include "../../drivers/android/binder/rust_binder_events.h"
  143. #include "../../drivers/android/binder/page_range_helper.h"
  144. #endif