diff --git a/common/io_uring/bindgen.sh b/common/io_uring/bindgen.sh new file mode 100755 index 0000000000..81c26310c6 --- /dev/null +++ b/common/io_uring/bindgen.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# Copyright 2022 The Chromium OS Authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. +# +# Regenerate io_uring bindgen bindings. + +set -euo pipefail +cd "$(dirname "${BASH_SOURCE[0]}")/../.." + +source tools/impl/bindgen-common.sh + +bindgen_generate \ + --allowlist-type='io_uring_.*' \ + --allowlist-var='IO_URING_.*' \ + --allowlist-var='IORING_.*' \ + "${BINDGEN_LINUX}/include/uapi/linux/io_uring.h" \ + | replace_linux_int_types | rustfmt \ + > common/io_uring/src/bindings.rs diff --git a/common/io_uring/src/bindings.rs b/common/io_uring/src/bindings.rs index b254c9fc40..c6e52f41f8 100644 --- a/common/io_uring/src/bindings.rs +++ b/common/io_uring/src/bindings.rs @@ -1,7 +1,4 @@ -/* automatically generated by rust-bindgen - * - * bindgen --with-derive-default include/uapi/linux/io_uring.h - */ +/* automatically generated by tools/bindgen-all-the-things */ #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] @@ -10,19 +7,19 @@ #[repr(C)] #[derive(Default)] -pub struct __IncompleteArrayField(::std::marker::PhantomData); +pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); impl __IncompleteArrayField { #[inline] - pub fn new() -> Self { - __IncompleteArrayField(::std::marker::PhantomData) + pub const fn new() -> Self { + __IncompleteArrayField(::std::marker::PhantomData, []) } #[inline] - pub unsafe fn as_ptr(&self) -> *const T { - ::std::mem::transmute(self) + pub fn as_ptr(&self) -> *const T { + self as *const _ as *const T } #[inline] - pub unsafe fn as_mut_ptr(&mut self) -> *mut T { - ::std::mem::transmute(self) + pub fn as_mut_ptr(&mut self) -> *mut T { + self as *mut _ as *mut T } #[inline] pub unsafe fn as_slice(&self, len: usize) -> &[T] { @@ -34,308 +31,37 @@ impl __IncompleteArrayField { } } impl ::std::fmt::Debug for __IncompleteArrayField { - fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { fmt.write_str("__IncompleteArrayField") } } -impl ::std::clone::Clone for __IncompleteArrayField { - #[inline] - fn clone(&self) -> Self { - Self::new() - } -} -impl ::std::marker::Copy for __IncompleteArrayField {} -pub const NR_OPEN: ::std::os::raw::c_uint = 1024; -pub const NGROUPS_MAX: ::std::os::raw::c_uint = 65536; -pub const ARG_MAX: ::std::os::raw::c_uint = 131072; -pub const LINK_MAX: ::std::os::raw::c_uint = 127; -pub const MAX_CANON: ::std::os::raw::c_uint = 255; -pub const MAX_INPUT: ::std::os::raw::c_uint = 255; -pub const NAME_MAX: ::std::os::raw::c_uint = 255; -pub const PATH_MAX: ::std::os::raw::c_uint = 4096; -pub const PIPE_BUF: ::std::os::raw::c_uint = 4096; -pub const XATTR_NAME_MAX: ::std::os::raw::c_uint = 255; -pub const XATTR_SIZE_MAX: ::std::os::raw::c_uint = 65536; -pub const XATTR_LIST_MAX: ::std::os::raw::c_uint = 65536; -pub const RTSIG_MAX: ::std::os::raw::c_uint = 32; -pub const _IOC_NRBITS: ::std::os::raw::c_uint = 8; -pub const _IOC_TYPEBITS: ::std::os::raw::c_uint = 8; -pub const _IOC_SIZEBITS: ::std::os::raw::c_uint = 14; -pub const _IOC_DIRBITS: ::std::os::raw::c_uint = 2; -pub const _IOC_NRMASK: ::std::os::raw::c_uint = 255; -pub const _IOC_TYPEMASK: ::std::os::raw::c_uint = 255; -pub const _IOC_SIZEMASK: ::std::os::raw::c_uint = 16383; -pub const _IOC_DIRMASK: ::std::os::raw::c_uint = 3; -pub const _IOC_NRSHIFT: ::std::os::raw::c_uint = 0; -pub const _IOC_TYPESHIFT: ::std::os::raw::c_uint = 8; -pub const _IOC_SIZESHIFT: ::std::os::raw::c_uint = 16; -pub const _IOC_DIRSHIFT: ::std::os::raw::c_uint = 30; -pub const _IOC_NONE: ::std::os::raw::c_uint = 0; -pub const _IOC_WRITE: ::std::os::raw::c_uint = 1; -pub const _IOC_READ: ::std::os::raw::c_uint = 2; -pub const IOC_IN: ::std::os::raw::c_uint = 1073741824; -pub const IOC_OUT: ::std::os::raw::c_uint = 2147483648; -pub const IOC_INOUT: ::std::os::raw::c_uint = 3221225472; -pub const IOCSIZE_MASK: ::std::os::raw::c_uint = 1073676288; -pub const IOCSIZE_SHIFT: ::std::os::raw::c_uint = 16; -pub const __BITS_PER_LONG: ::std::os::raw::c_uint = 64; -pub const __FD_SETSIZE: ::std::os::raw::c_uint = 1024; -pub const MS_RDONLY: ::std::os::raw::c_uint = 1; -pub const MS_NOSUID: ::std::os::raw::c_uint = 2; -pub const MS_NODEV: ::std::os::raw::c_uint = 4; -pub const MS_NOEXEC: ::std::os::raw::c_uint = 8; -pub const MS_SYNCHRONOUS: ::std::os::raw::c_uint = 16; -pub const MS_REMOUNT: ::std::os::raw::c_uint = 32; -pub const MS_MANDLOCK: ::std::os::raw::c_uint = 64; -pub const MS_DIRSYNC: ::std::os::raw::c_uint = 128; -pub const MS_NOATIME: ::std::os::raw::c_uint = 1024; -pub const MS_NODIRATIME: ::std::os::raw::c_uint = 2048; -pub const MS_BIND: ::std::os::raw::c_uint = 4096; -pub const MS_MOVE: ::std::os::raw::c_uint = 8192; -pub const MS_REC: ::std::os::raw::c_uint = 16384; -pub const MS_VERBOSE: ::std::os::raw::c_uint = 32768; -pub const MS_SILENT: ::std::os::raw::c_uint = 32768; -pub const MS_POSIXACL: ::std::os::raw::c_uint = 65536; -pub const MS_UNBINDABLE: ::std::os::raw::c_uint = 131072; -pub const MS_PRIVATE: ::std::os::raw::c_uint = 262144; -pub const MS_SLAVE: ::std::os::raw::c_uint = 524288; -pub const MS_SHARED: ::std::os::raw::c_uint = 1048576; -pub const MS_RELATIME: ::std::os::raw::c_uint = 2097152; -pub const MS_KERNMOUNT: ::std::os::raw::c_uint = 4194304; -pub const MS_I_VERSION: ::std::os::raw::c_uint = 8388608; -pub const MS_STRICTATIME: ::std::os::raw::c_uint = 16777216; -pub const MS_LAZYTIME: ::std::os::raw::c_uint = 33554432; -pub const MS_SUBMOUNT: ::std::os::raw::c_uint = 67108864; -pub const MS_NOREMOTELOCK: ::std::os::raw::c_uint = 134217728; -pub const MS_NOSEC: ::std::os::raw::c_uint = 268435456; -pub const MS_BORN: ::std::os::raw::c_uint = 536870912; -pub const MS_ACTIVE: ::std::os::raw::c_uint = 1073741824; -pub const MS_NOUSER: ::std::os::raw::c_uint = 2147483648; -pub const MS_RMT_MASK: ::std::os::raw::c_uint = 41943121; -pub const MS_MGC_VAL: ::std::os::raw::c_uint = 3236757504; -pub const MS_MGC_MSK: ::std::os::raw::c_uint = 4294901760; -pub const OPEN_TREE_CLONE: ::std::os::raw::c_uint = 1; -pub const MOVE_MOUNT_F_SYMLINKS: ::std::os::raw::c_uint = 1; -pub const MOVE_MOUNT_F_AUTOMOUNTS: ::std::os::raw::c_uint = 2; -pub const MOVE_MOUNT_F_EMPTY_PATH: ::std::os::raw::c_uint = 4; -pub const MOVE_MOUNT_T_SYMLINKS: ::std::os::raw::c_uint = 16; -pub const MOVE_MOUNT_T_AUTOMOUNTS: ::std::os::raw::c_uint = 32; -pub const MOVE_MOUNT_T_EMPTY_PATH: ::std::os::raw::c_uint = 64; -pub const MOVE_MOUNT__MASK: ::std::os::raw::c_uint = 119; -pub const FSOPEN_CLOEXEC: ::std::os::raw::c_uint = 1; -pub const FSPICK_CLOEXEC: ::std::os::raw::c_uint = 1; -pub const FSPICK_SYMLINK_NOFOLLOW: ::std::os::raw::c_uint = 2; -pub const FSPICK_NO_AUTOMOUNT: ::std::os::raw::c_uint = 4; -pub const FSPICK_EMPTY_PATH: ::std::os::raw::c_uint = 8; -pub const FSMOUNT_CLOEXEC: ::std::os::raw::c_uint = 1; -pub const MOUNT_ATTR_RDONLY: ::std::os::raw::c_uint = 1; -pub const MOUNT_ATTR_NOSUID: ::std::os::raw::c_uint = 2; -pub const MOUNT_ATTR_NODEV: ::std::os::raw::c_uint = 4; -pub const MOUNT_ATTR_NOEXEC: ::std::os::raw::c_uint = 8; -pub const MOUNT_ATTR__ATIME: ::std::os::raw::c_uint = 112; -pub const MOUNT_ATTR_RELATIME: ::std::os::raw::c_uint = 0; -pub const MOUNT_ATTR_NOATIME: ::std::os::raw::c_uint = 16; -pub const MOUNT_ATTR_STRICTATIME: ::std::os::raw::c_uint = 32; -pub const MOUNT_ATTR_NODIRATIME: ::std::os::raw::c_uint = 128; -pub const INR_OPEN_CUR: ::std::os::raw::c_uint = 1024; -pub const INR_OPEN_MAX: ::std::os::raw::c_uint = 4096; -pub const BLOCK_SIZE_BITS: ::std::os::raw::c_uint = 10; -pub const BLOCK_SIZE: ::std::os::raw::c_uint = 1024; -pub const SEEK_SET: ::std::os::raw::c_uint = 0; -pub const SEEK_CUR: ::std::os::raw::c_uint = 1; -pub const SEEK_END: ::std::os::raw::c_uint = 2; -pub const SEEK_DATA: ::std::os::raw::c_uint = 3; -pub const SEEK_HOLE: ::std::os::raw::c_uint = 4; -pub const SEEK_MAX: ::std::os::raw::c_uint = 4; -pub const RENAME_NOREPLACE: ::std::os::raw::c_uint = 1; -pub const RENAME_EXCHANGE: ::std::os::raw::c_uint = 2; -pub const RENAME_WHITEOUT: ::std::os::raw::c_uint = 4; -pub const FILE_DEDUPE_RANGE_SAME: ::std::os::raw::c_uint = 0; -pub const FILE_DEDUPE_RANGE_DIFFERS: ::std::os::raw::c_uint = 1; -pub const NR_FILE: ::std::os::raw::c_uint = 8192; -pub const FS_XFLAG_REALTIME: ::std::os::raw::c_uint = 1; -pub const FS_XFLAG_PREALLOC: ::std::os::raw::c_uint = 2; -pub const FS_XFLAG_IMMUTABLE: ::std::os::raw::c_uint = 8; -pub const FS_XFLAG_APPEND: ::std::os::raw::c_uint = 16; -pub const FS_XFLAG_SYNC: ::std::os::raw::c_uint = 32; -pub const FS_XFLAG_NOATIME: ::std::os::raw::c_uint = 64; -pub const FS_XFLAG_NODUMP: ::std::os::raw::c_uint = 128; -pub const FS_XFLAG_RTINHERIT: ::std::os::raw::c_uint = 256; -pub const FS_XFLAG_PROJINHERIT: ::std::os::raw::c_uint = 512; -pub const FS_XFLAG_NOSYMLINKS: ::std::os::raw::c_uint = 1024; -pub const FS_XFLAG_EXTSIZE: ::std::os::raw::c_uint = 2048; -pub const FS_XFLAG_EXTSZINHERIT: ::std::os::raw::c_uint = 4096; -pub const FS_XFLAG_NODEFRAG: ::std::os::raw::c_uint = 8192; -pub const FS_XFLAG_FILESTREAM: ::std::os::raw::c_uint = 16384; -pub const FS_XFLAG_DAX: ::std::os::raw::c_uint = 32768; -pub const FS_XFLAG_COWEXTSIZE: ::std::os::raw::c_uint = 65536; -pub const FS_XFLAG_HASATTR: ::std::os::raw::c_uint = 2147483648; -pub const BMAP_IOCTL: ::std::os::raw::c_uint = 1; -pub const FSLABEL_MAX: ::std::os::raw::c_uint = 256; -pub const FS_KEY_DESCRIPTOR_SIZE: ::std::os::raw::c_uint = 8; -pub const FS_POLICY_FLAGS_PAD_4: ::std::os::raw::c_uint = 0; -pub const FS_POLICY_FLAGS_PAD_8: ::std::os::raw::c_uint = 1; -pub const FS_POLICY_FLAGS_PAD_16: ::std::os::raw::c_uint = 2; -pub const FS_POLICY_FLAGS_PAD_32: ::std::os::raw::c_uint = 3; -pub const FS_POLICY_FLAGS_PAD_MASK: ::std::os::raw::c_uint = 3; -pub const FS_POLICY_FLAG_DIRECT_KEY: ::std::os::raw::c_uint = 4; -pub const FS_POLICY_FLAGS_VALID: ::std::os::raw::c_uint = 7; -pub const FS_ENCRYPTION_MODE_INVALID: ::std::os::raw::c_uint = 0; -pub const FS_ENCRYPTION_MODE_AES_256_XTS: ::std::os::raw::c_uint = 1; -pub const FS_ENCRYPTION_MODE_AES_256_GCM: ::std::os::raw::c_uint = 2; -pub const FS_ENCRYPTION_MODE_AES_256_CBC: ::std::os::raw::c_uint = 3; -pub const FS_ENCRYPTION_MODE_AES_256_CTS: ::std::os::raw::c_uint = 4; -pub const FS_ENCRYPTION_MODE_AES_128_CBC: ::std::os::raw::c_uint = 5; -pub const FS_ENCRYPTION_MODE_AES_128_CTS: ::std::os::raw::c_uint = 6; -pub const FS_ENCRYPTION_MODE_SPECK128_256_XTS: ::std::os::raw::c_uint = 7; -pub const FS_ENCRYPTION_MODE_SPECK128_256_CTS: ::std::os::raw::c_uint = 8; -pub const FS_ENCRYPTION_MODE_ADIANTUM: ::std::os::raw::c_uint = 9; -pub const FS_KEY_DESC_PREFIX: &[u8; 9usize] = b"fscrypt:\0"; -pub const FS_KEY_DESC_PREFIX_SIZE: ::std::os::raw::c_uint = 8; -pub const FS_MAX_KEY_SIZE: ::std::os::raw::c_uint = 64; -pub const FS_SECRM_FL: ::std::os::raw::c_uint = 1; -pub const FS_UNRM_FL: ::std::os::raw::c_uint = 2; -pub const FS_COMPR_FL: ::std::os::raw::c_uint = 4; -pub const FS_SYNC_FL: ::std::os::raw::c_uint = 8; -pub const FS_IMMUTABLE_FL: ::std::os::raw::c_uint = 16; -pub const FS_APPEND_FL: ::std::os::raw::c_uint = 32; -pub const FS_NODUMP_FL: ::std::os::raw::c_uint = 64; -pub const FS_NOATIME_FL: ::std::os::raw::c_uint = 128; -pub const FS_DIRTY_FL: ::std::os::raw::c_uint = 256; -pub const FS_COMPRBLK_FL: ::std::os::raw::c_uint = 512; -pub const FS_NOCOMP_FL: ::std::os::raw::c_uint = 1024; -pub const FS_ENCRYPT_FL: ::std::os::raw::c_uint = 2048; -pub const FS_BTREE_FL: ::std::os::raw::c_uint = 4096; -pub const FS_INDEX_FL: ::std::os::raw::c_uint = 4096; -pub const FS_IMAGIC_FL: ::std::os::raw::c_uint = 8192; -pub const FS_JOURNAL_DATA_FL: ::std::os::raw::c_uint = 16384; -pub const FS_NOTAIL_FL: ::std::os::raw::c_uint = 32768; -pub const FS_DIRSYNC_FL: ::std::os::raw::c_uint = 65536; -pub const FS_TOPDIR_FL: ::std::os::raw::c_uint = 131072; -pub const FS_HUGE_FILE_FL: ::std::os::raw::c_uint = 262144; -pub const FS_EXTENT_FL: ::std::os::raw::c_uint = 524288; -pub const FS_EA_INODE_FL: ::std::os::raw::c_uint = 2097152; -pub const FS_EOFBLOCKS_FL: ::std::os::raw::c_uint = 4194304; -pub const FS_NOCOW_FL: ::std::os::raw::c_uint = 8388608; -pub const FS_INLINE_DATA_FL: ::std::os::raw::c_uint = 268435456; -pub const FS_PROJINHERIT_FL: ::std::os::raw::c_uint = 536870912; -pub const FS_RESERVED_FL: ::std::os::raw::c_uint = 2147483648; -pub const FS_FL_USER_VISIBLE: ::std::os::raw::c_uint = 253951; -pub const FS_FL_USER_MODIFIABLE: ::std::os::raw::c_uint = 229631; -pub const SYNC_FILE_RANGE_WAIT_BEFORE: ::std::os::raw::c_uint = 1; -pub const SYNC_FILE_RANGE_WRITE: ::std::os::raw::c_uint = 2; -pub const SYNC_FILE_RANGE_WAIT_AFTER: ::std::os::raw::c_uint = 4; -pub const SYNC_FILE_RANGE_WRITE_AND_WAIT: ::std::os::raw::c_uint = 7; -pub const IORING_SETUP_IOPOLL: ::std::os::raw::c_uint = 1; -pub const IORING_SETUP_SQPOLL: ::std::os::raw::c_uint = 2; -pub const IORING_SETUP_SQ_AFF: ::std::os::raw::c_uint = 4; -pub const IORING_SETUP_CQSIZE: ::std::os::raw::c_uint = 8; -pub const IORING_SETUP_CLAMP: ::std::os::raw::c_uint = 16; -pub const IORING_SETUP_ATTACH_WQ: ::std::os::raw::c_uint = 32; -pub const IORING_FSYNC_DATASYNC: ::std::os::raw::c_uint = 1; -pub const IORING_TIMEOUT_ABS: ::std::os::raw::c_uint = 1; -pub const IORING_OFF_SQ_RING: ::std::os::raw::c_uint = 0; -pub const IORING_OFF_CQ_RING: ::std::os::raw::c_uint = 134217728; -pub const IORING_OFF_SQES: ::std::os::raw::c_uint = 268435456; -pub const IORING_SQ_NEED_WAKEUP: ::std::os::raw::c_uint = 1; -pub const IORING_ENTER_GETEVENTS: ::std::os::raw::c_uint = 1; -pub const IORING_ENTER_SQ_WAKEUP: ::std::os::raw::c_uint = 2; -pub const IORING_FEAT_SINGLE_MMAP: ::std::os::raw::c_uint = 1; -pub const IORING_FEAT_NODROP: ::std::os::raw::c_uint = 2; -pub const IORING_FEAT_SUBMIT_STABLE: ::std::os::raw::c_uint = 4; -pub const IORING_FEAT_RW_CUR_POS: ::std::os::raw::c_uint = 8; -pub const IORING_FEAT_CUR_PERSONALITY: ::std::os::raw::c_uint = 16; -pub const IORING_REGISTER_BUFFERS: ::std::os::raw::c_uint = 0; -pub const IORING_UNREGISTER_BUFFERS: ::std::os::raw::c_uint = 1; -pub const IORING_REGISTER_FILES: ::std::os::raw::c_uint = 2; -pub const IORING_UNREGISTER_FILES: ::std::os::raw::c_uint = 3; -pub const IORING_REGISTER_EVENTFD: ::std::os::raw::c_uint = 4; -pub const IORING_UNREGISTER_EVENTFD: ::std::os::raw::c_uint = 5; -pub const IORING_REGISTER_FILES_UPDATE: ::std::os::raw::c_uint = 6; -pub const IORING_REGISTER_EVENTFD_ASYNC: ::std::os::raw::c_uint = 7; -pub const IORING_REGISTER_PROBE: ::std::os::raw::c_uint = 8; -pub const IORING_REGISTER_PERSONALITY: ::std::os::raw::c_uint = 9; -pub const IORING_UNREGISTER_PERSONALITY: ::std::os::raw::c_uint = 10; -pub const IO_URING_OP_SUPPORTED: ::std::os::raw::c_uint = 1; -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct file_clone_range { - pub src_fd: i64, - pub src_offset: u64, - pub src_length: u64, - pub dest_offset: u64, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct fstrim_range { - pub start: u64, - pub len: u64, - pub minlen: u64, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct file_dedupe_range_info { - pub dest_fd: i64, - pub dest_offset: u64, - pub bytes_deduped: u64, - pub status: i32, - pub reserved: u32, -} -#[repr(C)] -#[derive(Debug, Default)] -pub struct file_dedupe_range { - pub src_offset: u64, - pub src_length: u64, - pub dest_count: u16, - pub reserved1: u16, - pub reserved2: u32, - pub info: __IncompleteArrayField, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct files_stat_struct { - pub nr_files: ::std::os::raw::c_ulong, - pub nr_free_files: ::std::os::raw::c_ulong, - pub max_files: ::std::os::raw::c_ulong, -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct inodes_stat_t { - pub nr_inodes: ::std::os::raw::c_long, - pub nr_unused: ::std::os::raw::c_long, - pub dummy: [::std::os::raw::c_long; 5usize], -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct fsxattr { - pub fsx_xflags: u32, - pub fsx_extsize: u32, - pub fsx_nextents: u32, - pub fsx_projid: u32, - pub fsx_cowextsize: u32, - pub fsx_pad: [::std::os::raw::c_uchar; 8usize], -} -#[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct fscrypt_policy { - pub version: u8, - pub contents_encryption_mode: u8, - pub filenames_encryption_mode: u8, - pub flags: u8, - pub master_key_descriptor: [u8; 8usize], -} -#[repr(C)] -#[derive(Copy, Clone)] -pub struct fscrypt_key { - pub mode: u32, - pub raw: [u8; 64usize], - pub size: u32, -} -impl Default for fscrypt_key { - fn default() -> Self { - unsafe { ::std::mem::zeroed() } - } -} +pub const IORING_SETUP_IOPOLL: u32 = 1; +pub const IORING_SETUP_SQPOLL: u32 = 2; +pub const IORING_SETUP_SQ_AFF: u32 = 4; +pub const IORING_SETUP_CQSIZE: u32 = 8; +pub const IORING_SETUP_CLAMP: u32 = 16; +pub const IORING_SETUP_ATTACH_WQ: u32 = 32; +pub const IORING_SETUP_R_DISABLED: u32 = 64; +pub const IORING_FSYNC_DATASYNC: u32 = 1; +pub const IORING_TIMEOUT_ABS: u32 = 1; +pub const IORING_CQE_F_BUFFER: u32 = 1; +pub const IORING_OFF_SQ_RING: u32 = 0; +pub const IORING_OFF_CQ_RING: u32 = 134217728; +pub const IORING_OFF_SQES: u32 = 268435456; +pub const IORING_SQ_NEED_WAKEUP: u32 = 1; +pub const IORING_SQ_CQ_OVERFLOW: u32 = 2; +pub const IORING_CQ_EVENTFD_DISABLED: u32 = 1; +pub const IORING_ENTER_GETEVENTS: u32 = 1; +pub const IORING_ENTER_SQ_WAKEUP: u32 = 2; +pub const IORING_ENTER_SQ_WAIT: u32 = 4; +pub const IORING_FEAT_SINGLE_MMAP: u32 = 1; +pub const IORING_FEAT_NODROP: u32 = 2; +pub const IORING_FEAT_SUBMIT_STABLE: u32 = 4; +pub const IORING_FEAT_RW_CUR_POS: u32 = 8; +pub const IORING_FEAT_CUR_PERSONALITY: u32 = 16; +pub const IORING_FEAT_FAST_POLL: u32 = 32; +pub const IORING_FEAT_POLL_32BITS: u32 = 64; +pub const IO_URING_OP_SUPPORTED: u32 = 1; pub type __kernel_rwf_t = ::std::os::raw::c_int; #[repr(C)] #[derive(Copy, Clone)] @@ -345,30 +71,49 @@ pub struct io_uring_sqe { pub ioprio: u16, pub fd: i32, pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_1, - pub addr: u64, - pub len: u32, pub __bindgen_anon_2: io_uring_sqe__bindgen_ty_2, - pub user_data: u64, + pub len: u32, pub __bindgen_anon_3: io_uring_sqe__bindgen_ty_3, + pub user_data: u64, + pub __bindgen_anon_4: io_uring_sqe__bindgen_ty_4, } #[repr(C)] #[derive(Copy, Clone)] pub union io_uring_sqe__bindgen_ty_1 { pub off: u64, pub addr2: u64, - _bindgen_union_align: u64, } impl Default for io_uring_sqe__bindgen_ty_1 { fn default() -> Self { - unsafe { ::std::mem::zeroed() } + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } } } #[repr(C)] #[derive(Copy, Clone)] pub union io_uring_sqe__bindgen_ty_2 { + pub addr: u64, + pub splice_off_in: u64, +} +impl Default for io_uring_sqe__bindgen_ty_2 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union io_uring_sqe__bindgen_ty_3 { pub rw_flags: __kernel_rwf_t, pub fsync_flags: u32, pub poll_events: u16, + pub poll32_events: u32, pub sync_range_flags: u32, pub msg_flags: u32, pub timeout_flags: u32, @@ -377,73 +122,107 @@ pub union io_uring_sqe__bindgen_ty_2 { pub open_flags: u32, pub statx_flags: u32, pub fadvise_advice: u32, - _bindgen_union_align: u32, + pub splice_flags: u32, } -impl Default for io_uring_sqe__bindgen_ty_2 { +impl Default for io_uring_sqe__bindgen_ty_3 { fn default() -> Self { - unsafe { ::std::mem::zeroed() } + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } } } #[repr(C)] #[derive(Copy, Clone)] -pub union io_uring_sqe__bindgen_ty_3 { - pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_3__bindgen_ty_1, +pub union io_uring_sqe__bindgen_ty_4 { + pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_4__bindgen_ty_1, pub __pad2: [u64; 3usize], - _bindgen_union_align: [u64; 3usize], } #[repr(C)] -#[derive(Debug, Default, Copy, Clone)] -pub struct io_uring_sqe__bindgen_ty_3__bindgen_ty_1 { - pub buf_index: u16, +#[derive(Copy, Clone)] +pub struct io_uring_sqe__bindgen_ty_4__bindgen_ty_1 { + pub __bindgen_anon_1: io_uring_sqe__bindgen_ty_4__bindgen_ty_1__bindgen_ty_1, pub personality: u16, + pub splice_fd_in: i32, } -impl Default for io_uring_sqe__bindgen_ty_3 { +#[repr(C, packed)] +#[derive(Copy, Clone)] +pub union io_uring_sqe__bindgen_ty_4__bindgen_ty_1__bindgen_ty_1 { + pub buf_index: u16, + pub buf_group: u16, +} +impl Default for io_uring_sqe__bindgen_ty_4__bindgen_ty_1__bindgen_ty_1 { fn default() -> Self { - unsafe { ::std::mem::zeroed() } + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for io_uring_sqe__bindgen_ty_4__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for io_uring_sqe__bindgen_ty_4 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } } } impl Default for io_uring_sqe { fn default() -> Self { - unsafe { ::std::mem::zeroed() } + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } } } -pub const IOSQE_FIXED_FILE_BIT: _bindgen_ty_1 = 0; -pub const IOSQE_IO_DRAIN_BIT: _bindgen_ty_1 = 1; -pub const IOSQE_IO_LINK_BIT: _bindgen_ty_1 = 2; -pub const IOSQE_IO_HARDLINK_BIT: _bindgen_ty_1 = 3; -pub const IOSQE_ASYNC_BIT: _bindgen_ty_1 = 4; -pub type _bindgen_ty_1 = ::std::os::raw::c_uint; -pub const IORING_OP_NOP: _bindgen_ty_2 = 0; -pub const IORING_OP_READV: _bindgen_ty_2 = 1; -pub const IORING_OP_WRITEV: _bindgen_ty_2 = 2; -pub const IORING_OP_FSYNC: _bindgen_ty_2 = 3; -pub const IORING_OP_READ_FIXED: _bindgen_ty_2 = 4; -pub const IORING_OP_WRITE_FIXED: _bindgen_ty_2 = 5; -pub const IORING_OP_POLL_ADD: _bindgen_ty_2 = 6; -pub const IORING_OP_POLL_REMOVE: _bindgen_ty_2 = 7; -pub const IORING_OP_SYNC_FILE_RANGE: _bindgen_ty_2 = 8; -pub const IORING_OP_SENDMSG: _bindgen_ty_2 = 9; -pub const IORING_OP_RECVMSG: _bindgen_ty_2 = 10; -pub const IORING_OP_TIMEOUT: _bindgen_ty_2 = 11; -pub const IORING_OP_TIMEOUT_REMOVE: _bindgen_ty_2 = 12; -pub const IORING_OP_ACCEPT: _bindgen_ty_2 = 13; -pub const IORING_OP_ASYNC_CANCEL: _bindgen_ty_2 = 14; -pub const IORING_OP_LINK_TIMEOUT: _bindgen_ty_2 = 15; -pub const IORING_OP_CONNECT: _bindgen_ty_2 = 16; -pub const IORING_OP_FALLOCATE: _bindgen_ty_2 = 17; -pub const IORING_OP_OPENAT: _bindgen_ty_2 = 18; -pub const IORING_OP_CLOSE: _bindgen_ty_2 = 19; -pub const IORING_OP_FILES_UPDATE: _bindgen_ty_2 = 20; -pub const IORING_OP_STATX: _bindgen_ty_2 = 21; -pub const IORING_OP_READ: _bindgen_ty_2 = 22; -pub const IORING_OP_WRITE: _bindgen_ty_2 = 23; -pub const IORING_OP_FADVISE: _bindgen_ty_2 = 24; -pub const IORING_OP_MADVISE: _bindgen_ty_2 = 25; -pub const IORING_OP_SEND: _bindgen_ty_2 = 26; -pub const IORING_OP_RECV: _bindgen_ty_2 = 27; -pub const IORING_OP_OPENAT2: _bindgen_ty_2 = 28; -pub const IORING_OP_EPOLL_CTL: _bindgen_ty_2 = 29; -pub const IORING_OP_LAST: _bindgen_ty_2 = 30; +pub const IORING_OP_NOP: ::std::os::raw::c_uint = 0; +pub const IORING_OP_READV: ::std::os::raw::c_uint = 1; +pub const IORING_OP_WRITEV: ::std::os::raw::c_uint = 2; +pub const IORING_OP_FSYNC: ::std::os::raw::c_uint = 3; +pub const IORING_OP_READ_FIXED: ::std::os::raw::c_uint = 4; +pub const IORING_OP_WRITE_FIXED: ::std::os::raw::c_uint = 5; +pub const IORING_OP_POLL_ADD: ::std::os::raw::c_uint = 6; +pub const IORING_OP_POLL_REMOVE: ::std::os::raw::c_uint = 7; +pub const IORING_OP_SYNC_FILE_RANGE: ::std::os::raw::c_uint = 8; +pub const IORING_OP_SENDMSG: ::std::os::raw::c_uint = 9; +pub const IORING_OP_RECVMSG: ::std::os::raw::c_uint = 10; +pub const IORING_OP_TIMEOUT: ::std::os::raw::c_uint = 11; +pub const IORING_OP_TIMEOUT_REMOVE: ::std::os::raw::c_uint = 12; +pub const IORING_OP_ACCEPT: ::std::os::raw::c_uint = 13; +pub const IORING_OP_ASYNC_CANCEL: ::std::os::raw::c_uint = 14; +pub const IORING_OP_LINK_TIMEOUT: ::std::os::raw::c_uint = 15; +pub const IORING_OP_CONNECT: ::std::os::raw::c_uint = 16; +pub const IORING_OP_FALLOCATE: ::std::os::raw::c_uint = 17; +pub const IORING_OP_OPENAT: ::std::os::raw::c_uint = 18; +pub const IORING_OP_CLOSE: ::std::os::raw::c_uint = 19; +pub const IORING_OP_FILES_UPDATE: ::std::os::raw::c_uint = 20; +pub const IORING_OP_STATX: ::std::os::raw::c_uint = 21; +pub const IORING_OP_READ: ::std::os::raw::c_uint = 22; +pub const IORING_OP_WRITE: ::std::os::raw::c_uint = 23; +pub const IORING_OP_FADVISE: ::std::os::raw::c_uint = 24; +pub const IORING_OP_MADVISE: ::std::os::raw::c_uint = 25; +pub const IORING_OP_SEND: ::std::os::raw::c_uint = 26; +pub const IORING_OP_RECV: ::std::os::raw::c_uint = 27; +pub const IORING_OP_OPENAT2: ::std::os::raw::c_uint = 28; +pub const IORING_OP_EPOLL_CTL: ::std::os::raw::c_uint = 29; +pub const IORING_OP_SPLICE: ::std::os::raw::c_uint = 30; +pub const IORING_OP_PROVIDE_BUFFERS: ::std::os::raw::c_uint = 31; +pub const IORING_OP_REMOVE_BUFFERS: ::std::os::raw::c_uint = 32; +pub const IORING_OP_TEE: ::std::os::raw::c_uint = 33; +pub const IORING_OP_LAST: ::std::os::raw::c_uint = 34; pub type _bindgen_ty_2 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -452,6 +231,8 @@ pub struct io_uring_cqe { pub res: i32, pub flags: u32, } +pub const IORING_CQE_BUFFER_SHIFT: ::std::os::raw::c_uint = 16; +pub type _bindgen_ty_3 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_sqring_offsets { @@ -474,7 +255,9 @@ pub struct io_cqring_offsets { pub ring_entries: u32, pub overflow: u32, pub cqes: u32, - pub resv: [u64; 2usize], + pub flags: u32, + pub resv1: u32, + pub resv2: u64, } #[repr(C)] #[derive(Debug, Default, Copy, Clone)] @@ -490,6 +273,21 @@ pub struct io_uring_params { pub sq_off: io_sqring_offsets, pub cq_off: io_cqring_offsets, } +pub const IORING_REGISTER_BUFFERS: ::std::os::raw::c_uint = 0; +pub const IORING_UNREGISTER_BUFFERS: ::std::os::raw::c_uint = 1; +pub const IORING_REGISTER_FILES: ::std::os::raw::c_uint = 2; +pub const IORING_UNREGISTER_FILES: ::std::os::raw::c_uint = 3; +pub const IORING_REGISTER_EVENTFD: ::std::os::raw::c_uint = 4; +pub const IORING_UNREGISTER_EVENTFD: ::std::os::raw::c_uint = 5; +pub const IORING_REGISTER_FILES_UPDATE: ::std::os::raw::c_uint = 6; +pub const IORING_REGISTER_EVENTFD_ASYNC: ::std::os::raw::c_uint = 7; +pub const IORING_REGISTER_PROBE: ::std::os::raw::c_uint = 8; +pub const IORING_REGISTER_PERSONALITY: ::std::os::raw::c_uint = 9; +pub const IORING_UNREGISTER_PERSONALITY: ::std::os::raw::c_uint = 10; +pub const IORING_REGISTER_RESTRICTIONS: ::std::os::raw::c_uint = 11; +pub const IORING_REGISTER_ENABLE_RINGS: ::std::os::raw::c_uint = 12; +pub const IORING_REGISTER_LAST: ::std::os::raw::c_uint = 13; +pub type _bindgen_ty_4 = ::std::os::raw::c_uint; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct io_uring_files_update { @@ -514,3 +312,42 @@ pub struct io_uring_probe { pub resv2: [u32; 3usize], pub ops: __IncompleteArrayField, } +#[repr(C)] +#[derive(Copy, Clone)] +pub struct io_uring_restriction { + pub opcode: u16, + pub __bindgen_anon_1: io_uring_restriction__bindgen_ty_1, + pub resv: u8, + pub resv2: [u32; 3usize], +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union io_uring_restriction__bindgen_ty_1 { + pub register_op: u8, + pub sqe_op: u8, + pub sqe_flags: u8, +} +impl Default for io_uring_restriction__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for io_uring_restriction { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub const IORING_RESTRICTION_REGISTER_OP: ::std::os::raw::c_uint = 0; +pub const IORING_RESTRICTION_SQE_OP: ::std::os::raw::c_uint = 1; +pub const IORING_RESTRICTION_SQE_FLAGS_ALLOWED: ::std::os::raw::c_uint = 2; +pub const IORING_RESTRICTION_SQE_FLAGS_REQUIRED: ::std::os::raw::c_uint = 3; +pub const IORING_RESTRICTION_LAST: ::std::os::raw::c_uint = 4; +pub type _bindgen_ty_5 = ::std::os::raw::c_uint; diff --git a/common/io_uring/src/uring.rs b/common/io_uring/src/uring.rs index 25a9f76105..4d17b3b927 100644 --- a/common/io_uring/src/uring.rs +++ b/common/io_uring/src/uring.rs @@ -81,22 +81,25 @@ struct SubmitQueue { // Helper functions to set io_uring_sqe bindgen union members in a less verbose manner. impl io_uring_sqe { pub fn set_addr(&mut self, val: u64) { - self.addr = val; + self.__bindgen_anon_2.addr = val; } pub fn set_off(&mut self, val: u64) { self.__bindgen_anon_1.off = val; } pub fn set_buf_index(&mut self, val: u16) { - self.__bindgen_anon_3.__bindgen_anon_1.buf_index = val; + self.__bindgen_anon_4 + .__bindgen_anon_1 + .__bindgen_anon_1 + .buf_index = val; } pub fn set_rw_flags(&mut self, val: libc::c_int) { - self.__bindgen_anon_2.rw_flags = val; + self.__bindgen_anon_3.rw_flags = val; } pub fn set_poll_events(&mut self, val: u16) { - self.__bindgen_anon_2.poll_events = val; + self.__bindgen_anon_3.poll_events = val; } } diff --git a/tools/bindgen-all-the-things b/tools/bindgen-all-the-things index 0374c5fe1c..71e54a0ec4 100755 --- a/tools/bindgen-all-the-things +++ b/tools/bindgen-all-the-things @@ -19,6 +19,7 @@ die() { } dirs=( + common/io_uring ) for d in "${dirs[@]}"; do