├── .cargo └── config ├── .github └── dependabot.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CODEOWNERS ├── CONTRIBUTING.md ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-BSD ├── README.md ├── coverage_config_x86_64.json └── src ├── bindings_v4_14_0 ├── mod.rs ├── virtio_blk.rs ├── virtio_net.rs └── virtio_ring.rs ├── bindings_v5_0_0 ├── mod.rs ├── virtio_blk.rs ├── virtio_net.rs └── virtio_ring.rs └── lib.rs /.cargo/config: -------------------------------------------------------------------------------- 1 | [target.aarch64-unknown-linux-musl] 2 | rustflags = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ] 3 | 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: gitsubmodule 4 | directory: "/" 5 | schedule: 6 | interval: monthly 7 | open-pull-requests-limit: 10 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock 4 | .idea 5 | kcov_output 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "rust-vmm-ci"] 2 | path = rust-vmm-ci 3 | url = https://github.com/rust-vmm/rust-vmm-ci.git 4 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # v0.1.0 2 | 3 | This is the first `virtio-bindings` crate release. 4 | 5 | This crate provides Rust FFI bindings to the 6 | [Virtual I/O Device (VIRTIO)](https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html) 7 | Linux kernel API. With this first release, the bindings are for the Linux kernel 8 | versions 4.14 and 5.0. 9 | 10 | The bindings are generated using [bindgen](https://crates.io/crates/bindgen). 11 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Add the list of code owners here (using their GitHub username) 2 | * gatekeeper-PullAssigner 3 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to virtio-bindings 2 | 3 | ## Dependencies 4 | 5 | ### Bindgen 6 | The bindings are currently generated using 7 | [bindgen](https://crates.io/crates/bindgen) version 0.49.0: 8 | ```bash 9 | cargo install bindgen --vers 0.49.0 10 | ``` 11 | 12 | ### Linux Kernel 13 | Generating bindings depends on the Linux kernel, so you need to have the 14 | repository on your machine: 15 | 16 | ```bash 17 | git clone https://github.com/torvalds/linux.git 18 | ``` 19 | 20 | ## Example for adding a new version 21 | 22 | For this example we assume that you have both linux and virtio-bindings 23 | repositories in your root. 24 | 25 | ```bash 26 | # Step 1: Crate a new module using a name with format "bindings_vVERSION" in 27 | # src/ 28 | cd virtio-bindings 29 | mkdir src/bindings_v5_0_0 30 | cd ~ 31 | 32 | # Step 2: Copy the "mod.rs" file from the directory of an already existing 33 | # version module to the one we've just created. 34 | cd virtio-bindings/src 35 | cp bindings_v4_14_0/mod.rs bindings_v5_0_0/mod.rs 36 | 37 | # linux is the repository that you cloned at the previous step. 38 | cd linux 39 | # Step 3: Checkout the version you want to generate the bindings for. 40 | git checkout v5.0 41 | 42 | # Step 4: Generate the bindings from the kernel headers. We need to 43 | # generate a file for each one of the virtio headers we're interested on. 44 | # For the moment, we're generating "virtio_blk", "virtio_net" and 45 | # "virtio_ring". Feel free to add additional header files if you need them 46 | # for your project. 47 | make headers_install INSTALL_HDR_PATH=v5_0_headers 48 | cd v5_0_headers 49 | for i in virtio_blk virtio_net virtio_ring ; do \ 50 | bindgen include/linux/$i.h -o $i.rs \ 51 | --with-derive-default \ 52 | --with-derive-partialeq \ 53 | -- -Iinclude 54 | done 55 | cd ~ 56 | 57 | # Step 6: Copy the generated files to the new version module. 58 | cp linux/v5_0_headers/*.rs virtio-bindings/src/bindings_v5_0_0 59 | ``` 60 | 61 | Once this is done, edit the generated files to add the proper license header, 62 | and add the new version module to `virtio-bindings/lib.rs`. If this version 63 | is newer than the others already present, make this version the default one 64 | by getting it imported when there isn't any other version specified as a 65 | feature: 66 | 67 | ```rust 68 | #[cfg(all(not(feature = "virtio-v4_14_0"), not(feature = "virtio-v5_0_0")))] 69 | pub use super::bindings_v5_0_0::*; 70 | ``` 71 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "virtio-bindings" 3 | version = "0.1.0" 4 | authors = ["Sergio Lopez "] 5 | description = "Rust FFI bindings to virtio generated using bindgen." 6 | repository = "https://github.com/rust-vmm/virtio-bindings" 7 | readme = "README.md" 8 | edition = "2018" 9 | keywords = ["virtio"] 10 | license = "BSD-3-Clause OR Apache-2.0" 11 | 12 | [features] 13 | virtio-v4_14_0 = [] 14 | virtio-v5_0_0 = [] 15 | 16 | [dependencies] -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /LICENSE-BSD: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019, Red Hat, Inc. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # virtio-bindings 2 | Rust FFI bindings to virtio generated using [bindgen](https://crates.io/crates/bindgen). 3 | 4 | # Usage 5 | Add this to your `Cargo.toml`: 6 | ```toml 7 | virtio-bindings = { version = "0.1", features = ["virtio-v5_0_0"]} 8 | ``` 9 | You can then import the bindings where you need them. As an example, to grab the 10 | bindings for virtio-blk, you can do: 11 | ```rust 12 | use virtio_bindings::bindings::virtio_blk::*; 13 | ``` 14 | In the `virtio-bindings` crate each feature maps to exactly one Linux version as follows: 15 | - `virtio-v4_14_0` contains the bindings for the Linux kernel version 4.14 16 | - `virtio-v5_0_0` contains the bindings for the Linux kernel version 5.0 17 | -------------------------------------------------------------------------------- /coverage_config_x86_64.json: -------------------------------------------------------------------------------- 1 | { 2 | "coverage_score": 68.8, 3 | "exclude_path": "", 4 | "crate_features": "" 5 | } 6 | -------------------------------------------------------------------------------- /src/bindings_v4_14_0/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. All Rights Reserved. 2 | // SPDX-License-Identifier: (BSD-3-Clause OR Apache-2.0) 3 | 4 | #![allow(clippy::all)] 5 | #![allow(non_upper_case_globals)] 6 | #![allow(non_camel_case_types)] 7 | #![allow(non_snake_case)] 8 | 9 | pub mod virtio_blk; 10 | pub mod virtio_net; 11 | pub mod virtio_ring; 12 | -------------------------------------------------------------------------------- /src/bindings_v4_14_0/virtio_blk.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | pub const __BITS_PER_LONG: u32 = 64; 4 | pub const __FD_SETSIZE: u32 = 1024; 5 | pub const VIRTIO_ID_NET: u32 = 1; 6 | pub const VIRTIO_ID_BLOCK: u32 = 2; 7 | pub const VIRTIO_ID_CONSOLE: u32 = 3; 8 | pub const VIRTIO_ID_RNG: u32 = 4; 9 | pub const VIRTIO_ID_BALLOON: u32 = 5; 10 | pub const VIRTIO_ID_RPMSG: u32 = 7; 11 | pub const VIRTIO_ID_SCSI: u32 = 8; 12 | pub const VIRTIO_ID_9P: u32 = 9; 13 | pub const VIRTIO_ID_RPROC_SERIAL: u32 = 11; 14 | pub const VIRTIO_ID_CAIF: u32 = 12; 15 | pub const VIRTIO_ID_GPU: u32 = 16; 16 | pub const VIRTIO_ID_INPUT: u32 = 18; 17 | pub const VIRTIO_ID_VSOCK: u32 = 19; 18 | pub const VIRTIO_ID_CRYPTO: u32 = 20; 19 | pub const VIRTIO_CONFIG_S_ACKNOWLEDGE: u32 = 1; 20 | pub const VIRTIO_CONFIG_S_DRIVER: u32 = 2; 21 | pub const VIRTIO_CONFIG_S_DRIVER_OK: u32 = 4; 22 | pub const VIRTIO_CONFIG_S_FEATURES_OK: u32 = 8; 23 | pub const VIRTIO_CONFIG_S_NEEDS_RESET: u32 = 64; 24 | pub const VIRTIO_CONFIG_S_FAILED: u32 = 128; 25 | pub const VIRTIO_TRANSPORT_F_START: u32 = 28; 26 | pub const VIRTIO_TRANSPORT_F_END: u32 = 34; 27 | pub const VIRTIO_F_NOTIFY_ON_EMPTY: u32 = 24; 28 | pub const VIRTIO_F_ANY_LAYOUT: u32 = 27; 29 | pub const VIRTIO_F_VERSION_1: u32 = 32; 30 | pub const VIRTIO_F_IOMMU_PLATFORM: u32 = 33; 31 | pub const VIRTIO_BLK_F_SIZE_MAX: u32 = 1; 32 | pub const VIRTIO_BLK_F_SEG_MAX: u32 = 2; 33 | pub const VIRTIO_BLK_F_GEOMETRY: u32 = 4; 34 | pub const VIRTIO_BLK_F_RO: u32 = 5; 35 | pub const VIRTIO_BLK_F_BLK_SIZE: u32 = 6; 36 | pub const VIRTIO_BLK_F_TOPOLOGY: u32 = 10; 37 | pub const VIRTIO_BLK_F_MQ: u32 = 12; 38 | pub const VIRTIO_BLK_F_BARRIER: u32 = 0; 39 | pub const VIRTIO_BLK_F_SCSI: u32 = 7; 40 | pub const VIRTIO_BLK_F_FLUSH: u32 = 9; 41 | pub const VIRTIO_BLK_F_CONFIG_WCE: u32 = 11; 42 | pub const VIRTIO_BLK_F_WCE: u32 = 9; 43 | pub const VIRTIO_BLK_ID_BYTES: u32 = 20; 44 | pub const VIRTIO_BLK_T_IN: u32 = 0; 45 | pub const VIRTIO_BLK_T_OUT: u32 = 1; 46 | pub const VIRTIO_BLK_T_SCSI_CMD: u32 = 2; 47 | pub const VIRTIO_BLK_T_FLUSH: u32 = 4; 48 | pub const VIRTIO_BLK_T_GET_ID: u32 = 8; 49 | pub const VIRTIO_BLK_T_BARRIER: u32 = 2147483648; 50 | pub const VIRTIO_BLK_S_OK: u32 = 0; 51 | pub const VIRTIO_BLK_S_IOERR: u32 = 1; 52 | pub const VIRTIO_BLK_S_UNSUPP: u32 = 2; 53 | pub type __s8 = ::std::os::raw::c_schar; 54 | pub type __u8 = ::std::os::raw::c_uchar; 55 | pub type __s16 = ::std::os::raw::c_short; 56 | pub type __u16 = ::std::os::raw::c_ushort; 57 | pub type __s32 = ::std::os::raw::c_int; 58 | pub type __u32 = ::std::os::raw::c_uint; 59 | pub type __s64 = ::std::os::raw::c_longlong; 60 | pub type __u64 = ::std::os::raw::c_ulonglong; 61 | #[repr(C)] 62 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 63 | pub struct __kernel_fd_set { 64 | pub fds_bits: [::std::os::raw::c_ulong; 16usize], 65 | } 66 | #[test] 67 | fn bindgen_test_layout___kernel_fd_set() { 68 | assert_eq!( 69 | ::std::mem::size_of::<__kernel_fd_set>(), 70 | 128usize, 71 | concat!("Size of: ", stringify!(__kernel_fd_set)) 72 | ); 73 | assert_eq!( 74 | ::std::mem::align_of::<__kernel_fd_set>(), 75 | 8usize, 76 | concat!("Alignment of ", stringify!(__kernel_fd_set)) 77 | ); 78 | assert_eq!( 79 | unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, 80 | 0usize, 81 | concat!( 82 | "Offset of field: ", 83 | stringify!(__kernel_fd_set), 84 | "::", 85 | stringify!(fds_bits) 86 | ) 87 | ); 88 | } 89 | pub type __kernel_sighandler_t = 90 | ::std::option::Option; 91 | pub type __kernel_key_t = ::std::os::raw::c_int; 92 | pub type __kernel_mqd_t = ::std::os::raw::c_int; 93 | pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; 94 | pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; 95 | pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; 96 | pub type __kernel_long_t = ::std::os::raw::c_long; 97 | pub type __kernel_ulong_t = ::std::os::raw::c_ulong; 98 | pub type __kernel_ino_t = __kernel_ulong_t; 99 | pub type __kernel_mode_t = ::std::os::raw::c_uint; 100 | pub type __kernel_pid_t = ::std::os::raw::c_int; 101 | pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; 102 | pub type __kernel_uid_t = ::std::os::raw::c_uint; 103 | pub type __kernel_gid_t = ::std::os::raw::c_uint; 104 | pub type __kernel_suseconds_t = __kernel_long_t; 105 | pub type __kernel_daddr_t = ::std::os::raw::c_int; 106 | pub type __kernel_uid32_t = ::std::os::raw::c_uint; 107 | pub type __kernel_gid32_t = ::std::os::raw::c_uint; 108 | pub type __kernel_size_t = __kernel_ulong_t; 109 | pub type __kernel_ssize_t = __kernel_long_t; 110 | pub type __kernel_ptrdiff_t = __kernel_long_t; 111 | #[repr(C)] 112 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 113 | pub struct __kernel_fsid_t { 114 | pub val: [::std::os::raw::c_int; 2usize], 115 | } 116 | #[test] 117 | fn bindgen_test_layout___kernel_fsid_t() { 118 | assert_eq!( 119 | ::std::mem::size_of::<__kernel_fsid_t>(), 120 | 8usize, 121 | concat!("Size of: ", stringify!(__kernel_fsid_t)) 122 | ); 123 | assert_eq!( 124 | ::std::mem::align_of::<__kernel_fsid_t>(), 125 | 4usize, 126 | concat!("Alignment of ", stringify!(__kernel_fsid_t)) 127 | ); 128 | assert_eq!( 129 | unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, 130 | 0usize, 131 | concat!( 132 | "Offset of field: ", 133 | stringify!(__kernel_fsid_t), 134 | "::", 135 | stringify!(val) 136 | ) 137 | ); 138 | } 139 | pub type __kernel_off_t = __kernel_long_t; 140 | pub type __kernel_loff_t = ::std::os::raw::c_longlong; 141 | pub type __kernel_time_t = __kernel_long_t; 142 | pub type __kernel_clock_t = __kernel_long_t; 143 | pub type __kernel_timer_t = ::std::os::raw::c_int; 144 | pub type __kernel_clockid_t = ::std::os::raw::c_int; 145 | pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; 146 | pub type __kernel_uid16_t = ::std::os::raw::c_ushort; 147 | pub type __kernel_gid16_t = ::std::os::raw::c_ushort; 148 | pub type __le16 = __u16; 149 | pub type __be16 = __u16; 150 | pub type __le32 = __u32; 151 | pub type __be32 = __u32; 152 | pub type __le64 = __u64; 153 | pub type __be64 = __u64; 154 | pub type __sum16 = __u16; 155 | pub type __wsum = __u32; 156 | pub type __virtio16 = __u16; 157 | pub type __virtio32 = __u32; 158 | pub type __virtio64 = __u64; 159 | #[repr(C, packed)] 160 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 161 | pub struct virtio_blk_config { 162 | pub capacity: __u64, 163 | pub size_max: __u32, 164 | pub seg_max: __u32, 165 | pub geometry: virtio_blk_config_virtio_blk_geometry, 166 | pub blk_size: __u32, 167 | pub physical_block_exp: __u8, 168 | pub alignment_offset: __u8, 169 | pub min_io_size: __u16, 170 | pub opt_io_size: __u32, 171 | pub wce: __u8, 172 | pub unused: __u8, 173 | pub num_queues: __u16, 174 | } 175 | #[repr(C)] 176 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 177 | pub struct virtio_blk_config_virtio_blk_geometry { 178 | pub cylinders: __u16, 179 | pub heads: __u8, 180 | pub sectors: __u8, 181 | } 182 | #[test] 183 | fn bindgen_test_layout_virtio_blk_config_virtio_blk_geometry() { 184 | assert_eq!( 185 | ::std::mem::size_of::(), 186 | 4usize, 187 | concat!( 188 | "Size of: ", 189 | stringify!(virtio_blk_config_virtio_blk_geometry) 190 | ) 191 | ); 192 | assert_eq!( 193 | ::std::mem::align_of::(), 194 | 2usize, 195 | concat!( 196 | "Alignment of ", 197 | stringify!(virtio_blk_config_virtio_blk_geometry) 198 | ) 199 | ); 200 | assert_eq!( 201 | unsafe { 202 | &(*(::std::ptr::null::())).cylinders as *const _ 203 | as usize 204 | }, 205 | 0usize, 206 | concat!( 207 | "Offset of field: ", 208 | stringify!(virtio_blk_config_virtio_blk_geometry), 209 | "::", 210 | stringify!(cylinders) 211 | ) 212 | ); 213 | assert_eq!( 214 | unsafe { 215 | &(*(::std::ptr::null::())).heads as *const _ 216 | as usize 217 | }, 218 | 2usize, 219 | concat!( 220 | "Offset of field: ", 221 | stringify!(virtio_blk_config_virtio_blk_geometry), 222 | "::", 223 | stringify!(heads) 224 | ) 225 | ); 226 | assert_eq!( 227 | unsafe { 228 | &(*(::std::ptr::null::())).sectors as *const _ 229 | as usize 230 | }, 231 | 3usize, 232 | concat!( 233 | "Offset of field: ", 234 | stringify!(virtio_blk_config_virtio_blk_geometry), 235 | "::", 236 | stringify!(sectors) 237 | ) 238 | ); 239 | } 240 | #[test] 241 | fn bindgen_test_layout_virtio_blk_config() { 242 | assert_eq!( 243 | ::std::mem::size_of::(), 244 | 36usize, 245 | concat!("Size of: ", stringify!(virtio_blk_config)) 246 | ); 247 | assert_eq!( 248 | ::std::mem::align_of::(), 249 | 1usize, 250 | concat!("Alignment of ", stringify!(virtio_blk_config)) 251 | ); 252 | assert_eq!( 253 | unsafe { &(*(::std::ptr::null::())).capacity as *const _ as usize }, 254 | 0usize, 255 | concat!( 256 | "Offset of field: ", 257 | stringify!(virtio_blk_config), 258 | "::", 259 | stringify!(capacity) 260 | ) 261 | ); 262 | assert_eq!( 263 | unsafe { &(*(::std::ptr::null::())).size_max as *const _ as usize }, 264 | 8usize, 265 | concat!( 266 | "Offset of field: ", 267 | stringify!(virtio_blk_config), 268 | "::", 269 | stringify!(size_max) 270 | ) 271 | ); 272 | assert_eq!( 273 | unsafe { &(*(::std::ptr::null::())).seg_max as *const _ as usize }, 274 | 12usize, 275 | concat!( 276 | "Offset of field: ", 277 | stringify!(virtio_blk_config), 278 | "::", 279 | stringify!(seg_max) 280 | ) 281 | ); 282 | assert_eq!( 283 | unsafe { &(*(::std::ptr::null::())).geometry as *const _ as usize }, 284 | 16usize, 285 | concat!( 286 | "Offset of field: ", 287 | stringify!(virtio_blk_config), 288 | "::", 289 | stringify!(geometry) 290 | ) 291 | ); 292 | assert_eq!( 293 | unsafe { &(*(::std::ptr::null::())).blk_size as *const _ as usize }, 294 | 20usize, 295 | concat!( 296 | "Offset of field: ", 297 | stringify!(virtio_blk_config), 298 | "::", 299 | stringify!(blk_size) 300 | ) 301 | ); 302 | assert_eq!( 303 | unsafe { 304 | &(*(::std::ptr::null::())).physical_block_exp as *const _ as usize 305 | }, 306 | 24usize, 307 | concat!( 308 | "Offset of field: ", 309 | stringify!(virtio_blk_config), 310 | "::", 311 | stringify!(physical_block_exp) 312 | ) 313 | ); 314 | assert_eq!( 315 | unsafe { 316 | &(*(::std::ptr::null::())).alignment_offset as *const _ as usize 317 | }, 318 | 25usize, 319 | concat!( 320 | "Offset of field: ", 321 | stringify!(virtio_blk_config), 322 | "::", 323 | stringify!(alignment_offset) 324 | ) 325 | ); 326 | assert_eq!( 327 | unsafe { &(*(::std::ptr::null::())).min_io_size as *const _ as usize }, 328 | 26usize, 329 | concat!( 330 | "Offset of field: ", 331 | stringify!(virtio_blk_config), 332 | "::", 333 | stringify!(min_io_size) 334 | ) 335 | ); 336 | assert_eq!( 337 | unsafe { &(*(::std::ptr::null::())).opt_io_size as *const _ as usize }, 338 | 28usize, 339 | concat!( 340 | "Offset of field: ", 341 | stringify!(virtio_blk_config), 342 | "::", 343 | stringify!(opt_io_size) 344 | ) 345 | ); 346 | assert_eq!( 347 | unsafe { &(*(::std::ptr::null::())).wce as *const _ as usize }, 348 | 32usize, 349 | concat!( 350 | "Offset of field: ", 351 | stringify!(virtio_blk_config), 352 | "::", 353 | stringify!(wce) 354 | ) 355 | ); 356 | assert_eq!( 357 | unsafe { &(*(::std::ptr::null::())).unused as *const _ as usize }, 358 | 33usize, 359 | concat!( 360 | "Offset of field: ", 361 | stringify!(virtio_blk_config), 362 | "::", 363 | stringify!(unused) 364 | ) 365 | ); 366 | assert_eq!( 367 | unsafe { &(*(::std::ptr::null::())).num_queues as *const _ as usize }, 368 | 34usize, 369 | concat!( 370 | "Offset of field: ", 371 | stringify!(virtio_blk_config), 372 | "::", 373 | stringify!(num_queues) 374 | ) 375 | ); 376 | } 377 | #[repr(C)] 378 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 379 | pub struct virtio_blk_outhdr { 380 | pub type_: __virtio32, 381 | pub ioprio: __virtio32, 382 | pub sector: __virtio64, 383 | } 384 | #[test] 385 | fn bindgen_test_layout_virtio_blk_outhdr() { 386 | assert_eq!( 387 | ::std::mem::size_of::(), 388 | 16usize, 389 | concat!("Size of: ", stringify!(virtio_blk_outhdr)) 390 | ); 391 | assert_eq!( 392 | ::std::mem::align_of::(), 393 | 8usize, 394 | concat!("Alignment of ", stringify!(virtio_blk_outhdr)) 395 | ); 396 | assert_eq!( 397 | unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, 398 | 0usize, 399 | concat!( 400 | "Offset of field: ", 401 | stringify!(virtio_blk_outhdr), 402 | "::", 403 | stringify!(type_) 404 | ) 405 | ); 406 | assert_eq!( 407 | unsafe { &(*(::std::ptr::null::())).ioprio as *const _ as usize }, 408 | 4usize, 409 | concat!( 410 | "Offset of field: ", 411 | stringify!(virtio_blk_outhdr), 412 | "::", 413 | stringify!(ioprio) 414 | ) 415 | ); 416 | assert_eq!( 417 | unsafe { &(*(::std::ptr::null::())).sector as *const _ as usize }, 418 | 8usize, 419 | concat!( 420 | "Offset of field: ", 421 | stringify!(virtio_blk_outhdr), 422 | "::", 423 | stringify!(sector) 424 | ) 425 | ); 426 | } 427 | #[repr(C)] 428 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 429 | pub struct virtio_scsi_inhdr { 430 | pub errors: __virtio32, 431 | pub data_len: __virtio32, 432 | pub sense_len: __virtio32, 433 | pub residual: __virtio32, 434 | } 435 | #[test] 436 | fn bindgen_test_layout_virtio_scsi_inhdr() { 437 | assert_eq!( 438 | ::std::mem::size_of::(), 439 | 16usize, 440 | concat!("Size of: ", stringify!(virtio_scsi_inhdr)) 441 | ); 442 | assert_eq!( 443 | ::std::mem::align_of::(), 444 | 4usize, 445 | concat!("Alignment of ", stringify!(virtio_scsi_inhdr)) 446 | ); 447 | assert_eq!( 448 | unsafe { &(*(::std::ptr::null::())).errors as *const _ as usize }, 449 | 0usize, 450 | concat!( 451 | "Offset of field: ", 452 | stringify!(virtio_scsi_inhdr), 453 | "::", 454 | stringify!(errors) 455 | ) 456 | ); 457 | assert_eq!( 458 | unsafe { &(*(::std::ptr::null::())).data_len as *const _ as usize }, 459 | 4usize, 460 | concat!( 461 | "Offset of field: ", 462 | stringify!(virtio_scsi_inhdr), 463 | "::", 464 | stringify!(data_len) 465 | ) 466 | ); 467 | assert_eq!( 468 | unsafe { &(*(::std::ptr::null::())).sense_len as *const _ as usize }, 469 | 8usize, 470 | concat!( 471 | "Offset of field: ", 472 | stringify!(virtio_scsi_inhdr), 473 | "::", 474 | stringify!(sense_len) 475 | ) 476 | ); 477 | assert_eq!( 478 | unsafe { &(*(::std::ptr::null::())).residual as *const _ as usize }, 479 | 12usize, 480 | concat!( 481 | "Offset of field: ", 482 | stringify!(virtio_scsi_inhdr), 483 | "::", 484 | stringify!(residual) 485 | ) 486 | ); 487 | } 488 | -------------------------------------------------------------------------------- /src/bindings_v4_14_0/virtio_net.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #[repr(C)] 4 | #[derive(Default)] 5 | pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); 6 | impl __IncompleteArrayField { 7 | #[inline] 8 | pub fn new() -> Self { 9 | __IncompleteArrayField(::std::marker::PhantomData, []) 10 | } 11 | #[inline] 12 | pub unsafe fn as_ptr(&self) -> *const T { 13 | ::std::mem::transmute(self) 14 | } 15 | #[inline] 16 | pub unsafe fn as_mut_ptr(&mut self) -> *mut T { 17 | ::std::mem::transmute(self) 18 | } 19 | #[inline] 20 | pub unsafe fn as_slice(&self, len: usize) -> &[T] { 21 | ::std::slice::from_raw_parts(self.as_ptr(), len) 22 | } 23 | #[inline] 24 | pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { 25 | ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) 26 | } 27 | } 28 | impl ::std::fmt::Debug for __IncompleteArrayField { 29 | fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 30 | fmt.write_str("__IncompleteArrayField") 31 | } 32 | } 33 | impl ::std::clone::Clone for __IncompleteArrayField { 34 | #[inline] 35 | fn clone(&self) -> Self { 36 | Self::new() 37 | } 38 | } 39 | pub const __BITS_PER_LONG: u32 = 64; 40 | pub const __FD_SETSIZE: u32 = 1024; 41 | pub const VIRTIO_ID_NET: u32 = 1; 42 | pub const VIRTIO_ID_BLOCK: u32 = 2; 43 | pub const VIRTIO_ID_CONSOLE: u32 = 3; 44 | pub const VIRTIO_ID_RNG: u32 = 4; 45 | pub const VIRTIO_ID_BALLOON: u32 = 5; 46 | pub const VIRTIO_ID_RPMSG: u32 = 7; 47 | pub const VIRTIO_ID_SCSI: u32 = 8; 48 | pub const VIRTIO_ID_9P: u32 = 9; 49 | pub const VIRTIO_ID_RPROC_SERIAL: u32 = 11; 50 | pub const VIRTIO_ID_CAIF: u32 = 12; 51 | pub const VIRTIO_ID_GPU: u32 = 16; 52 | pub const VIRTIO_ID_INPUT: u32 = 18; 53 | pub const VIRTIO_ID_VSOCK: u32 = 19; 54 | pub const VIRTIO_ID_CRYPTO: u32 = 20; 55 | pub const VIRTIO_CONFIG_S_ACKNOWLEDGE: u32 = 1; 56 | pub const VIRTIO_CONFIG_S_DRIVER: u32 = 2; 57 | pub const VIRTIO_CONFIG_S_DRIVER_OK: u32 = 4; 58 | pub const VIRTIO_CONFIG_S_FEATURES_OK: u32 = 8; 59 | pub const VIRTIO_CONFIG_S_NEEDS_RESET: u32 = 64; 60 | pub const VIRTIO_CONFIG_S_FAILED: u32 = 128; 61 | pub const VIRTIO_TRANSPORT_F_START: u32 = 28; 62 | pub const VIRTIO_TRANSPORT_F_END: u32 = 34; 63 | pub const VIRTIO_F_NOTIFY_ON_EMPTY: u32 = 24; 64 | pub const VIRTIO_F_ANY_LAYOUT: u32 = 27; 65 | pub const VIRTIO_F_VERSION_1: u32 = 32; 66 | pub const VIRTIO_F_IOMMU_PLATFORM: u32 = 33; 67 | pub const ETH_ALEN: u32 = 6; 68 | pub const ETH_HLEN: u32 = 14; 69 | pub const ETH_ZLEN: u32 = 60; 70 | pub const ETH_DATA_LEN: u32 = 1500; 71 | pub const ETH_FRAME_LEN: u32 = 1514; 72 | pub const ETH_FCS_LEN: u32 = 4; 73 | pub const ETH_MIN_MTU: u32 = 68; 74 | pub const ETH_MAX_MTU: u32 = 65535; 75 | pub const ETH_P_LOOP: u32 = 96; 76 | pub const ETH_P_PUP: u32 = 512; 77 | pub const ETH_P_PUPAT: u32 = 513; 78 | pub const ETH_P_TSN: u32 = 8944; 79 | pub const ETH_P_IP: u32 = 2048; 80 | pub const ETH_P_X25: u32 = 2053; 81 | pub const ETH_P_ARP: u32 = 2054; 82 | pub const ETH_P_BPQ: u32 = 2303; 83 | pub const ETH_P_IEEEPUP: u32 = 2560; 84 | pub const ETH_P_IEEEPUPAT: u32 = 2561; 85 | pub const ETH_P_BATMAN: u32 = 17157; 86 | pub const ETH_P_DEC: u32 = 24576; 87 | pub const ETH_P_DNA_DL: u32 = 24577; 88 | pub const ETH_P_DNA_RC: u32 = 24578; 89 | pub const ETH_P_DNA_RT: u32 = 24579; 90 | pub const ETH_P_LAT: u32 = 24580; 91 | pub const ETH_P_DIAG: u32 = 24581; 92 | pub const ETH_P_CUST: u32 = 24582; 93 | pub const ETH_P_SCA: u32 = 24583; 94 | pub const ETH_P_TEB: u32 = 25944; 95 | pub const ETH_P_RARP: u32 = 32821; 96 | pub const ETH_P_ATALK: u32 = 32923; 97 | pub const ETH_P_AARP: u32 = 33011; 98 | pub const ETH_P_8021Q: u32 = 33024; 99 | pub const ETH_P_ERSPAN: u32 = 35006; 100 | pub const ETH_P_IPX: u32 = 33079; 101 | pub const ETH_P_IPV6: u32 = 34525; 102 | pub const ETH_P_PAUSE: u32 = 34824; 103 | pub const ETH_P_SLOW: u32 = 34825; 104 | pub const ETH_P_WCCP: u32 = 34878; 105 | pub const ETH_P_MPLS_UC: u32 = 34887; 106 | pub const ETH_P_MPLS_MC: u32 = 34888; 107 | pub const ETH_P_ATMMPOA: u32 = 34892; 108 | pub const ETH_P_PPP_DISC: u32 = 34915; 109 | pub const ETH_P_PPP_SES: u32 = 34916; 110 | pub const ETH_P_LINK_CTL: u32 = 34924; 111 | pub const ETH_P_ATMFATE: u32 = 34948; 112 | pub const ETH_P_PAE: u32 = 34958; 113 | pub const ETH_P_AOE: u32 = 34978; 114 | pub const ETH_P_8021AD: u32 = 34984; 115 | pub const ETH_P_802_EX1: u32 = 34997; 116 | pub const ETH_P_TIPC: u32 = 35018; 117 | pub const ETH_P_MACSEC: u32 = 35045; 118 | pub const ETH_P_8021AH: u32 = 35047; 119 | pub const ETH_P_MVRP: u32 = 35061; 120 | pub const ETH_P_1588: u32 = 35063; 121 | pub const ETH_P_NCSI: u32 = 35064; 122 | pub const ETH_P_PRP: u32 = 35067; 123 | pub const ETH_P_FCOE: u32 = 35078; 124 | pub const ETH_P_IBOE: u32 = 35093; 125 | pub const ETH_P_TDLS: u32 = 35085; 126 | pub const ETH_P_FIP: u32 = 35092; 127 | pub const ETH_P_80221: u32 = 35095; 128 | pub const ETH_P_HSR: u32 = 35119; 129 | pub const ETH_P_NSH: u32 = 35151; 130 | pub const ETH_P_LOOPBACK: u32 = 36864; 131 | pub const ETH_P_QINQ1: u32 = 37120; 132 | pub const ETH_P_QINQ2: u32 = 37376; 133 | pub const ETH_P_QINQ3: u32 = 37632; 134 | pub const ETH_P_EDSA: u32 = 56026; 135 | pub const ETH_P_IFE: u32 = 60734; 136 | pub const ETH_P_AF_IUCV: u32 = 64507; 137 | pub const ETH_P_802_3_MIN: u32 = 1536; 138 | pub const ETH_P_802_3: u32 = 1; 139 | pub const ETH_P_AX25: u32 = 2; 140 | pub const ETH_P_ALL: u32 = 3; 141 | pub const ETH_P_802_2: u32 = 4; 142 | pub const ETH_P_SNAP: u32 = 5; 143 | pub const ETH_P_DDCMP: u32 = 6; 144 | pub const ETH_P_WAN_PPP: u32 = 7; 145 | pub const ETH_P_PPP_MP: u32 = 8; 146 | pub const ETH_P_LOCALTALK: u32 = 9; 147 | pub const ETH_P_CAN: u32 = 12; 148 | pub const ETH_P_CANFD: u32 = 13; 149 | pub const ETH_P_PPPTALK: u32 = 16; 150 | pub const ETH_P_TR_802_2: u32 = 17; 151 | pub const ETH_P_MOBITEX: u32 = 21; 152 | pub const ETH_P_CONTROL: u32 = 22; 153 | pub const ETH_P_IRDA: u32 = 23; 154 | pub const ETH_P_ECONET: u32 = 24; 155 | pub const ETH_P_HDLC: u32 = 25; 156 | pub const ETH_P_ARCNET: u32 = 26; 157 | pub const ETH_P_DSA: u32 = 27; 158 | pub const ETH_P_TRAILER: u32 = 28; 159 | pub const ETH_P_PHONET: u32 = 245; 160 | pub const ETH_P_IEEE802154: u32 = 246; 161 | pub const ETH_P_CAIF: u32 = 247; 162 | pub const ETH_P_XDSA: u32 = 248; 163 | pub const ETH_P_MAP: u32 = 249; 164 | pub const VIRTIO_NET_F_CSUM: u32 = 0; 165 | pub const VIRTIO_NET_F_GUEST_CSUM: u32 = 1; 166 | pub const VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: u32 = 2; 167 | pub const VIRTIO_NET_F_MTU: u32 = 3; 168 | pub const VIRTIO_NET_F_MAC: u32 = 5; 169 | pub const VIRTIO_NET_F_GUEST_TSO4: u32 = 7; 170 | pub const VIRTIO_NET_F_GUEST_TSO6: u32 = 8; 171 | pub const VIRTIO_NET_F_GUEST_ECN: u32 = 9; 172 | pub const VIRTIO_NET_F_GUEST_UFO: u32 = 10; 173 | pub const VIRTIO_NET_F_HOST_TSO4: u32 = 11; 174 | pub const VIRTIO_NET_F_HOST_TSO6: u32 = 12; 175 | pub const VIRTIO_NET_F_HOST_ECN: u32 = 13; 176 | pub const VIRTIO_NET_F_HOST_UFO: u32 = 14; 177 | pub const VIRTIO_NET_F_MRG_RXBUF: u32 = 15; 178 | pub const VIRTIO_NET_F_STATUS: u32 = 16; 179 | pub const VIRTIO_NET_F_CTRL_VQ: u32 = 17; 180 | pub const VIRTIO_NET_F_CTRL_RX: u32 = 18; 181 | pub const VIRTIO_NET_F_CTRL_VLAN: u32 = 19; 182 | pub const VIRTIO_NET_F_CTRL_RX_EXTRA: u32 = 20; 183 | pub const VIRTIO_NET_F_GUEST_ANNOUNCE: u32 = 21; 184 | pub const VIRTIO_NET_F_MQ: u32 = 22; 185 | pub const VIRTIO_NET_F_CTRL_MAC_ADDR: u32 = 23; 186 | pub const VIRTIO_NET_F_GSO: u32 = 6; 187 | pub const VIRTIO_NET_S_LINK_UP: u32 = 1; 188 | pub const VIRTIO_NET_S_ANNOUNCE: u32 = 2; 189 | pub const VIRTIO_NET_HDR_F_NEEDS_CSUM: u32 = 1; 190 | pub const VIRTIO_NET_HDR_F_DATA_VALID: u32 = 2; 191 | pub const VIRTIO_NET_HDR_GSO_NONE: u32 = 0; 192 | pub const VIRTIO_NET_HDR_GSO_TCPV4: u32 = 1; 193 | pub const VIRTIO_NET_HDR_GSO_UDP: u32 = 3; 194 | pub const VIRTIO_NET_HDR_GSO_TCPV6: u32 = 4; 195 | pub const VIRTIO_NET_HDR_GSO_ECN: u32 = 128; 196 | pub const VIRTIO_NET_OK: u32 = 0; 197 | pub const VIRTIO_NET_ERR: u32 = 1; 198 | pub const VIRTIO_NET_CTRL_RX: u32 = 0; 199 | pub const VIRTIO_NET_CTRL_RX_PROMISC: u32 = 0; 200 | pub const VIRTIO_NET_CTRL_RX_ALLMULTI: u32 = 1; 201 | pub const VIRTIO_NET_CTRL_RX_ALLUNI: u32 = 2; 202 | pub const VIRTIO_NET_CTRL_RX_NOMULTI: u32 = 3; 203 | pub const VIRTIO_NET_CTRL_RX_NOUNI: u32 = 4; 204 | pub const VIRTIO_NET_CTRL_RX_NOBCAST: u32 = 5; 205 | pub const VIRTIO_NET_CTRL_MAC: u32 = 1; 206 | pub const VIRTIO_NET_CTRL_MAC_TABLE_SET: u32 = 0; 207 | pub const VIRTIO_NET_CTRL_MAC_ADDR_SET: u32 = 1; 208 | pub const VIRTIO_NET_CTRL_VLAN: u32 = 2; 209 | pub const VIRTIO_NET_CTRL_VLAN_ADD: u32 = 0; 210 | pub const VIRTIO_NET_CTRL_VLAN_DEL: u32 = 1; 211 | pub const VIRTIO_NET_CTRL_ANNOUNCE: u32 = 3; 212 | pub const VIRTIO_NET_CTRL_ANNOUNCE_ACK: u32 = 0; 213 | pub const VIRTIO_NET_CTRL_MQ: u32 = 4; 214 | pub const VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET: u32 = 0; 215 | pub const VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN: u32 = 1; 216 | pub const VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX: u32 = 32768; 217 | pub const VIRTIO_NET_CTRL_GUEST_OFFLOADS: u32 = 5; 218 | pub const VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET: u32 = 0; 219 | pub type __s8 = ::std::os::raw::c_schar; 220 | pub type __u8 = ::std::os::raw::c_uchar; 221 | pub type __s16 = ::std::os::raw::c_short; 222 | pub type __u16 = ::std::os::raw::c_ushort; 223 | pub type __s32 = ::std::os::raw::c_int; 224 | pub type __u32 = ::std::os::raw::c_uint; 225 | pub type __s64 = ::std::os::raw::c_longlong; 226 | pub type __u64 = ::std::os::raw::c_ulonglong; 227 | #[repr(C)] 228 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 229 | pub struct __kernel_fd_set { 230 | pub fds_bits: [::std::os::raw::c_ulong; 16usize], 231 | } 232 | #[test] 233 | fn bindgen_test_layout___kernel_fd_set() { 234 | assert_eq!( 235 | ::std::mem::size_of::<__kernel_fd_set>(), 236 | 128usize, 237 | concat!("Size of: ", stringify!(__kernel_fd_set)) 238 | ); 239 | assert_eq!( 240 | ::std::mem::align_of::<__kernel_fd_set>(), 241 | 8usize, 242 | concat!("Alignment of ", stringify!(__kernel_fd_set)) 243 | ); 244 | assert_eq!( 245 | unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, 246 | 0usize, 247 | concat!( 248 | "Offset of field: ", 249 | stringify!(__kernel_fd_set), 250 | "::", 251 | stringify!(fds_bits) 252 | ) 253 | ); 254 | } 255 | pub type __kernel_sighandler_t = 256 | ::std::option::Option; 257 | pub type __kernel_key_t = ::std::os::raw::c_int; 258 | pub type __kernel_mqd_t = ::std::os::raw::c_int; 259 | pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; 260 | pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; 261 | pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; 262 | pub type __kernel_long_t = ::std::os::raw::c_long; 263 | pub type __kernel_ulong_t = ::std::os::raw::c_ulong; 264 | pub type __kernel_ino_t = __kernel_ulong_t; 265 | pub type __kernel_mode_t = ::std::os::raw::c_uint; 266 | pub type __kernel_pid_t = ::std::os::raw::c_int; 267 | pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; 268 | pub type __kernel_uid_t = ::std::os::raw::c_uint; 269 | pub type __kernel_gid_t = ::std::os::raw::c_uint; 270 | pub type __kernel_suseconds_t = __kernel_long_t; 271 | pub type __kernel_daddr_t = ::std::os::raw::c_int; 272 | pub type __kernel_uid32_t = ::std::os::raw::c_uint; 273 | pub type __kernel_gid32_t = ::std::os::raw::c_uint; 274 | pub type __kernel_size_t = __kernel_ulong_t; 275 | pub type __kernel_ssize_t = __kernel_long_t; 276 | pub type __kernel_ptrdiff_t = __kernel_long_t; 277 | #[repr(C)] 278 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 279 | pub struct __kernel_fsid_t { 280 | pub val: [::std::os::raw::c_int; 2usize], 281 | } 282 | #[test] 283 | fn bindgen_test_layout___kernel_fsid_t() { 284 | assert_eq!( 285 | ::std::mem::size_of::<__kernel_fsid_t>(), 286 | 8usize, 287 | concat!("Size of: ", stringify!(__kernel_fsid_t)) 288 | ); 289 | assert_eq!( 290 | ::std::mem::align_of::<__kernel_fsid_t>(), 291 | 4usize, 292 | concat!("Alignment of ", stringify!(__kernel_fsid_t)) 293 | ); 294 | assert_eq!( 295 | unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, 296 | 0usize, 297 | concat!( 298 | "Offset of field: ", 299 | stringify!(__kernel_fsid_t), 300 | "::", 301 | stringify!(val) 302 | ) 303 | ); 304 | } 305 | pub type __kernel_off_t = __kernel_long_t; 306 | pub type __kernel_loff_t = ::std::os::raw::c_longlong; 307 | pub type __kernel_time_t = __kernel_long_t; 308 | pub type __kernel_clock_t = __kernel_long_t; 309 | pub type __kernel_timer_t = ::std::os::raw::c_int; 310 | pub type __kernel_clockid_t = ::std::os::raw::c_int; 311 | pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; 312 | pub type __kernel_uid16_t = ::std::os::raw::c_ushort; 313 | pub type __kernel_gid16_t = ::std::os::raw::c_ushort; 314 | pub type __le16 = __u16; 315 | pub type __be16 = __u16; 316 | pub type __le32 = __u32; 317 | pub type __be32 = __u32; 318 | pub type __le64 = __u64; 319 | pub type __be64 = __u64; 320 | pub type __sum16 = __u16; 321 | pub type __wsum = __u32; 322 | pub type __virtio16 = __u16; 323 | pub type __virtio32 = __u32; 324 | pub type __virtio64 = __u64; 325 | #[repr(C, packed)] 326 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 327 | pub struct ethhdr { 328 | pub h_dest: [::std::os::raw::c_uchar; 6usize], 329 | pub h_source: [::std::os::raw::c_uchar; 6usize], 330 | pub h_proto: __be16, 331 | } 332 | #[test] 333 | fn bindgen_test_layout_ethhdr() { 334 | assert_eq!( 335 | ::std::mem::size_of::(), 336 | 14usize, 337 | concat!("Size of: ", stringify!(ethhdr)) 338 | ); 339 | assert_eq!( 340 | ::std::mem::align_of::(), 341 | 1usize, 342 | concat!("Alignment of ", stringify!(ethhdr)) 343 | ); 344 | assert_eq!( 345 | unsafe { &(*(::std::ptr::null::())).h_dest as *const _ as usize }, 346 | 0usize, 347 | concat!( 348 | "Offset of field: ", 349 | stringify!(ethhdr), 350 | "::", 351 | stringify!(h_dest) 352 | ) 353 | ); 354 | assert_eq!( 355 | unsafe { &(*(::std::ptr::null::())).h_source as *const _ as usize }, 356 | 6usize, 357 | concat!( 358 | "Offset of field: ", 359 | stringify!(ethhdr), 360 | "::", 361 | stringify!(h_source) 362 | ) 363 | ); 364 | assert_eq!( 365 | unsafe { &(*(::std::ptr::null::())).h_proto as *const _ as usize }, 366 | 12usize, 367 | concat!( 368 | "Offset of field: ", 369 | stringify!(ethhdr), 370 | "::", 371 | stringify!(h_proto) 372 | ) 373 | ); 374 | } 375 | #[repr(C, packed)] 376 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 377 | pub struct virtio_net_config { 378 | pub mac: [__u8; 6usize], 379 | pub status: __u16, 380 | pub max_virtqueue_pairs: __u16, 381 | pub mtu: __u16, 382 | } 383 | #[test] 384 | fn bindgen_test_layout_virtio_net_config() { 385 | assert_eq!( 386 | ::std::mem::size_of::(), 387 | 12usize, 388 | concat!("Size of: ", stringify!(virtio_net_config)) 389 | ); 390 | assert_eq!( 391 | ::std::mem::align_of::(), 392 | 1usize, 393 | concat!("Alignment of ", stringify!(virtio_net_config)) 394 | ); 395 | assert_eq!( 396 | unsafe { &(*(::std::ptr::null::())).mac as *const _ as usize }, 397 | 0usize, 398 | concat!( 399 | "Offset of field: ", 400 | stringify!(virtio_net_config), 401 | "::", 402 | stringify!(mac) 403 | ) 404 | ); 405 | assert_eq!( 406 | unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, 407 | 6usize, 408 | concat!( 409 | "Offset of field: ", 410 | stringify!(virtio_net_config), 411 | "::", 412 | stringify!(status) 413 | ) 414 | ); 415 | assert_eq!( 416 | unsafe { 417 | &(*(::std::ptr::null::())).max_virtqueue_pairs as *const _ as usize 418 | }, 419 | 8usize, 420 | concat!( 421 | "Offset of field: ", 422 | stringify!(virtio_net_config), 423 | "::", 424 | stringify!(max_virtqueue_pairs) 425 | ) 426 | ); 427 | assert_eq!( 428 | unsafe { &(*(::std::ptr::null::())).mtu as *const _ as usize }, 429 | 10usize, 430 | concat!( 431 | "Offset of field: ", 432 | stringify!(virtio_net_config), 433 | "::", 434 | stringify!(mtu) 435 | ) 436 | ); 437 | } 438 | #[repr(C)] 439 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 440 | pub struct virtio_net_hdr_v1 { 441 | pub flags: __u8, 442 | pub gso_type: __u8, 443 | pub hdr_len: __virtio16, 444 | pub gso_size: __virtio16, 445 | pub csum_start: __virtio16, 446 | pub csum_offset: __virtio16, 447 | pub num_buffers: __virtio16, 448 | } 449 | #[test] 450 | fn bindgen_test_layout_virtio_net_hdr_v1() { 451 | assert_eq!( 452 | ::std::mem::size_of::(), 453 | 12usize, 454 | concat!("Size of: ", stringify!(virtio_net_hdr_v1)) 455 | ); 456 | assert_eq!( 457 | ::std::mem::align_of::(), 458 | 2usize, 459 | concat!("Alignment of ", stringify!(virtio_net_hdr_v1)) 460 | ); 461 | assert_eq!( 462 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 463 | 0usize, 464 | concat!( 465 | "Offset of field: ", 466 | stringify!(virtio_net_hdr_v1), 467 | "::", 468 | stringify!(flags) 469 | ) 470 | ); 471 | assert_eq!( 472 | unsafe { &(*(::std::ptr::null::())).gso_type as *const _ as usize }, 473 | 1usize, 474 | concat!( 475 | "Offset of field: ", 476 | stringify!(virtio_net_hdr_v1), 477 | "::", 478 | stringify!(gso_type) 479 | ) 480 | ); 481 | assert_eq!( 482 | unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, 483 | 2usize, 484 | concat!( 485 | "Offset of field: ", 486 | stringify!(virtio_net_hdr_v1), 487 | "::", 488 | stringify!(hdr_len) 489 | ) 490 | ); 491 | assert_eq!( 492 | unsafe { &(*(::std::ptr::null::())).gso_size as *const _ as usize }, 493 | 4usize, 494 | concat!( 495 | "Offset of field: ", 496 | stringify!(virtio_net_hdr_v1), 497 | "::", 498 | stringify!(gso_size) 499 | ) 500 | ); 501 | assert_eq!( 502 | unsafe { &(*(::std::ptr::null::())).csum_start as *const _ as usize }, 503 | 6usize, 504 | concat!( 505 | "Offset of field: ", 506 | stringify!(virtio_net_hdr_v1), 507 | "::", 508 | stringify!(csum_start) 509 | ) 510 | ); 511 | assert_eq!( 512 | unsafe { &(*(::std::ptr::null::())).csum_offset as *const _ as usize }, 513 | 8usize, 514 | concat!( 515 | "Offset of field: ", 516 | stringify!(virtio_net_hdr_v1), 517 | "::", 518 | stringify!(csum_offset) 519 | ) 520 | ); 521 | assert_eq!( 522 | unsafe { &(*(::std::ptr::null::())).num_buffers as *const _ as usize }, 523 | 10usize, 524 | concat!( 525 | "Offset of field: ", 526 | stringify!(virtio_net_hdr_v1), 527 | "::", 528 | stringify!(num_buffers) 529 | ) 530 | ); 531 | } 532 | #[repr(C)] 533 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 534 | pub struct virtio_net_hdr { 535 | pub flags: __u8, 536 | pub gso_type: __u8, 537 | pub hdr_len: __virtio16, 538 | pub gso_size: __virtio16, 539 | pub csum_start: __virtio16, 540 | pub csum_offset: __virtio16, 541 | } 542 | #[test] 543 | fn bindgen_test_layout_virtio_net_hdr() { 544 | assert_eq!( 545 | ::std::mem::size_of::(), 546 | 10usize, 547 | concat!("Size of: ", stringify!(virtio_net_hdr)) 548 | ); 549 | assert_eq!( 550 | ::std::mem::align_of::(), 551 | 2usize, 552 | concat!("Alignment of ", stringify!(virtio_net_hdr)) 553 | ); 554 | assert_eq!( 555 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 556 | 0usize, 557 | concat!( 558 | "Offset of field: ", 559 | stringify!(virtio_net_hdr), 560 | "::", 561 | stringify!(flags) 562 | ) 563 | ); 564 | assert_eq!( 565 | unsafe { &(*(::std::ptr::null::())).gso_type as *const _ as usize }, 566 | 1usize, 567 | concat!( 568 | "Offset of field: ", 569 | stringify!(virtio_net_hdr), 570 | "::", 571 | stringify!(gso_type) 572 | ) 573 | ); 574 | assert_eq!( 575 | unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, 576 | 2usize, 577 | concat!( 578 | "Offset of field: ", 579 | stringify!(virtio_net_hdr), 580 | "::", 581 | stringify!(hdr_len) 582 | ) 583 | ); 584 | assert_eq!( 585 | unsafe { &(*(::std::ptr::null::())).gso_size as *const _ as usize }, 586 | 4usize, 587 | concat!( 588 | "Offset of field: ", 589 | stringify!(virtio_net_hdr), 590 | "::", 591 | stringify!(gso_size) 592 | ) 593 | ); 594 | assert_eq!( 595 | unsafe { &(*(::std::ptr::null::())).csum_start as *const _ as usize }, 596 | 6usize, 597 | concat!( 598 | "Offset of field: ", 599 | stringify!(virtio_net_hdr), 600 | "::", 601 | stringify!(csum_start) 602 | ) 603 | ); 604 | assert_eq!( 605 | unsafe { &(*(::std::ptr::null::())).csum_offset as *const _ as usize }, 606 | 8usize, 607 | concat!( 608 | "Offset of field: ", 609 | stringify!(virtio_net_hdr), 610 | "::", 611 | stringify!(csum_offset) 612 | ) 613 | ); 614 | } 615 | #[repr(C)] 616 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 617 | pub struct virtio_net_hdr_mrg_rxbuf { 618 | pub hdr: virtio_net_hdr, 619 | pub num_buffers: __virtio16, 620 | } 621 | #[test] 622 | fn bindgen_test_layout_virtio_net_hdr_mrg_rxbuf() { 623 | assert_eq!( 624 | ::std::mem::size_of::(), 625 | 12usize, 626 | concat!("Size of: ", stringify!(virtio_net_hdr_mrg_rxbuf)) 627 | ); 628 | assert_eq!( 629 | ::std::mem::align_of::(), 630 | 2usize, 631 | concat!("Alignment of ", stringify!(virtio_net_hdr_mrg_rxbuf)) 632 | ); 633 | assert_eq!( 634 | unsafe { &(*(::std::ptr::null::())).hdr as *const _ as usize }, 635 | 0usize, 636 | concat!( 637 | "Offset of field: ", 638 | stringify!(virtio_net_hdr_mrg_rxbuf), 639 | "::", 640 | stringify!(hdr) 641 | ) 642 | ); 643 | assert_eq!( 644 | unsafe { 645 | &(*(::std::ptr::null::())).num_buffers as *const _ as usize 646 | }, 647 | 10usize, 648 | concat!( 649 | "Offset of field: ", 650 | stringify!(virtio_net_hdr_mrg_rxbuf), 651 | "::", 652 | stringify!(num_buffers) 653 | ) 654 | ); 655 | } 656 | #[repr(C, packed)] 657 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 658 | pub struct virtio_net_ctrl_hdr { 659 | pub class: __u8, 660 | pub cmd: __u8, 661 | } 662 | #[test] 663 | fn bindgen_test_layout_virtio_net_ctrl_hdr() { 664 | assert_eq!( 665 | ::std::mem::size_of::(), 666 | 2usize, 667 | concat!("Size of: ", stringify!(virtio_net_ctrl_hdr)) 668 | ); 669 | assert_eq!( 670 | ::std::mem::align_of::(), 671 | 1usize, 672 | concat!("Alignment of ", stringify!(virtio_net_ctrl_hdr)) 673 | ); 674 | assert_eq!( 675 | unsafe { &(*(::std::ptr::null::())).class as *const _ as usize }, 676 | 0usize, 677 | concat!( 678 | "Offset of field: ", 679 | stringify!(virtio_net_ctrl_hdr), 680 | "::", 681 | stringify!(class) 682 | ) 683 | ); 684 | assert_eq!( 685 | unsafe { &(*(::std::ptr::null::())).cmd as *const _ as usize }, 686 | 1usize, 687 | concat!( 688 | "Offset of field: ", 689 | stringify!(virtio_net_ctrl_hdr), 690 | "::", 691 | stringify!(cmd) 692 | ) 693 | ); 694 | } 695 | pub type virtio_net_ctrl_ack = __u8; 696 | #[repr(C, packed)] 697 | #[derive(Default)] 698 | pub struct virtio_net_ctrl_mac { 699 | pub entries: __virtio32, 700 | pub macs: __IncompleteArrayField<[__u8; 6usize]>, 701 | } 702 | #[test] 703 | fn bindgen_test_layout_virtio_net_ctrl_mac() { 704 | assert_eq!( 705 | ::std::mem::size_of::(), 706 | 4usize, 707 | concat!("Size of: ", stringify!(virtio_net_ctrl_mac)) 708 | ); 709 | assert_eq!( 710 | ::std::mem::align_of::(), 711 | 1usize, 712 | concat!("Alignment of ", stringify!(virtio_net_ctrl_mac)) 713 | ); 714 | } 715 | #[repr(C)] 716 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 717 | pub struct virtio_net_ctrl_mq { 718 | pub virtqueue_pairs: __virtio16, 719 | } 720 | #[test] 721 | fn bindgen_test_layout_virtio_net_ctrl_mq() { 722 | assert_eq!( 723 | ::std::mem::size_of::(), 724 | 2usize, 725 | concat!("Size of: ", stringify!(virtio_net_ctrl_mq)) 726 | ); 727 | assert_eq!( 728 | ::std::mem::align_of::(), 729 | 2usize, 730 | concat!("Alignment of ", stringify!(virtio_net_ctrl_mq)) 731 | ); 732 | assert_eq!( 733 | unsafe { 734 | &(*(::std::ptr::null::())).virtqueue_pairs as *const _ as usize 735 | }, 736 | 0usize, 737 | concat!( 738 | "Offset of field: ", 739 | stringify!(virtio_net_ctrl_mq), 740 | "::", 741 | stringify!(virtqueue_pairs) 742 | ) 743 | ); 744 | } 745 | -------------------------------------------------------------------------------- /src/bindings_v4_14_0/virtio_ring.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #[repr(C)] 4 | #[derive(Default)] 5 | pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); 6 | impl __IncompleteArrayField { 7 | #[inline] 8 | pub fn new() -> Self { 9 | __IncompleteArrayField(::std::marker::PhantomData, []) 10 | } 11 | #[inline] 12 | pub unsafe fn as_ptr(&self) -> *const T { 13 | ::std::mem::transmute(self) 14 | } 15 | #[inline] 16 | pub unsafe fn as_mut_ptr(&mut self) -> *mut T { 17 | ::std::mem::transmute(self) 18 | } 19 | #[inline] 20 | pub unsafe fn as_slice(&self, len: usize) -> &[T] { 21 | ::std::slice::from_raw_parts(self.as_ptr(), len) 22 | } 23 | #[inline] 24 | pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { 25 | ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) 26 | } 27 | } 28 | impl ::std::fmt::Debug for __IncompleteArrayField { 29 | fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 30 | fmt.write_str("__IncompleteArrayField") 31 | } 32 | } 33 | impl ::std::clone::Clone for __IncompleteArrayField { 34 | #[inline] 35 | fn clone(&self) -> Self { 36 | Self::new() 37 | } 38 | } 39 | pub const _STDINT_H: u32 = 1; 40 | pub const _FEATURES_H: u32 = 1; 41 | pub const _DEFAULT_SOURCE: u32 = 1; 42 | pub const __USE_ISOC11: u32 = 1; 43 | pub const __USE_ISOC99: u32 = 1; 44 | pub const __USE_ISOC95: u32 = 1; 45 | pub const __USE_POSIX_IMPLICITLY: u32 = 1; 46 | pub const _POSIX_SOURCE: u32 = 1; 47 | pub const _POSIX_C_SOURCE: u32 = 200809; 48 | pub const __USE_POSIX: u32 = 1; 49 | pub const __USE_POSIX2: u32 = 1; 50 | pub const __USE_POSIX199309: u32 = 1; 51 | pub const __USE_POSIX199506: u32 = 1; 52 | pub const __USE_XOPEN2K: u32 = 1; 53 | pub const __USE_XOPEN2K8: u32 = 1; 54 | pub const _ATFILE_SOURCE: u32 = 1; 55 | pub const __USE_MISC: u32 = 1; 56 | pub const __USE_ATFILE: u32 = 1; 57 | pub const __USE_FORTIFY_LEVEL: u32 = 0; 58 | pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; 59 | pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; 60 | pub const _STDC_PREDEF_H: u32 = 1; 61 | pub const __STDC_IEC_559__: u32 = 1; 62 | pub const __STDC_IEC_559_COMPLEX__: u32 = 1; 63 | pub const __STDC_ISO_10646__: u32 = 201706; 64 | pub const __GNU_LIBRARY__: u32 = 6; 65 | pub const __GLIBC__: u32 = 2; 66 | pub const __GLIBC_MINOR__: u32 = 29; 67 | pub const _SYS_CDEFS_H: u32 = 1; 68 | pub const __glibc_c99_flexarr_available: u32 = 1; 69 | pub const __WORDSIZE: u32 = 64; 70 | pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; 71 | pub const __SYSCALL_WORDSIZE: u32 = 64; 72 | pub const __HAVE_GENERIC_SELECTION: u32 = 1; 73 | pub const __GLIBC_USE_LIB_EXT2: u32 = 0; 74 | pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; 75 | pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; 76 | pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; 77 | pub const _BITS_TYPES_H: u32 = 1; 78 | pub const __TIMESIZE: u32 = 64; 79 | pub const _BITS_TYPESIZES_H: u32 = 1; 80 | pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; 81 | pub const __INO_T_MATCHES_INO64_T: u32 = 1; 82 | pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; 83 | pub const __FD_SETSIZE: u32 = 1024; 84 | pub const _BITS_TIME64_H: u32 = 1; 85 | pub const _BITS_WCHAR_H: u32 = 1; 86 | pub const _BITS_STDINT_INTN_H: u32 = 1; 87 | pub const _BITS_STDINT_UINTN_H: u32 = 1; 88 | pub const INT8_MIN: i32 = -128; 89 | pub const INT16_MIN: i32 = -32768; 90 | pub const INT32_MIN: i32 = -2147483648; 91 | pub const INT8_MAX: u32 = 127; 92 | pub const INT16_MAX: u32 = 32767; 93 | pub const INT32_MAX: u32 = 2147483647; 94 | pub const UINT8_MAX: u32 = 255; 95 | pub const UINT16_MAX: u32 = 65535; 96 | pub const UINT32_MAX: u32 = 4294967295; 97 | pub const INT_LEAST8_MIN: i32 = -128; 98 | pub const INT_LEAST16_MIN: i32 = -32768; 99 | pub const INT_LEAST32_MIN: i32 = -2147483648; 100 | pub const INT_LEAST8_MAX: u32 = 127; 101 | pub const INT_LEAST16_MAX: u32 = 32767; 102 | pub const INT_LEAST32_MAX: u32 = 2147483647; 103 | pub const UINT_LEAST8_MAX: u32 = 255; 104 | pub const UINT_LEAST16_MAX: u32 = 65535; 105 | pub const UINT_LEAST32_MAX: u32 = 4294967295; 106 | pub const INT_FAST8_MIN: i32 = -128; 107 | pub const INT_FAST16_MIN: i64 = -9223372036854775808; 108 | pub const INT_FAST32_MIN: i64 = -9223372036854775808; 109 | pub const INT_FAST8_MAX: u32 = 127; 110 | pub const INT_FAST16_MAX: u64 = 9223372036854775807; 111 | pub const INT_FAST32_MAX: u64 = 9223372036854775807; 112 | pub const UINT_FAST8_MAX: u32 = 255; 113 | pub const UINT_FAST16_MAX: i32 = -1; 114 | pub const UINT_FAST32_MAX: i32 = -1; 115 | pub const INTPTR_MIN: i64 = -9223372036854775808; 116 | pub const INTPTR_MAX: u64 = 9223372036854775807; 117 | pub const UINTPTR_MAX: i32 = -1; 118 | pub const PTRDIFF_MIN: i64 = -9223372036854775808; 119 | pub const PTRDIFF_MAX: u64 = 9223372036854775807; 120 | pub const SIG_ATOMIC_MIN: i32 = -2147483648; 121 | pub const SIG_ATOMIC_MAX: u32 = 2147483647; 122 | pub const SIZE_MAX: i32 = -1; 123 | pub const WINT_MIN: u32 = 0; 124 | pub const WINT_MAX: u32 = 4294967295; 125 | pub const __BITS_PER_LONG: u32 = 64; 126 | pub const VRING_DESC_F_NEXT: u32 = 1; 127 | pub const VRING_DESC_F_WRITE: u32 = 2; 128 | pub const VRING_DESC_F_INDIRECT: u32 = 4; 129 | pub const VRING_USED_F_NO_NOTIFY: u32 = 1; 130 | pub const VRING_AVAIL_F_NO_INTERRUPT: u32 = 1; 131 | pub const VIRTIO_RING_F_INDIRECT_DESC: u32 = 28; 132 | pub const VIRTIO_RING_F_EVENT_IDX: u32 = 29; 133 | pub const VRING_AVAIL_ALIGN_SIZE: u32 = 2; 134 | pub const VRING_USED_ALIGN_SIZE: u32 = 4; 135 | pub const VRING_DESC_ALIGN_SIZE: u32 = 16; 136 | pub type __u_char = ::std::os::raw::c_uchar; 137 | pub type __u_short = ::std::os::raw::c_ushort; 138 | pub type __u_int = ::std::os::raw::c_uint; 139 | pub type __u_long = ::std::os::raw::c_ulong; 140 | pub type __int8_t = ::std::os::raw::c_schar; 141 | pub type __uint8_t = ::std::os::raw::c_uchar; 142 | pub type __int16_t = ::std::os::raw::c_short; 143 | pub type __uint16_t = ::std::os::raw::c_ushort; 144 | pub type __int32_t = ::std::os::raw::c_int; 145 | pub type __uint32_t = ::std::os::raw::c_uint; 146 | pub type __int64_t = ::std::os::raw::c_long; 147 | pub type __uint64_t = ::std::os::raw::c_ulong; 148 | pub type __int_least8_t = __int8_t; 149 | pub type __uint_least8_t = __uint8_t; 150 | pub type __int_least16_t = __int16_t; 151 | pub type __uint_least16_t = __uint16_t; 152 | pub type __int_least32_t = __int32_t; 153 | pub type __uint_least32_t = __uint32_t; 154 | pub type __int_least64_t = __int64_t; 155 | pub type __uint_least64_t = __uint64_t; 156 | pub type __quad_t = ::std::os::raw::c_long; 157 | pub type __u_quad_t = ::std::os::raw::c_ulong; 158 | pub type __intmax_t = ::std::os::raw::c_long; 159 | pub type __uintmax_t = ::std::os::raw::c_ulong; 160 | pub type __dev_t = ::std::os::raw::c_ulong; 161 | pub type __uid_t = ::std::os::raw::c_uint; 162 | pub type __gid_t = ::std::os::raw::c_uint; 163 | pub type __ino_t = ::std::os::raw::c_ulong; 164 | pub type __ino64_t = ::std::os::raw::c_ulong; 165 | pub type __mode_t = ::std::os::raw::c_uint; 166 | pub type __nlink_t = ::std::os::raw::c_ulong; 167 | pub type __off_t = ::std::os::raw::c_long; 168 | pub type __off64_t = ::std::os::raw::c_long; 169 | pub type __pid_t = ::std::os::raw::c_int; 170 | #[repr(C)] 171 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 172 | pub struct __fsid_t { 173 | pub __val: [::std::os::raw::c_int; 2usize], 174 | } 175 | #[test] 176 | fn bindgen_test_layout___fsid_t() { 177 | assert_eq!( 178 | ::std::mem::size_of::<__fsid_t>(), 179 | 8usize, 180 | concat!("Size of: ", stringify!(__fsid_t)) 181 | ); 182 | assert_eq!( 183 | ::std::mem::align_of::<__fsid_t>(), 184 | 4usize, 185 | concat!("Alignment of ", stringify!(__fsid_t)) 186 | ); 187 | assert_eq!( 188 | unsafe { &(*(::std::ptr::null::<__fsid_t>())).__val as *const _ as usize }, 189 | 0usize, 190 | concat!( 191 | "Offset of field: ", 192 | stringify!(__fsid_t), 193 | "::", 194 | stringify!(__val) 195 | ) 196 | ); 197 | } 198 | pub type __clock_t = ::std::os::raw::c_long; 199 | pub type __rlim_t = ::std::os::raw::c_ulong; 200 | pub type __rlim64_t = ::std::os::raw::c_ulong; 201 | pub type __id_t = ::std::os::raw::c_uint; 202 | pub type __time_t = ::std::os::raw::c_long; 203 | pub type __useconds_t = ::std::os::raw::c_uint; 204 | pub type __suseconds_t = ::std::os::raw::c_long; 205 | pub type __daddr_t = ::std::os::raw::c_int; 206 | pub type __key_t = ::std::os::raw::c_int; 207 | pub type __clockid_t = ::std::os::raw::c_int; 208 | pub type __timer_t = *mut ::std::os::raw::c_void; 209 | pub type __blksize_t = ::std::os::raw::c_long; 210 | pub type __blkcnt_t = ::std::os::raw::c_long; 211 | pub type __blkcnt64_t = ::std::os::raw::c_long; 212 | pub type __fsblkcnt_t = ::std::os::raw::c_ulong; 213 | pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; 214 | pub type __fsfilcnt_t = ::std::os::raw::c_ulong; 215 | pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; 216 | pub type __fsword_t = ::std::os::raw::c_long; 217 | pub type __ssize_t = ::std::os::raw::c_long; 218 | pub type __syscall_slong_t = ::std::os::raw::c_long; 219 | pub type __syscall_ulong_t = ::std::os::raw::c_ulong; 220 | pub type __loff_t = __off64_t; 221 | pub type __caddr_t = *mut ::std::os::raw::c_char; 222 | pub type __intptr_t = ::std::os::raw::c_long; 223 | pub type __socklen_t = ::std::os::raw::c_uint; 224 | pub type __sig_atomic_t = ::std::os::raw::c_int; 225 | pub type int_least8_t = __int_least8_t; 226 | pub type int_least16_t = __int_least16_t; 227 | pub type int_least32_t = __int_least32_t; 228 | pub type int_least64_t = __int_least64_t; 229 | pub type uint_least8_t = __uint_least8_t; 230 | pub type uint_least16_t = __uint_least16_t; 231 | pub type uint_least32_t = __uint_least32_t; 232 | pub type uint_least64_t = __uint_least64_t; 233 | pub type int_fast8_t = ::std::os::raw::c_schar; 234 | pub type int_fast16_t = ::std::os::raw::c_long; 235 | pub type int_fast32_t = ::std::os::raw::c_long; 236 | pub type int_fast64_t = ::std::os::raw::c_long; 237 | pub type uint_fast8_t = ::std::os::raw::c_uchar; 238 | pub type uint_fast16_t = ::std::os::raw::c_ulong; 239 | pub type uint_fast32_t = ::std::os::raw::c_ulong; 240 | pub type uint_fast64_t = ::std::os::raw::c_ulong; 241 | pub type intmax_t = __intmax_t; 242 | pub type uintmax_t = __uintmax_t; 243 | pub type __s8 = ::std::os::raw::c_schar; 244 | pub type __u8 = ::std::os::raw::c_uchar; 245 | pub type __s16 = ::std::os::raw::c_short; 246 | pub type __u16 = ::std::os::raw::c_ushort; 247 | pub type __s32 = ::std::os::raw::c_int; 248 | pub type __u32 = ::std::os::raw::c_uint; 249 | pub type __s64 = ::std::os::raw::c_longlong; 250 | pub type __u64 = ::std::os::raw::c_ulonglong; 251 | #[repr(C)] 252 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 253 | pub struct __kernel_fd_set { 254 | pub fds_bits: [::std::os::raw::c_ulong; 16usize], 255 | } 256 | #[test] 257 | fn bindgen_test_layout___kernel_fd_set() { 258 | assert_eq!( 259 | ::std::mem::size_of::<__kernel_fd_set>(), 260 | 128usize, 261 | concat!("Size of: ", stringify!(__kernel_fd_set)) 262 | ); 263 | assert_eq!( 264 | ::std::mem::align_of::<__kernel_fd_set>(), 265 | 8usize, 266 | concat!("Alignment of ", stringify!(__kernel_fd_set)) 267 | ); 268 | assert_eq!( 269 | unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, 270 | 0usize, 271 | concat!( 272 | "Offset of field: ", 273 | stringify!(__kernel_fd_set), 274 | "::", 275 | stringify!(fds_bits) 276 | ) 277 | ); 278 | } 279 | pub type __kernel_sighandler_t = 280 | ::std::option::Option; 281 | pub type __kernel_key_t = ::std::os::raw::c_int; 282 | pub type __kernel_mqd_t = ::std::os::raw::c_int; 283 | pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; 284 | pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; 285 | pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; 286 | pub type __kernel_long_t = ::std::os::raw::c_long; 287 | pub type __kernel_ulong_t = ::std::os::raw::c_ulong; 288 | pub type __kernel_ino_t = __kernel_ulong_t; 289 | pub type __kernel_mode_t = ::std::os::raw::c_uint; 290 | pub type __kernel_pid_t = ::std::os::raw::c_int; 291 | pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; 292 | pub type __kernel_uid_t = ::std::os::raw::c_uint; 293 | pub type __kernel_gid_t = ::std::os::raw::c_uint; 294 | pub type __kernel_suseconds_t = __kernel_long_t; 295 | pub type __kernel_daddr_t = ::std::os::raw::c_int; 296 | pub type __kernel_uid32_t = ::std::os::raw::c_uint; 297 | pub type __kernel_gid32_t = ::std::os::raw::c_uint; 298 | pub type __kernel_size_t = __kernel_ulong_t; 299 | pub type __kernel_ssize_t = __kernel_long_t; 300 | pub type __kernel_ptrdiff_t = __kernel_long_t; 301 | #[repr(C)] 302 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 303 | pub struct __kernel_fsid_t { 304 | pub val: [::std::os::raw::c_int; 2usize], 305 | } 306 | #[test] 307 | fn bindgen_test_layout___kernel_fsid_t() { 308 | assert_eq!( 309 | ::std::mem::size_of::<__kernel_fsid_t>(), 310 | 8usize, 311 | concat!("Size of: ", stringify!(__kernel_fsid_t)) 312 | ); 313 | assert_eq!( 314 | ::std::mem::align_of::<__kernel_fsid_t>(), 315 | 4usize, 316 | concat!("Alignment of ", stringify!(__kernel_fsid_t)) 317 | ); 318 | assert_eq!( 319 | unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, 320 | 0usize, 321 | concat!( 322 | "Offset of field: ", 323 | stringify!(__kernel_fsid_t), 324 | "::", 325 | stringify!(val) 326 | ) 327 | ); 328 | } 329 | pub type __kernel_off_t = __kernel_long_t; 330 | pub type __kernel_loff_t = ::std::os::raw::c_longlong; 331 | pub type __kernel_time_t = __kernel_long_t; 332 | pub type __kernel_clock_t = __kernel_long_t; 333 | pub type __kernel_timer_t = ::std::os::raw::c_int; 334 | pub type __kernel_clockid_t = ::std::os::raw::c_int; 335 | pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; 336 | pub type __kernel_uid16_t = ::std::os::raw::c_ushort; 337 | pub type __kernel_gid16_t = ::std::os::raw::c_ushort; 338 | pub type __le16 = __u16; 339 | pub type __be16 = __u16; 340 | pub type __le32 = __u32; 341 | pub type __be32 = __u32; 342 | pub type __le64 = __u64; 343 | pub type __be64 = __u64; 344 | pub type __sum16 = __u16; 345 | pub type __wsum = __u32; 346 | pub type __virtio16 = __u16; 347 | pub type __virtio32 = __u32; 348 | pub type __virtio64 = __u64; 349 | #[repr(C)] 350 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 351 | pub struct vring_desc { 352 | pub addr: __virtio64, 353 | pub len: __virtio32, 354 | pub flags: __virtio16, 355 | pub next: __virtio16, 356 | } 357 | #[test] 358 | fn bindgen_test_layout_vring_desc() { 359 | assert_eq!( 360 | ::std::mem::size_of::(), 361 | 16usize, 362 | concat!("Size of: ", stringify!(vring_desc)) 363 | ); 364 | assert_eq!( 365 | ::std::mem::align_of::(), 366 | 8usize, 367 | concat!("Alignment of ", stringify!(vring_desc)) 368 | ); 369 | assert_eq!( 370 | unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, 371 | 0usize, 372 | concat!( 373 | "Offset of field: ", 374 | stringify!(vring_desc), 375 | "::", 376 | stringify!(addr) 377 | ) 378 | ); 379 | assert_eq!( 380 | unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, 381 | 8usize, 382 | concat!( 383 | "Offset of field: ", 384 | stringify!(vring_desc), 385 | "::", 386 | stringify!(len) 387 | ) 388 | ); 389 | assert_eq!( 390 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 391 | 12usize, 392 | concat!( 393 | "Offset of field: ", 394 | stringify!(vring_desc), 395 | "::", 396 | stringify!(flags) 397 | ) 398 | ); 399 | assert_eq!( 400 | unsafe { &(*(::std::ptr::null::())).next as *const _ as usize }, 401 | 14usize, 402 | concat!( 403 | "Offset of field: ", 404 | stringify!(vring_desc), 405 | "::", 406 | stringify!(next) 407 | ) 408 | ); 409 | } 410 | #[repr(C)] 411 | #[derive(Debug, Default)] 412 | pub struct vring_avail { 413 | pub flags: __virtio16, 414 | pub idx: __virtio16, 415 | pub ring: __IncompleteArrayField<__virtio16>, 416 | } 417 | #[test] 418 | fn bindgen_test_layout_vring_avail() { 419 | assert_eq!( 420 | ::std::mem::size_of::(), 421 | 4usize, 422 | concat!("Size of: ", stringify!(vring_avail)) 423 | ); 424 | assert_eq!( 425 | ::std::mem::align_of::(), 426 | 2usize, 427 | concat!("Alignment of ", stringify!(vring_avail)) 428 | ); 429 | } 430 | #[repr(C)] 431 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 432 | pub struct vring_used_elem { 433 | pub id: __virtio32, 434 | pub len: __virtio32, 435 | } 436 | #[test] 437 | fn bindgen_test_layout_vring_used_elem() { 438 | assert_eq!( 439 | ::std::mem::size_of::(), 440 | 8usize, 441 | concat!("Size of: ", stringify!(vring_used_elem)) 442 | ); 443 | assert_eq!( 444 | ::std::mem::align_of::(), 445 | 4usize, 446 | concat!("Alignment of ", stringify!(vring_used_elem)) 447 | ); 448 | assert_eq!( 449 | unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, 450 | 0usize, 451 | concat!( 452 | "Offset of field: ", 453 | stringify!(vring_used_elem), 454 | "::", 455 | stringify!(id) 456 | ) 457 | ); 458 | assert_eq!( 459 | unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, 460 | 4usize, 461 | concat!( 462 | "Offset of field: ", 463 | stringify!(vring_used_elem), 464 | "::", 465 | stringify!(len) 466 | ) 467 | ); 468 | } 469 | #[repr(C)] 470 | #[derive(Debug, Default)] 471 | pub struct vring_used { 472 | pub flags: __virtio16, 473 | pub idx: __virtio16, 474 | pub ring: __IncompleteArrayField, 475 | pub __bindgen_align: [u32; 0usize], 476 | } 477 | #[test] 478 | fn bindgen_test_layout_vring_used() { 479 | assert_eq!( 480 | ::std::mem::size_of::(), 481 | 4usize, 482 | concat!("Size of: ", stringify!(vring_used)) 483 | ); 484 | assert_eq!( 485 | ::std::mem::align_of::(), 486 | 4usize, 487 | concat!("Alignment of ", stringify!(vring_used)) 488 | ); 489 | } 490 | #[repr(C)] 491 | #[derive(Debug, Copy, Clone, PartialEq)] 492 | pub struct vring { 493 | pub num: ::std::os::raw::c_uint, 494 | pub desc: *mut vring_desc, 495 | pub avail: *mut vring_avail, 496 | pub used: *mut vring_used, 497 | } 498 | #[test] 499 | fn bindgen_test_layout_vring() { 500 | assert_eq!( 501 | ::std::mem::size_of::(), 502 | 32usize, 503 | concat!("Size of: ", stringify!(vring)) 504 | ); 505 | assert_eq!( 506 | ::std::mem::align_of::(), 507 | 8usize, 508 | concat!("Alignment of ", stringify!(vring)) 509 | ); 510 | assert_eq!( 511 | unsafe { &(*(::std::ptr::null::())).num as *const _ as usize }, 512 | 0usize, 513 | concat!( 514 | "Offset of field: ", 515 | stringify!(vring), 516 | "::", 517 | stringify!(num) 518 | ) 519 | ); 520 | assert_eq!( 521 | unsafe { &(*(::std::ptr::null::())).desc as *const _ as usize }, 522 | 8usize, 523 | concat!( 524 | "Offset of field: ", 525 | stringify!(vring), 526 | "::", 527 | stringify!(desc) 528 | ) 529 | ); 530 | assert_eq!( 531 | unsafe { &(*(::std::ptr::null::())).avail as *const _ as usize }, 532 | 16usize, 533 | concat!( 534 | "Offset of field: ", 535 | stringify!(vring), 536 | "::", 537 | stringify!(avail) 538 | ) 539 | ); 540 | assert_eq!( 541 | unsafe { &(*(::std::ptr::null::())).used as *const _ as usize }, 542 | 24usize, 543 | concat!( 544 | "Offset of field: ", 545 | stringify!(vring), 546 | "::", 547 | stringify!(used) 548 | ) 549 | ); 550 | } 551 | impl Default for vring { 552 | fn default() -> Self { 553 | unsafe { ::std::mem::zeroed() } 554 | } 555 | } 556 | -------------------------------------------------------------------------------- /src/bindings_v5_0_0/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. All Rights Reserved. 2 | // SPDX-License-Identifier: (BSD-3-Clause OR Apache-2.0) 3 | 4 | #![allow(clippy::all)] 5 | #![allow(non_upper_case_globals)] 6 | #![allow(non_camel_case_types)] 7 | #![allow(non_snake_case)] 8 | // Keep this until https://github.com/rust-lang/rust-bindgen/issues/1651 is fixed. 9 | #![cfg_attr(test, allow(deref_nullptr, unaligned_references))] 10 | 11 | pub mod virtio_blk; 12 | pub mod virtio_net; 13 | pub mod virtio_ring; 14 | -------------------------------------------------------------------------------- /src/bindings_v5_0_0/virtio_blk.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | pub const __BITS_PER_LONG: u32 = 64; 4 | pub const __FD_SETSIZE: u32 = 1024; 5 | pub const VIRTIO_ID_NET: u32 = 1; 6 | pub const VIRTIO_ID_BLOCK: u32 = 2; 7 | pub const VIRTIO_ID_CONSOLE: u32 = 3; 8 | pub const VIRTIO_ID_RNG: u32 = 4; 9 | pub const VIRTIO_ID_BALLOON: u32 = 5; 10 | pub const VIRTIO_ID_RPMSG: u32 = 7; 11 | pub const VIRTIO_ID_SCSI: u32 = 8; 12 | pub const VIRTIO_ID_9P: u32 = 9; 13 | pub const VIRTIO_ID_RPROC_SERIAL: u32 = 11; 14 | pub const VIRTIO_ID_CAIF: u32 = 12; 15 | pub const VIRTIO_ID_GPU: u32 = 16; 16 | pub const VIRTIO_ID_INPUT: u32 = 18; 17 | pub const VIRTIO_ID_VSOCK: u32 = 19; 18 | pub const VIRTIO_ID_CRYPTO: u32 = 20; 19 | pub const VIRTIO_CONFIG_S_ACKNOWLEDGE: u32 = 1; 20 | pub const VIRTIO_CONFIG_S_DRIVER: u32 = 2; 21 | pub const VIRTIO_CONFIG_S_DRIVER_OK: u32 = 4; 22 | pub const VIRTIO_CONFIG_S_FEATURES_OK: u32 = 8; 23 | pub const VIRTIO_CONFIG_S_NEEDS_RESET: u32 = 64; 24 | pub const VIRTIO_CONFIG_S_FAILED: u32 = 128; 25 | pub const VIRTIO_TRANSPORT_F_START: u32 = 28; 26 | pub const VIRTIO_TRANSPORT_F_END: u32 = 38; 27 | pub const VIRTIO_F_NOTIFY_ON_EMPTY: u32 = 24; 28 | pub const VIRTIO_F_ANY_LAYOUT: u32 = 27; 29 | pub const VIRTIO_F_VERSION_1: u32 = 32; 30 | pub const VIRTIO_F_IOMMU_PLATFORM: u32 = 33; 31 | pub const VIRTIO_F_RING_PACKED: u32 = 34; 32 | pub const VIRTIO_F_ORDER_PLATFORM: u32 = 36; 33 | pub const VIRTIO_F_SR_IOV: u32 = 37; 34 | pub const VIRTIO_BLK_F_SIZE_MAX: u32 = 1; 35 | pub const VIRTIO_BLK_F_SEG_MAX: u32 = 2; 36 | pub const VIRTIO_BLK_F_GEOMETRY: u32 = 4; 37 | pub const VIRTIO_BLK_F_RO: u32 = 5; 38 | pub const VIRTIO_BLK_F_BLK_SIZE: u32 = 6; 39 | pub const VIRTIO_BLK_F_TOPOLOGY: u32 = 10; 40 | pub const VIRTIO_BLK_F_MQ: u32 = 12; 41 | pub const VIRTIO_BLK_F_DISCARD: u32 = 13; 42 | pub const VIRTIO_BLK_F_WRITE_ZEROES: u32 = 14; 43 | pub const VIRTIO_BLK_F_BARRIER: u32 = 0; 44 | pub const VIRTIO_BLK_F_SCSI: u32 = 7; 45 | pub const VIRTIO_BLK_F_FLUSH: u32 = 9; 46 | pub const VIRTIO_BLK_F_CONFIG_WCE: u32 = 11; 47 | pub const VIRTIO_BLK_F_WCE: u32 = 9; 48 | pub const VIRTIO_BLK_ID_BYTES: u32 = 20; 49 | pub const VIRTIO_BLK_T_IN: u32 = 0; 50 | pub const VIRTIO_BLK_T_OUT: u32 = 1; 51 | pub const VIRTIO_BLK_T_SCSI_CMD: u32 = 2; 52 | pub const VIRTIO_BLK_T_FLUSH: u32 = 4; 53 | pub const VIRTIO_BLK_T_GET_ID: u32 = 8; 54 | pub const VIRTIO_BLK_T_DISCARD: u32 = 11; 55 | pub const VIRTIO_BLK_T_WRITE_ZEROES: u32 = 13; 56 | pub const VIRTIO_BLK_T_BARRIER: u32 = 2147483648; 57 | pub const VIRTIO_BLK_WRITE_ZEROES_FLAG_UNMAP: u32 = 1; 58 | pub const VIRTIO_BLK_S_OK: u32 = 0; 59 | pub const VIRTIO_BLK_S_IOERR: u32 = 1; 60 | pub const VIRTIO_BLK_S_UNSUPP: u32 = 2; 61 | pub type __s8 = ::std::os::raw::c_schar; 62 | pub type __u8 = ::std::os::raw::c_uchar; 63 | pub type __s16 = ::std::os::raw::c_short; 64 | pub type __u16 = ::std::os::raw::c_ushort; 65 | pub type __s32 = ::std::os::raw::c_int; 66 | pub type __u32 = ::std::os::raw::c_uint; 67 | pub type __s64 = ::std::os::raw::c_longlong; 68 | pub type __u64 = ::std::os::raw::c_ulonglong; 69 | #[repr(C)] 70 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 71 | pub struct __kernel_fd_set { 72 | pub fds_bits: [::std::os::raw::c_ulong; 16usize], 73 | } 74 | #[test] 75 | fn bindgen_test_layout___kernel_fd_set() { 76 | assert_eq!( 77 | ::std::mem::size_of::<__kernel_fd_set>(), 78 | 128usize, 79 | concat!("Size of: ", stringify!(__kernel_fd_set)) 80 | ); 81 | assert_eq!( 82 | ::std::mem::align_of::<__kernel_fd_set>(), 83 | 8usize, 84 | concat!("Alignment of ", stringify!(__kernel_fd_set)) 85 | ); 86 | assert_eq!( 87 | unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, 88 | 0usize, 89 | concat!( 90 | "Offset of field: ", 91 | stringify!(__kernel_fd_set), 92 | "::", 93 | stringify!(fds_bits) 94 | ) 95 | ); 96 | } 97 | pub type __kernel_sighandler_t = 98 | ::std::option::Option; 99 | pub type __kernel_key_t = ::std::os::raw::c_int; 100 | pub type __kernel_mqd_t = ::std::os::raw::c_int; 101 | pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; 102 | pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; 103 | pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; 104 | pub type __kernel_long_t = ::std::os::raw::c_long; 105 | pub type __kernel_ulong_t = ::std::os::raw::c_ulong; 106 | pub type __kernel_ino_t = __kernel_ulong_t; 107 | pub type __kernel_mode_t = ::std::os::raw::c_uint; 108 | pub type __kernel_pid_t = ::std::os::raw::c_int; 109 | pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; 110 | pub type __kernel_uid_t = ::std::os::raw::c_uint; 111 | pub type __kernel_gid_t = ::std::os::raw::c_uint; 112 | pub type __kernel_suseconds_t = __kernel_long_t; 113 | pub type __kernel_daddr_t = ::std::os::raw::c_int; 114 | pub type __kernel_uid32_t = ::std::os::raw::c_uint; 115 | pub type __kernel_gid32_t = ::std::os::raw::c_uint; 116 | pub type __kernel_size_t = __kernel_ulong_t; 117 | pub type __kernel_ssize_t = __kernel_long_t; 118 | pub type __kernel_ptrdiff_t = __kernel_long_t; 119 | #[repr(C)] 120 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 121 | pub struct __kernel_fsid_t { 122 | pub val: [::std::os::raw::c_int; 2usize], 123 | } 124 | #[test] 125 | fn bindgen_test_layout___kernel_fsid_t() { 126 | assert_eq!( 127 | ::std::mem::size_of::<__kernel_fsid_t>(), 128 | 8usize, 129 | concat!("Size of: ", stringify!(__kernel_fsid_t)) 130 | ); 131 | assert_eq!( 132 | ::std::mem::align_of::<__kernel_fsid_t>(), 133 | 4usize, 134 | concat!("Alignment of ", stringify!(__kernel_fsid_t)) 135 | ); 136 | assert_eq!( 137 | unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, 138 | 0usize, 139 | concat!( 140 | "Offset of field: ", 141 | stringify!(__kernel_fsid_t), 142 | "::", 143 | stringify!(val) 144 | ) 145 | ); 146 | } 147 | pub type __kernel_off_t = __kernel_long_t; 148 | pub type __kernel_loff_t = ::std::os::raw::c_longlong; 149 | pub type __kernel_time_t = __kernel_long_t; 150 | pub type __kernel_time64_t = ::std::os::raw::c_longlong; 151 | pub type __kernel_clock_t = __kernel_long_t; 152 | pub type __kernel_timer_t = ::std::os::raw::c_int; 153 | pub type __kernel_clockid_t = ::std::os::raw::c_int; 154 | pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; 155 | pub type __kernel_uid16_t = ::std::os::raw::c_ushort; 156 | pub type __kernel_gid16_t = ::std::os::raw::c_ushort; 157 | pub type __le16 = __u16; 158 | pub type __be16 = __u16; 159 | pub type __le32 = __u32; 160 | pub type __be32 = __u32; 161 | pub type __le64 = __u64; 162 | pub type __be64 = __u64; 163 | pub type __sum16 = __u16; 164 | pub type __wsum = __u32; 165 | pub type __poll_t = ::std::os::raw::c_uint; 166 | pub type __virtio16 = __u16; 167 | pub type __virtio32 = __u32; 168 | pub type __virtio64 = __u64; 169 | #[repr(C, packed)] 170 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 171 | pub struct virtio_blk_config { 172 | pub capacity: __u64, 173 | pub size_max: __u32, 174 | pub seg_max: __u32, 175 | pub geometry: virtio_blk_config_virtio_blk_geometry, 176 | pub blk_size: __u32, 177 | pub physical_block_exp: __u8, 178 | pub alignment_offset: __u8, 179 | pub min_io_size: __u16, 180 | pub opt_io_size: __u32, 181 | pub wce: __u8, 182 | pub unused: __u8, 183 | pub num_queues: __u16, 184 | pub max_discard_sectors: __u32, 185 | pub max_discard_seg: __u32, 186 | pub discard_sector_alignment: __u32, 187 | pub max_write_zeroes_sectors: __u32, 188 | pub max_write_zeroes_seg: __u32, 189 | pub write_zeroes_may_unmap: __u8, 190 | pub unused1: [__u8; 3usize], 191 | } 192 | #[repr(C)] 193 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 194 | pub struct virtio_blk_config_virtio_blk_geometry { 195 | pub cylinders: __u16, 196 | pub heads: __u8, 197 | pub sectors: __u8, 198 | } 199 | #[test] 200 | fn bindgen_test_layout_virtio_blk_config_virtio_blk_geometry() { 201 | assert_eq!( 202 | ::std::mem::size_of::(), 203 | 4usize, 204 | concat!( 205 | "Size of: ", 206 | stringify!(virtio_blk_config_virtio_blk_geometry) 207 | ) 208 | ); 209 | assert_eq!( 210 | ::std::mem::align_of::(), 211 | 2usize, 212 | concat!( 213 | "Alignment of ", 214 | stringify!(virtio_blk_config_virtio_blk_geometry) 215 | ) 216 | ); 217 | assert_eq!( 218 | unsafe { 219 | &(*(::std::ptr::null::())).cylinders as *const _ 220 | as usize 221 | }, 222 | 0usize, 223 | concat!( 224 | "Offset of field: ", 225 | stringify!(virtio_blk_config_virtio_blk_geometry), 226 | "::", 227 | stringify!(cylinders) 228 | ) 229 | ); 230 | assert_eq!( 231 | unsafe { 232 | &(*(::std::ptr::null::())).heads as *const _ 233 | as usize 234 | }, 235 | 2usize, 236 | concat!( 237 | "Offset of field: ", 238 | stringify!(virtio_blk_config_virtio_blk_geometry), 239 | "::", 240 | stringify!(heads) 241 | ) 242 | ); 243 | assert_eq!( 244 | unsafe { 245 | &(*(::std::ptr::null::())).sectors as *const _ 246 | as usize 247 | }, 248 | 3usize, 249 | concat!( 250 | "Offset of field: ", 251 | stringify!(virtio_blk_config_virtio_blk_geometry), 252 | "::", 253 | stringify!(sectors) 254 | ) 255 | ); 256 | } 257 | #[test] 258 | fn bindgen_test_layout_virtio_blk_config() { 259 | assert_eq!( 260 | ::std::mem::size_of::(), 261 | 60usize, 262 | concat!("Size of: ", stringify!(virtio_blk_config)) 263 | ); 264 | assert_eq!( 265 | ::std::mem::align_of::(), 266 | 1usize, 267 | concat!("Alignment of ", stringify!(virtio_blk_config)) 268 | ); 269 | assert_eq!( 270 | unsafe { &(*(::std::ptr::null::())).capacity as *const _ as usize }, 271 | 0usize, 272 | concat!( 273 | "Offset of field: ", 274 | stringify!(virtio_blk_config), 275 | "::", 276 | stringify!(capacity) 277 | ) 278 | ); 279 | assert_eq!( 280 | unsafe { &(*(::std::ptr::null::())).size_max as *const _ as usize }, 281 | 8usize, 282 | concat!( 283 | "Offset of field: ", 284 | stringify!(virtio_blk_config), 285 | "::", 286 | stringify!(size_max) 287 | ) 288 | ); 289 | assert_eq!( 290 | unsafe { &(*(::std::ptr::null::())).seg_max as *const _ as usize }, 291 | 12usize, 292 | concat!( 293 | "Offset of field: ", 294 | stringify!(virtio_blk_config), 295 | "::", 296 | stringify!(seg_max) 297 | ) 298 | ); 299 | assert_eq!( 300 | unsafe { &(*(::std::ptr::null::())).geometry as *const _ as usize }, 301 | 16usize, 302 | concat!( 303 | "Offset of field: ", 304 | stringify!(virtio_blk_config), 305 | "::", 306 | stringify!(geometry) 307 | ) 308 | ); 309 | assert_eq!( 310 | unsafe { &(*(::std::ptr::null::())).blk_size as *const _ as usize }, 311 | 20usize, 312 | concat!( 313 | "Offset of field: ", 314 | stringify!(virtio_blk_config), 315 | "::", 316 | stringify!(blk_size) 317 | ) 318 | ); 319 | assert_eq!( 320 | unsafe { 321 | &(*(::std::ptr::null::())).physical_block_exp as *const _ as usize 322 | }, 323 | 24usize, 324 | concat!( 325 | "Offset of field: ", 326 | stringify!(virtio_blk_config), 327 | "::", 328 | stringify!(physical_block_exp) 329 | ) 330 | ); 331 | assert_eq!( 332 | unsafe { 333 | &(*(::std::ptr::null::())).alignment_offset as *const _ as usize 334 | }, 335 | 25usize, 336 | concat!( 337 | "Offset of field: ", 338 | stringify!(virtio_blk_config), 339 | "::", 340 | stringify!(alignment_offset) 341 | ) 342 | ); 343 | assert_eq!( 344 | unsafe { &(*(::std::ptr::null::())).min_io_size as *const _ as usize }, 345 | 26usize, 346 | concat!( 347 | "Offset of field: ", 348 | stringify!(virtio_blk_config), 349 | "::", 350 | stringify!(min_io_size) 351 | ) 352 | ); 353 | assert_eq!( 354 | unsafe { &(*(::std::ptr::null::())).opt_io_size as *const _ as usize }, 355 | 28usize, 356 | concat!( 357 | "Offset of field: ", 358 | stringify!(virtio_blk_config), 359 | "::", 360 | stringify!(opt_io_size) 361 | ) 362 | ); 363 | assert_eq!( 364 | unsafe { &(*(::std::ptr::null::())).wce as *const _ as usize }, 365 | 32usize, 366 | concat!( 367 | "Offset of field: ", 368 | stringify!(virtio_blk_config), 369 | "::", 370 | stringify!(wce) 371 | ) 372 | ); 373 | assert_eq!( 374 | unsafe { &(*(::std::ptr::null::())).unused as *const _ as usize }, 375 | 33usize, 376 | concat!( 377 | "Offset of field: ", 378 | stringify!(virtio_blk_config), 379 | "::", 380 | stringify!(unused) 381 | ) 382 | ); 383 | assert_eq!( 384 | unsafe { &(*(::std::ptr::null::())).num_queues as *const _ as usize }, 385 | 34usize, 386 | concat!( 387 | "Offset of field: ", 388 | stringify!(virtio_blk_config), 389 | "::", 390 | stringify!(num_queues) 391 | ) 392 | ); 393 | assert_eq!( 394 | unsafe { 395 | &(*(::std::ptr::null::())).max_discard_sectors as *const _ as usize 396 | }, 397 | 36usize, 398 | concat!( 399 | "Offset of field: ", 400 | stringify!(virtio_blk_config), 401 | "::", 402 | stringify!(max_discard_sectors) 403 | ) 404 | ); 405 | assert_eq!( 406 | unsafe { 407 | &(*(::std::ptr::null::())).max_discard_seg as *const _ as usize 408 | }, 409 | 40usize, 410 | concat!( 411 | "Offset of field: ", 412 | stringify!(virtio_blk_config), 413 | "::", 414 | stringify!(max_discard_seg) 415 | ) 416 | ); 417 | assert_eq!( 418 | unsafe { 419 | &(*(::std::ptr::null::())).discard_sector_alignment as *const _ 420 | as usize 421 | }, 422 | 44usize, 423 | concat!( 424 | "Offset of field: ", 425 | stringify!(virtio_blk_config), 426 | "::", 427 | stringify!(discard_sector_alignment) 428 | ) 429 | ); 430 | assert_eq!( 431 | unsafe { 432 | &(*(::std::ptr::null::())).max_write_zeroes_sectors as *const _ 433 | as usize 434 | }, 435 | 48usize, 436 | concat!( 437 | "Offset of field: ", 438 | stringify!(virtio_blk_config), 439 | "::", 440 | stringify!(max_write_zeroes_sectors) 441 | ) 442 | ); 443 | assert_eq!( 444 | unsafe { 445 | &(*(::std::ptr::null::())).max_write_zeroes_seg as *const _ as usize 446 | }, 447 | 52usize, 448 | concat!( 449 | "Offset of field: ", 450 | stringify!(virtio_blk_config), 451 | "::", 452 | stringify!(max_write_zeroes_seg) 453 | ) 454 | ); 455 | assert_eq!( 456 | unsafe { 457 | &(*(::std::ptr::null::())).write_zeroes_may_unmap as *const _ 458 | as usize 459 | }, 460 | 56usize, 461 | concat!( 462 | "Offset of field: ", 463 | stringify!(virtio_blk_config), 464 | "::", 465 | stringify!(write_zeroes_may_unmap) 466 | ) 467 | ); 468 | assert_eq!( 469 | unsafe { &(*(::std::ptr::null::())).unused1 as *const _ as usize }, 470 | 57usize, 471 | concat!( 472 | "Offset of field: ", 473 | stringify!(virtio_blk_config), 474 | "::", 475 | stringify!(unused1) 476 | ) 477 | ); 478 | } 479 | #[repr(C)] 480 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 481 | pub struct virtio_blk_outhdr { 482 | pub type_: __virtio32, 483 | pub ioprio: __virtio32, 484 | pub sector: __virtio64, 485 | } 486 | #[test] 487 | fn bindgen_test_layout_virtio_blk_outhdr() { 488 | assert_eq!( 489 | ::std::mem::size_of::(), 490 | 16usize, 491 | concat!("Size of: ", stringify!(virtio_blk_outhdr)) 492 | ); 493 | assert_eq!( 494 | ::std::mem::align_of::(), 495 | 8usize, 496 | concat!("Alignment of ", stringify!(virtio_blk_outhdr)) 497 | ); 498 | assert_eq!( 499 | unsafe { &(*(::std::ptr::null::())).type_ as *const _ as usize }, 500 | 0usize, 501 | concat!( 502 | "Offset of field: ", 503 | stringify!(virtio_blk_outhdr), 504 | "::", 505 | stringify!(type_) 506 | ) 507 | ); 508 | assert_eq!( 509 | unsafe { &(*(::std::ptr::null::())).ioprio as *const _ as usize }, 510 | 4usize, 511 | concat!( 512 | "Offset of field: ", 513 | stringify!(virtio_blk_outhdr), 514 | "::", 515 | stringify!(ioprio) 516 | ) 517 | ); 518 | assert_eq!( 519 | unsafe { &(*(::std::ptr::null::())).sector as *const _ as usize }, 520 | 8usize, 521 | concat!( 522 | "Offset of field: ", 523 | stringify!(virtio_blk_outhdr), 524 | "::", 525 | stringify!(sector) 526 | ) 527 | ); 528 | } 529 | #[repr(C)] 530 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 531 | pub struct virtio_blk_discard_write_zeroes { 532 | pub sector: __le64, 533 | pub num_sectors: __le32, 534 | pub flags: __le32, 535 | } 536 | #[test] 537 | fn bindgen_test_layout_virtio_blk_discard_write_zeroes() { 538 | assert_eq!( 539 | ::std::mem::size_of::(), 540 | 16usize, 541 | concat!("Size of: ", stringify!(virtio_blk_discard_write_zeroes)) 542 | ); 543 | assert_eq!( 544 | ::std::mem::align_of::(), 545 | 8usize, 546 | concat!("Alignment of ", stringify!(virtio_blk_discard_write_zeroes)) 547 | ); 548 | assert_eq!( 549 | unsafe { 550 | &(*(::std::ptr::null::())).sector as *const _ as usize 551 | }, 552 | 0usize, 553 | concat!( 554 | "Offset of field: ", 555 | stringify!(virtio_blk_discard_write_zeroes), 556 | "::", 557 | stringify!(sector) 558 | ) 559 | ); 560 | assert_eq!( 561 | unsafe { 562 | &(*(::std::ptr::null::())).num_sectors as *const _ 563 | as usize 564 | }, 565 | 8usize, 566 | concat!( 567 | "Offset of field: ", 568 | stringify!(virtio_blk_discard_write_zeroes), 569 | "::", 570 | stringify!(num_sectors) 571 | ) 572 | ); 573 | assert_eq!( 574 | unsafe { 575 | &(*(::std::ptr::null::())).flags as *const _ as usize 576 | }, 577 | 12usize, 578 | concat!( 579 | "Offset of field: ", 580 | stringify!(virtio_blk_discard_write_zeroes), 581 | "::", 582 | stringify!(flags) 583 | ) 584 | ); 585 | } 586 | #[repr(C)] 587 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 588 | pub struct virtio_scsi_inhdr { 589 | pub errors: __virtio32, 590 | pub data_len: __virtio32, 591 | pub sense_len: __virtio32, 592 | pub residual: __virtio32, 593 | } 594 | #[test] 595 | fn bindgen_test_layout_virtio_scsi_inhdr() { 596 | assert_eq!( 597 | ::std::mem::size_of::(), 598 | 16usize, 599 | concat!("Size of: ", stringify!(virtio_scsi_inhdr)) 600 | ); 601 | assert_eq!( 602 | ::std::mem::align_of::(), 603 | 4usize, 604 | concat!("Alignment of ", stringify!(virtio_scsi_inhdr)) 605 | ); 606 | assert_eq!( 607 | unsafe { &(*(::std::ptr::null::())).errors as *const _ as usize }, 608 | 0usize, 609 | concat!( 610 | "Offset of field: ", 611 | stringify!(virtio_scsi_inhdr), 612 | "::", 613 | stringify!(errors) 614 | ) 615 | ); 616 | assert_eq!( 617 | unsafe { &(*(::std::ptr::null::())).data_len as *const _ as usize }, 618 | 4usize, 619 | concat!( 620 | "Offset of field: ", 621 | stringify!(virtio_scsi_inhdr), 622 | "::", 623 | stringify!(data_len) 624 | ) 625 | ); 626 | assert_eq!( 627 | unsafe { &(*(::std::ptr::null::())).sense_len as *const _ as usize }, 628 | 8usize, 629 | concat!( 630 | "Offset of field: ", 631 | stringify!(virtio_scsi_inhdr), 632 | "::", 633 | stringify!(sense_len) 634 | ) 635 | ); 636 | assert_eq!( 637 | unsafe { &(*(::std::ptr::null::())).residual as *const _ as usize }, 638 | 12usize, 639 | concat!( 640 | "Offset of field: ", 641 | stringify!(virtio_scsi_inhdr), 642 | "::", 643 | stringify!(residual) 644 | ) 645 | ); 646 | } 647 | -------------------------------------------------------------------------------- /src/bindings_v5_0_0/virtio_net.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #[repr(C)] 4 | #[derive(Default)] 5 | pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); 6 | impl __IncompleteArrayField { 7 | #[inline] 8 | pub fn new() -> Self { 9 | __IncompleteArrayField(::std::marker::PhantomData, []) 10 | } 11 | #[inline] 12 | pub unsafe fn as_ptr(&self) -> *const T { 13 | ::std::mem::transmute(self) 14 | } 15 | #[inline] 16 | pub unsafe fn as_mut_ptr(&mut self) -> *mut T { 17 | ::std::mem::transmute(self) 18 | } 19 | #[inline] 20 | pub unsafe fn as_slice(&self, len: usize) -> &[T] { 21 | ::std::slice::from_raw_parts(self.as_ptr(), len) 22 | } 23 | #[inline] 24 | pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { 25 | ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) 26 | } 27 | } 28 | impl ::std::fmt::Debug for __IncompleteArrayField { 29 | fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 30 | fmt.write_str("__IncompleteArrayField") 31 | } 32 | } 33 | impl ::std::clone::Clone for __IncompleteArrayField { 34 | #[inline] 35 | fn clone(&self) -> Self { 36 | Self::new() 37 | } 38 | } 39 | pub const __BITS_PER_LONG: u32 = 64; 40 | pub const __FD_SETSIZE: u32 = 1024; 41 | pub const VIRTIO_ID_NET: u32 = 1; 42 | pub const VIRTIO_ID_BLOCK: u32 = 2; 43 | pub const VIRTIO_ID_CONSOLE: u32 = 3; 44 | pub const VIRTIO_ID_RNG: u32 = 4; 45 | pub const VIRTIO_ID_BALLOON: u32 = 5; 46 | pub const VIRTIO_ID_RPMSG: u32 = 7; 47 | pub const VIRTIO_ID_SCSI: u32 = 8; 48 | pub const VIRTIO_ID_9P: u32 = 9; 49 | pub const VIRTIO_ID_RPROC_SERIAL: u32 = 11; 50 | pub const VIRTIO_ID_CAIF: u32 = 12; 51 | pub const VIRTIO_ID_GPU: u32 = 16; 52 | pub const VIRTIO_ID_INPUT: u32 = 18; 53 | pub const VIRTIO_ID_VSOCK: u32 = 19; 54 | pub const VIRTIO_ID_CRYPTO: u32 = 20; 55 | pub const VIRTIO_CONFIG_S_ACKNOWLEDGE: u32 = 1; 56 | pub const VIRTIO_CONFIG_S_DRIVER: u32 = 2; 57 | pub const VIRTIO_CONFIG_S_DRIVER_OK: u32 = 4; 58 | pub const VIRTIO_CONFIG_S_FEATURES_OK: u32 = 8; 59 | pub const VIRTIO_CONFIG_S_NEEDS_RESET: u32 = 64; 60 | pub const VIRTIO_CONFIG_S_FAILED: u32 = 128; 61 | pub const VIRTIO_TRANSPORT_F_START: u32 = 28; 62 | pub const VIRTIO_TRANSPORT_F_END: u32 = 38; 63 | pub const VIRTIO_F_NOTIFY_ON_EMPTY: u32 = 24; 64 | pub const VIRTIO_F_ANY_LAYOUT: u32 = 27; 65 | pub const VIRTIO_F_VERSION_1: u32 = 32; 66 | pub const VIRTIO_F_IOMMU_PLATFORM: u32 = 33; 67 | pub const VIRTIO_F_RING_PACKED: u32 = 34; 68 | pub const VIRTIO_F_ORDER_PLATFORM: u32 = 36; 69 | pub const VIRTIO_F_SR_IOV: u32 = 37; 70 | pub const ETH_ALEN: u32 = 6; 71 | pub const ETH_TLEN: u32 = 2; 72 | pub const ETH_HLEN: u32 = 14; 73 | pub const ETH_ZLEN: u32 = 60; 74 | pub const ETH_DATA_LEN: u32 = 1500; 75 | pub const ETH_FRAME_LEN: u32 = 1514; 76 | pub const ETH_FCS_LEN: u32 = 4; 77 | pub const ETH_MIN_MTU: u32 = 68; 78 | pub const ETH_MAX_MTU: u32 = 65535; 79 | pub const ETH_P_LOOP: u32 = 96; 80 | pub const ETH_P_PUP: u32 = 512; 81 | pub const ETH_P_PUPAT: u32 = 513; 82 | pub const ETH_P_TSN: u32 = 8944; 83 | pub const ETH_P_ERSPAN2: u32 = 8939; 84 | pub const ETH_P_IP: u32 = 2048; 85 | pub const ETH_P_X25: u32 = 2053; 86 | pub const ETH_P_ARP: u32 = 2054; 87 | pub const ETH_P_BPQ: u32 = 2303; 88 | pub const ETH_P_IEEEPUP: u32 = 2560; 89 | pub const ETH_P_IEEEPUPAT: u32 = 2561; 90 | pub const ETH_P_BATMAN: u32 = 17157; 91 | pub const ETH_P_DEC: u32 = 24576; 92 | pub const ETH_P_DNA_DL: u32 = 24577; 93 | pub const ETH_P_DNA_RC: u32 = 24578; 94 | pub const ETH_P_DNA_RT: u32 = 24579; 95 | pub const ETH_P_LAT: u32 = 24580; 96 | pub const ETH_P_DIAG: u32 = 24581; 97 | pub const ETH_P_CUST: u32 = 24582; 98 | pub const ETH_P_SCA: u32 = 24583; 99 | pub const ETH_P_TEB: u32 = 25944; 100 | pub const ETH_P_RARP: u32 = 32821; 101 | pub const ETH_P_ATALK: u32 = 32923; 102 | pub const ETH_P_AARP: u32 = 33011; 103 | pub const ETH_P_8021Q: u32 = 33024; 104 | pub const ETH_P_ERSPAN: u32 = 35006; 105 | pub const ETH_P_IPX: u32 = 33079; 106 | pub const ETH_P_IPV6: u32 = 34525; 107 | pub const ETH_P_PAUSE: u32 = 34824; 108 | pub const ETH_P_SLOW: u32 = 34825; 109 | pub const ETH_P_WCCP: u32 = 34878; 110 | pub const ETH_P_MPLS_UC: u32 = 34887; 111 | pub const ETH_P_MPLS_MC: u32 = 34888; 112 | pub const ETH_P_ATMMPOA: u32 = 34892; 113 | pub const ETH_P_PPP_DISC: u32 = 34915; 114 | pub const ETH_P_PPP_SES: u32 = 34916; 115 | pub const ETH_P_LINK_CTL: u32 = 34924; 116 | pub const ETH_P_ATMFATE: u32 = 34948; 117 | pub const ETH_P_PAE: u32 = 34958; 118 | pub const ETH_P_AOE: u32 = 34978; 119 | pub const ETH_P_8021AD: u32 = 34984; 120 | pub const ETH_P_802_EX1: u32 = 34997; 121 | pub const ETH_P_PREAUTH: u32 = 35015; 122 | pub const ETH_P_TIPC: u32 = 35018; 123 | pub const ETH_P_MACSEC: u32 = 35045; 124 | pub const ETH_P_8021AH: u32 = 35047; 125 | pub const ETH_P_MVRP: u32 = 35061; 126 | pub const ETH_P_1588: u32 = 35063; 127 | pub const ETH_P_NCSI: u32 = 35064; 128 | pub const ETH_P_PRP: u32 = 35067; 129 | pub const ETH_P_FCOE: u32 = 35078; 130 | pub const ETH_P_IBOE: u32 = 35093; 131 | pub const ETH_P_TDLS: u32 = 35085; 132 | pub const ETH_P_FIP: u32 = 35092; 133 | pub const ETH_P_80221: u32 = 35095; 134 | pub const ETH_P_HSR: u32 = 35119; 135 | pub const ETH_P_NSH: u32 = 35151; 136 | pub const ETH_P_LOOPBACK: u32 = 36864; 137 | pub const ETH_P_QINQ1: u32 = 37120; 138 | pub const ETH_P_QINQ2: u32 = 37376; 139 | pub const ETH_P_QINQ3: u32 = 37632; 140 | pub const ETH_P_EDSA: u32 = 56026; 141 | pub const ETH_P_IFE: u32 = 60734; 142 | pub const ETH_P_AF_IUCV: u32 = 64507; 143 | pub const ETH_P_802_3_MIN: u32 = 1536; 144 | pub const ETH_P_802_3: u32 = 1; 145 | pub const ETH_P_AX25: u32 = 2; 146 | pub const ETH_P_ALL: u32 = 3; 147 | pub const ETH_P_802_2: u32 = 4; 148 | pub const ETH_P_SNAP: u32 = 5; 149 | pub const ETH_P_DDCMP: u32 = 6; 150 | pub const ETH_P_WAN_PPP: u32 = 7; 151 | pub const ETH_P_PPP_MP: u32 = 8; 152 | pub const ETH_P_LOCALTALK: u32 = 9; 153 | pub const ETH_P_CAN: u32 = 12; 154 | pub const ETH_P_CANFD: u32 = 13; 155 | pub const ETH_P_PPPTALK: u32 = 16; 156 | pub const ETH_P_TR_802_2: u32 = 17; 157 | pub const ETH_P_MOBITEX: u32 = 21; 158 | pub const ETH_P_CONTROL: u32 = 22; 159 | pub const ETH_P_IRDA: u32 = 23; 160 | pub const ETH_P_ECONET: u32 = 24; 161 | pub const ETH_P_HDLC: u32 = 25; 162 | pub const ETH_P_ARCNET: u32 = 26; 163 | pub const ETH_P_DSA: u32 = 27; 164 | pub const ETH_P_TRAILER: u32 = 28; 165 | pub const ETH_P_PHONET: u32 = 245; 166 | pub const ETH_P_IEEE802154: u32 = 246; 167 | pub const ETH_P_CAIF: u32 = 247; 168 | pub const ETH_P_XDSA: u32 = 248; 169 | pub const ETH_P_MAP: u32 = 249; 170 | pub const __UAPI_DEF_ETHHDR: u32 = 1; 171 | pub const VIRTIO_NET_F_CSUM: u32 = 0; 172 | pub const VIRTIO_NET_F_GUEST_CSUM: u32 = 1; 173 | pub const VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: u32 = 2; 174 | pub const VIRTIO_NET_F_MTU: u32 = 3; 175 | pub const VIRTIO_NET_F_MAC: u32 = 5; 176 | pub const VIRTIO_NET_F_GUEST_TSO4: u32 = 7; 177 | pub const VIRTIO_NET_F_GUEST_TSO6: u32 = 8; 178 | pub const VIRTIO_NET_F_GUEST_ECN: u32 = 9; 179 | pub const VIRTIO_NET_F_GUEST_UFO: u32 = 10; 180 | pub const VIRTIO_NET_F_HOST_TSO4: u32 = 11; 181 | pub const VIRTIO_NET_F_HOST_TSO6: u32 = 12; 182 | pub const VIRTIO_NET_F_HOST_ECN: u32 = 13; 183 | pub const VIRTIO_NET_F_HOST_UFO: u32 = 14; 184 | pub const VIRTIO_NET_F_MRG_RXBUF: u32 = 15; 185 | pub const VIRTIO_NET_F_STATUS: u32 = 16; 186 | pub const VIRTIO_NET_F_CTRL_VQ: u32 = 17; 187 | pub const VIRTIO_NET_F_CTRL_RX: u32 = 18; 188 | pub const VIRTIO_NET_F_CTRL_VLAN: u32 = 19; 189 | pub const VIRTIO_NET_F_CTRL_RX_EXTRA: u32 = 20; 190 | pub const VIRTIO_NET_F_GUEST_ANNOUNCE: u32 = 21; 191 | pub const VIRTIO_NET_F_MQ: u32 = 22; 192 | pub const VIRTIO_NET_F_CTRL_MAC_ADDR: u32 = 23; 193 | pub const VIRTIO_NET_F_STANDBY: u32 = 62; 194 | pub const VIRTIO_NET_F_SPEED_DUPLEX: u32 = 63; 195 | pub const VIRTIO_NET_F_GSO: u32 = 6; 196 | pub const VIRTIO_NET_S_LINK_UP: u32 = 1; 197 | pub const VIRTIO_NET_S_ANNOUNCE: u32 = 2; 198 | pub const VIRTIO_NET_HDR_F_NEEDS_CSUM: u32 = 1; 199 | pub const VIRTIO_NET_HDR_F_DATA_VALID: u32 = 2; 200 | pub const VIRTIO_NET_HDR_GSO_NONE: u32 = 0; 201 | pub const VIRTIO_NET_HDR_GSO_TCPV4: u32 = 1; 202 | pub const VIRTIO_NET_HDR_GSO_UDP: u32 = 3; 203 | pub const VIRTIO_NET_HDR_GSO_TCPV6: u32 = 4; 204 | pub const VIRTIO_NET_HDR_GSO_ECN: u32 = 128; 205 | pub const VIRTIO_NET_OK: u32 = 0; 206 | pub const VIRTIO_NET_ERR: u32 = 1; 207 | pub const VIRTIO_NET_CTRL_RX: u32 = 0; 208 | pub const VIRTIO_NET_CTRL_RX_PROMISC: u32 = 0; 209 | pub const VIRTIO_NET_CTRL_RX_ALLMULTI: u32 = 1; 210 | pub const VIRTIO_NET_CTRL_RX_ALLUNI: u32 = 2; 211 | pub const VIRTIO_NET_CTRL_RX_NOMULTI: u32 = 3; 212 | pub const VIRTIO_NET_CTRL_RX_NOUNI: u32 = 4; 213 | pub const VIRTIO_NET_CTRL_RX_NOBCAST: u32 = 5; 214 | pub const VIRTIO_NET_CTRL_MAC: u32 = 1; 215 | pub const VIRTIO_NET_CTRL_MAC_TABLE_SET: u32 = 0; 216 | pub const VIRTIO_NET_CTRL_MAC_ADDR_SET: u32 = 1; 217 | pub const VIRTIO_NET_CTRL_VLAN: u32 = 2; 218 | pub const VIRTIO_NET_CTRL_VLAN_ADD: u32 = 0; 219 | pub const VIRTIO_NET_CTRL_VLAN_DEL: u32 = 1; 220 | pub const VIRTIO_NET_CTRL_ANNOUNCE: u32 = 3; 221 | pub const VIRTIO_NET_CTRL_ANNOUNCE_ACK: u32 = 0; 222 | pub const VIRTIO_NET_CTRL_MQ: u32 = 4; 223 | pub const VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET: u32 = 0; 224 | pub const VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MIN: u32 = 1; 225 | pub const VIRTIO_NET_CTRL_MQ_VQ_PAIRS_MAX: u32 = 32768; 226 | pub const VIRTIO_NET_CTRL_GUEST_OFFLOADS: u32 = 5; 227 | pub const VIRTIO_NET_CTRL_GUEST_OFFLOADS_SET: u32 = 0; 228 | pub type __s8 = ::std::os::raw::c_schar; 229 | pub type __u8 = ::std::os::raw::c_uchar; 230 | pub type __s16 = ::std::os::raw::c_short; 231 | pub type __u16 = ::std::os::raw::c_ushort; 232 | pub type __s32 = ::std::os::raw::c_int; 233 | pub type __u32 = ::std::os::raw::c_uint; 234 | pub type __s64 = ::std::os::raw::c_longlong; 235 | pub type __u64 = ::std::os::raw::c_ulonglong; 236 | #[repr(C)] 237 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 238 | pub struct __kernel_fd_set { 239 | pub fds_bits: [::std::os::raw::c_ulong; 16usize], 240 | } 241 | #[test] 242 | fn bindgen_test_layout___kernel_fd_set() { 243 | assert_eq!( 244 | ::std::mem::size_of::<__kernel_fd_set>(), 245 | 128usize, 246 | concat!("Size of: ", stringify!(__kernel_fd_set)) 247 | ); 248 | assert_eq!( 249 | ::std::mem::align_of::<__kernel_fd_set>(), 250 | 8usize, 251 | concat!("Alignment of ", stringify!(__kernel_fd_set)) 252 | ); 253 | assert_eq!( 254 | unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, 255 | 0usize, 256 | concat!( 257 | "Offset of field: ", 258 | stringify!(__kernel_fd_set), 259 | "::", 260 | stringify!(fds_bits) 261 | ) 262 | ); 263 | } 264 | pub type __kernel_sighandler_t = 265 | ::std::option::Option; 266 | pub type __kernel_key_t = ::std::os::raw::c_int; 267 | pub type __kernel_mqd_t = ::std::os::raw::c_int; 268 | pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; 269 | pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; 270 | pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; 271 | pub type __kernel_long_t = ::std::os::raw::c_long; 272 | pub type __kernel_ulong_t = ::std::os::raw::c_ulong; 273 | pub type __kernel_ino_t = __kernel_ulong_t; 274 | pub type __kernel_mode_t = ::std::os::raw::c_uint; 275 | pub type __kernel_pid_t = ::std::os::raw::c_int; 276 | pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; 277 | pub type __kernel_uid_t = ::std::os::raw::c_uint; 278 | pub type __kernel_gid_t = ::std::os::raw::c_uint; 279 | pub type __kernel_suseconds_t = __kernel_long_t; 280 | pub type __kernel_daddr_t = ::std::os::raw::c_int; 281 | pub type __kernel_uid32_t = ::std::os::raw::c_uint; 282 | pub type __kernel_gid32_t = ::std::os::raw::c_uint; 283 | pub type __kernel_size_t = __kernel_ulong_t; 284 | pub type __kernel_ssize_t = __kernel_long_t; 285 | pub type __kernel_ptrdiff_t = __kernel_long_t; 286 | #[repr(C)] 287 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 288 | pub struct __kernel_fsid_t { 289 | pub val: [::std::os::raw::c_int; 2usize], 290 | } 291 | #[test] 292 | fn bindgen_test_layout___kernel_fsid_t() { 293 | assert_eq!( 294 | ::std::mem::size_of::<__kernel_fsid_t>(), 295 | 8usize, 296 | concat!("Size of: ", stringify!(__kernel_fsid_t)) 297 | ); 298 | assert_eq!( 299 | ::std::mem::align_of::<__kernel_fsid_t>(), 300 | 4usize, 301 | concat!("Alignment of ", stringify!(__kernel_fsid_t)) 302 | ); 303 | assert_eq!( 304 | unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, 305 | 0usize, 306 | concat!( 307 | "Offset of field: ", 308 | stringify!(__kernel_fsid_t), 309 | "::", 310 | stringify!(val) 311 | ) 312 | ); 313 | } 314 | pub type __kernel_off_t = __kernel_long_t; 315 | pub type __kernel_loff_t = ::std::os::raw::c_longlong; 316 | pub type __kernel_time_t = __kernel_long_t; 317 | pub type __kernel_time64_t = ::std::os::raw::c_longlong; 318 | pub type __kernel_clock_t = __kernel_long_t; 319 | pub type __kernel_timer_t = ::std::os::raw::c_int; 320 | pub type __kernel_clockid_t = ::std::os::raw::c_int; 321 | pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; 322 | pub type __kernel_uid16_t = ::std::os::raw::c_ushort; 323 | pub type __kernel_gid16_t = ::std::os::raw::c_ushort; 324 | pub type __le16 = __u16; 325 | pub type __be16 = __u16; 326 | pub type __le32 = __u32; 327 | pub type __be32 = __u32; 328 | pub type __le64 = __u64; 329 | pub type __be64 = __u64; 330 | pub type __sum16 = __u16; 331 | pub type __wsum = __u32; 332 | pub type __poll_t = ::std::os::raw::c_uint; 333 | pub type __virtio16 = __u16; 334 | pub type __virtio32 = __u32; 335 | pub type __virtio64 = __u64; 336 | #[repr(C, packed)] 337 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 338 | pub struct ethhdr { 339 | pub h_dest: [::std::os::raw::c_uchar; 6usize], 340 | pub h_source: [::std::os::raw::c_uchar; 6usize], 341 | pub h_proto: __be16, 342 | } 343 | #[test] 344 | fn bindgen_test_layout_ethhdr() { 345 | assert_eq!( 346 | ::std::mem::size_of::(), 347 | 14usize, 348 | concat!("Size of: ", stringify!(ethhdr)) 349 | ); 350 | assert_eq!( 351 | ::std::mem::align_of::(), 352 | 1usize, 353 | concat!("Alignment of ", stringify!(ethhdr)) 354 | ); 355 | assert_eq!( 356 | unsafe { &(*(::std::ptr::null::())).h_dest as *const _ as usize }, 357 | 0usize, 358 | concat!( 359 | "Offset of field: ", 360 | stringify!(ethhdr), 361 | "::", 362 | stringify!(h_dest) 363 | ) 364 | ); 365 | assert_eq!( 366 | unsafe { &(*(::std::ptr::null::())).h_source as *const _ as usize }, 367 | 6usize, 368 | concat!( 369 | "Offset of field: ", 370 | stringify!(ethhdr), 371 | "::", 372 | stringify!(h_source) 373 | ) 374 | ); 375 | assert_eq!( 376 | unsafe { &(*(::std::ptr::null::())).h_proto as *const _ as usize }, 377 | 12usize, 378 | concat!( 379 | "Offset of field: ", 380 | stringify!(ethhdr), 381 | "::", 382 | stringify!(h_proto) 383 | ) 384 | ); 385 | } 386 | #[repr(C, packed)] 387 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 388 | pub struct virtio_net_config { 389 | pub mac: [__u8; 6usize], 390 | pub status: __u16, 391 | pub max_virtqueue_pairs: __u16, 392 | pub mtu: __u16, 393 | pub speed: __u32, 394 | pub duplex: __u8, 395 | } 396 | #[test] 397 | fn bindgen_test_layout_virtio_net_config() { 398 | assert_eq!( 399 | ::std::mem::size_of::(), 400 | 17usize, 401 | concat!("Size of: ", stringify!(virtio_net_config)) 402 | ); 403 | assert_eq!( 404 | ::std::mem::align_of::(), 405 | 1usize, 406 | concat!("Alignment of ", stringify!(virtio_net_config)) 407 | ); 408 | assert_eq!( 409 | unsafe { &(*(::std::ptr::null::())).mac as *const _ as usize }, 410 | 0usize, 411 | concat!( 412 | "Offset of field: ", 413 | stringify!(virtio_net_config), 414 | "::", 415 | stringify!(mac) 416 | ) 417 | ); 418 | assert_eq!( 419 | unsafe { &(*(::std::ptr::null::())).status as *const _ as usize }, 420 | 6usize, 421 | concat!( 422 | "Offset of field: ", 423 | stringify!(virtio_net_config), 424 | "::", 425 | stringify!(status) 426 | ) 427 | ); 428 | assert_eq!( 429 | unsafe { 430 | &(*(::std::ptr::null::())).max_virtqueue_pairs as *const _ as usize 431 | }, 432 | 8usize, 433 | concat!( 434 | "Offset of field: ", 435 | stringify!(virtio_net_config), 436 | "::", 437 | stringify!(max_virtqueue_pairs) 438 | ) 439 | ); 440 | assert_eq!( 441 | unsafe { &(*(::std::ptr::null::())).mtu as *const _ as usize }, 442 | 10usize, 443 | concat!( 444 | "Offset of field: ", 445 | stringify!(virtio_net_config), 446 | "::", 447 | stringify!(mtu) 448 | ) 449 | ); 450 | assert_eq!( 451 | unsafe { &(*(::std::ptr::null::())).speed as *const _ as usize }, 452 | 12usize, 453 | concat!( 454 | "Offset of field: ", 455 | stringify!(virtio_net_config), 456 | "::", 457 | stringify!(speed) 458 | ) 459 | ); 460 | assert_eq!( 461 | unsafe { &(*(::std::ptr::null::())).duplex as *const _ as usize }, 462 | 16usize, 463 | concat!( 464 | "Offset of field: ", 465 | stringify!(virtio_net_config), 466 | "::", 467 | stringify!(duplex) 468 | ) 469 | ); 470 | } 471 | #[repr(C)] 472 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 473 | pub struct virtio_net_hdr_v1 { 474 | pub flags: __u8, 475 | pub gso_type: __u8, 476 | pub hdr_len: __virtio16, 477 | pub gso_size: __virtio16, 478 | pub csum_start: __virtio16, 479 | pub csum_offset: __virtio16, 480 | pub num_buffers: __virtio16, 481 | } 482 | #[test] 483 | fn bindgen_test_layout_virtio_net_hdr_v1() { 484 | assert_eq!( 485 | ::std::mem::size_of::(), 486 | 12usize, 487 | concat!("Size of: ", stringify!(virtio_net_hdr_v1)) 488 | ); 489 | assert_eq!( 490 | ::std::mem::align_of::(), 491 | 2usize, 492 | concat!("Alignment of ", stringify!(virtio_net_hdr_v1)) 493 | ); 494 | assert_eq!( 495 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 496 | 0usize, 497 | concat!( 498 | "Offset of field: ", 499 | stringify!(virtio_net_hdr_v1), 500 | "::", 501 | stringify!(flags) 502 | ) 503 | ); 504 | assert_eq!( 505 | unsafe { &(*(::std::ptr::null::())).gso_type as *const _ as usize }, 506 | 1usize, 507 | concat!( 508 | "Offset of field: ", 509 | stringify!(virtio_net_hdr_v1), 510 | "::", 511 | stringify!(gso_type) 512 | ) 513 | ); 514 | assert_eq!( 515 | unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, 516 | 2usize, 517 | concat!( 518 | "Offset of field: ", 519 | stringify!(virtio_net_hdr_v1), 520 | "::", 521 | stringify!(hdr_len) 522 | ) 523 | ); 524 | assert_eq!( 525 | unsafe { &(*(::std::ptr::null::())).gso_size as *const _ as usize }, 526 | 4usize, 527 | concat!( 528 | "Offset of field: ", 529 | stringify!(virtio_net_hdr_v1), 530 | "::", 531 | stringify!(gso_size) 532 | ) 533 | ); 534 | assert_eq!( 535 | unsafe { &(*(::std::ptr::null::())).csum_start as *const _ as usize }, 536 | 6usize, 537 | concat!( 538 | "Offset of field: ", 539 | stringify!(virtio_net_hdr_v1), 540 | "::", 541 | stringify!(csum_start) 542 | ) 543 | ); 544 | assert_eq!( 545 | unsafe { &(*(::std::ptr::null::())).csum_offset as *const _ as usize }, 546 | 8usize, 547 | concat!( 548 | "Offset of field: ", 549 | stringify!(virtio_net_hdr_v1), 550 | "::", 551 | stringify!(csum_offset) 552 | ) 553 | ); 554 | assert_eq!( 555 | unsafe { &(*(::std::ptr::null::())).num_buffers as *const _ as usize }, 556 | 10usize, 557 | concat!( 558 | "Offset of field: ", 559 | stringify!(virtio_net_hdr_v1), 560 | "::", 561 | stringify!(num_buffers) 562 | ) 563 | ); 564 | } 565 | #[repr(C)] 566 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 567 | pub struct virtio_net_hdr { 568 | pub flags: __u8, 569 | pub gso_type: __u8, 570 | pub hdr_len: __virtio16, 571 | pub gso_size: __virtio16, 572 | pub csum_start: __virtio16, 573 | pub csum_offset: __virtio16, 574 | } 575 | #[test] 576 | fn bindgen_test_layout_virtio_net_hdr() { 577 | assert_eq!( 578 | ::std::mem::size_of::(), 579 | 10usize, 580 | concat!("Size of: ", stringify!(virtio_net_hdr)) 581 | ); 582 | assert_eq!( 583 | ::std::mem::align_of::(), 584 | 2usize, 585 | concat!("Alignment of ", stringify!(virtio_net_hdr)) 586 | ); 587 | assert_eq!( 588 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 589 | 0usize, 590 | concat!( 591 | "Offset of field: ", 592 | stringify!(virtio_net_hdr), 593 | "::", 594 | stringify!(flags) 595 | ) 596 | ); 597 | assert_eq!( 598 | unsafe { &(*(::std::ptr::null::())).gso_type as *const _ as usize }, 599 | 1usize, 600 | concat!( 601 | "Offset of field: ", 602 | stringify!(virtio_net_hdr), 603 | "::", 604 | stringify!(gso_type) 605 | ) 606 | ); 607 | assert_eq!( 608 | unsafe { &(*(::std::ptr::null::())).hdr_len as *const _ as usize }, 609 | 2usize, 610 | concat!( 611 | "Offset of field: ", 612 | stringify!(virtio_net_hdr), 613 | "::", 614 | stringify!(hdr_len) 615 | ) 616 | ); 617 | assert_eq!( 618 | unsafe { &(*(::std::ptr::null::())).gso_size as *const _ as usize }, 619 | 4usize, 620 | concat!( 621 | "Offset of field: ", 622 | stringify!(virtio_net_hdr), 623 | "::", 624 | stringify!(gso_size) 625 | ) 626 | ); 627 | assert_eq!( 628 | unsafe { &(*(::std::ptr::null::())).csum_start as *const _ as usize }, 629 | 6usize, 630 | concat!( 631 | "Offset of field: ", 632 | stringify!(virtio_net_hdr), 633 | "::", 634 | stringify!(csum_start) 635 | ) 636 | ); 637 | assert_eq!( 638 | unsafe { &(*(::std::ptr::null::())).csum_offset as *const _ as usize }, 639 | 8usize, 640 | concat!( 641 | "Offset of field: ", 642 | stringify!(virtio_net_hdr), 643 | "::", 644 | stringify!(csum_offset) 645 | ) 646 | ); 647 | } 648 | #[repr(C)] 649 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 650 | pub struct virtio_net_hdr_mrg_rxbuf { 651 | pub hdr: virtio_net_hdr, 652 | pub num_buffers: __virtio16, 653 | } 654 | #[test] 655 | fn bindgen_test_layout_virtio_net_hdr_mrg_rxbuf() { 656 | assert_eq!( 657 | ::std::mem::size_of::(), 658 | 12usize, 659 | concat!("Size of: ", stringify!(virtio_net_hdr_mrg_rxbuf)) 660 | ); 661 | assert_eq!( 662 | ::std::mem::align_of::(), 663 | 2usize, 664 | concat!("Alignment of ", stringify!(virtio_net_hdr_mrg_rxbuf)) 665 | ); 666 | assert_eq!( 667 | unsafe { &(*(::std::ptr::null::())).hdr as *const _ as usize }, 668 | 0usize, 669 | concat!( 670 | "Offset of field: ", 671 | stringify!(virtio_net_hdr_mrg_rxbuf), 672 | "::", 673 | stringify!(hdr) 674 | ) 675 | ); 676 | assert_eq!( 677 | unsafe { 678 | &(*(::std::ptr::null::())).num_buffers as *const _ as usize 679 | }, 680 | 10usize, 681 | concat!( 682 | "Offset of field: ", 683 | stringify!(virtio_net_hdr_mrg_rxbuf), 684 | "::", 685 | stringify!(num_buffers) 686 | ) 687 | ); 688 | } 689 | #[repr(C, packed)] 690 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 691 | pub struct virtio_net_ctrl_hdr { 692 | pub class: __u8, 693 | pub cmd: __u8, 694 | } 695 | #[test] 696 | fn bindgen_test_layout_virtio_net_ctrl_hdr() { 697 | assert_eq!( 698 | ::std::mem::size_of::(), 699 | 2usize, 700 | concat!("Size of: ", stringify!(virtio_net_ctrl_hdr)) 701 | ); 702 | assert_eq!( 703 | ::std::mem::align_of::(), 704 | 1usize, 705 | concat!("Alignment of ", stringify!(virtio_net_ctrl_hdr)) 706 | ); 707 | assert_eq!( 708 | unsafe { &(*(::std::ptr::null::())).class as *const _ as usize }, 709 | 0usize, 710 | concat!( 711 | "Offset of field: ", 712 | stringify!(virtio_net_ctrl_hdr), 713 | "::", 714 | stringify!(class) 715 | ) 716 | ); 717 | assert_eq!( 718 | unsafe { &(*(::std::ptr::null::())).cmd as *const _ as usize }, 719 | 1usize, 720 | concat!( 721 | "Offset of field: ", 722 | stringify!(virtio_net_ctrl_hdr), 723 | "::", 724 | stringify!(cmd) 725 | ) 726 | ); 727 | } 728 | pub type virtio_net_ctrl_ack = __u8; 729 | #[repr(C, packed)] 730 | #[derive(Default)] 731 | pub struct virtio_net_ctrl_mac { 732 | pub entries: __virtio32, 733 | pub macs: __IncompleteArrayField<[__u8; 6usize]>, 734 | } 735 | #[test] 736 | fn bindgen_test_layout_virtio_net_ctrl_mac() { 737 | assert_eq!( 738 | ::std::mem::size_of::(), 739 | 4usize, 740 | concat!("Size of: ", stringify!(virtio_net_ctrl_mac)) 741 | ); 742 | assert_eq!( 743 | ::std::mem::align_of::(), 744 | 1usize, 745 | concat!("Alignment of ", stringify!(virtio_net_ctrl_mac)) 746 | ); 747 | } 748 | #[repr(C)] 749 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 750 | pub struct virtio_net_ctrl_mq { 751 | pub virtqueue_pairs: __virtio16, 752 | } 753 | #[test] 754 | fn bindgen_test_layout_virtio_net_ctrl_mq() { 755 | assert_eq!( 756 | ::std::mem::size_of::(), 757 | 2usize, 758 | concat!("Size of: ", stringify!(virtio_net_ctrl_mq)) 759 | ); 760 | assert_eq!( 761 | ::std::mem::align_of::(), 762 | 2usize, 763 | concat!("Alignment of ", stringify!(virtio_net_ctrl_mq)) 764 | ); 765 | assert_eq!( 766 | unsafe { 767 | &(*(::std::ptr::null::())).virtqueue_pairs as *const _ as usize 768 | }, 769 | 0usize, 770 | concat!( 771 | "Offset of field: ", 772 | stringify!(virtio_net_ctrl_mq), 773 | "::", 774 | stringify!(virtqueue_pairs) 775 | ) 776 | ); 777 | } 778 | -------------------------------------------------------------------------------- /src/bindings_v5_0_0/virtio_ring.rs: -------------------------------------------------------------------------------- 1 | /* automatically generated by rust-bindgen */ 2 | 3 | #[repr(C)] 4 | #[derive(Default)] 5 | pub struct __IncompleteArrayField(::std::marker::PhantomData, [T; 0]); 6 | impl __IncompleteArrayField { 7 | #[inline] 8 | pub fn new() -> Self { 9 | __IncompleteArrayField(::std::marker::PhantomData, []) 10 | } 11 | #[inline] 12 | pub unsafe fn as_ptr(&self) -> *const T { 13 | ::std::mem::transmute(self) 14 | } 15 | #[inline] 16 | pub unsafe fn as_mut_ptr(&mut self) -> *mut T { 17 | ::std::mem::transmute(self) 18 | } 19 | #[inline] 20 | pub unsafe fn as_slice(&self, len: usize) -> &[T] { 21 | ::std::slice::from_raw_parts(self.as_ptr(), len) 22 | } 23 | #[inline] 24 | pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { 25 | ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) 26 | } 27 | } 28 | impl ::std::fmt::Debug for __IncompleteArrayField { 29 | fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 30 | fmt.write_str("__IncompleteArrayField") 31 | } 32 | } 33 | impl ::std::clone::Clone for __IncompleteArrayField { 34 | #[inline] 35 | fn clone(&self) -> Self { 36 | Self::new() 37 | } 38 | } 39 | pub const _STDINT_H: u32 = 1; 40 | pub const _FEATURES_H: u32 = 1; 41 | pub const _DEFAULT_SOURCE: u32 = 1; 42 | pub const __USE_ISOC11: u32 = 1; 43 | pub const __USE_ISOC99: u32 = 1; 44 | pub const __USE_ISOC95: u32 = 1; 45 | pub const __USE_POSIX_IMPLICITLY: u32 = 1; 46 | pub const _POSIX_SOURCE: u32 = 1; 47 | pub const _POSIX_C_SOURCE: u32 = 200809; 48 | pub const __USE_POSIX: u32 = 1; 49 | pub const __USE_POSIX2: u32 = 1; 50 | pub const __USE_POSIX199309: u32 = 1; 51 | pub const __USE_POSIX199506: u32 = 1; 52 | pub const __USE_XOPEN2K: u32 = 1; 53 | pub const __USE_XOPEN2K8: u32 = 1; 54 | pub const _ATFILE_SOURCE: u32 = 1; 55 | pub const __USE_MISC: u32 = 1; 56 | pub const __USE_ATFILE: u32 = 1; 57 | pub const __USE_FORTIFY_LEVEL: u32 = 0; 58 | pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0; 59 | pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0; 60 | pub const _STDC_PREDEF_H: u32 = 1; 61 | pub const __STDC_IEC_559__: u32 = 1; 62 | pub const __STDC_IEC_559_COMPLEX__: u32 = 1; 63 | pub const __STDC_ISO_10646__: u32 = 201706; 64 | pub const __GNU_LIBRARY__: u32 = 6; 65 | pub const __GLIBC__: u32 = 2; 66 | pub const __GLIBC_MINOR__: u32 = 29; 67 | pub const _SYS_CDEFS_H: u32 = 1; 68 | pub const __glibc_c99_flexarr_available: u32 = 1; 69 | pub const __WORDSIZE: u32 = 64; 70 | pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1; 71 | pub const __SYSCALL_WORDSIZE: u32 = 64; 72 | pub const __HAVE_GENERIC_SELECTION: u32 = 1; 73 | pub const __GLIBC_USE_LIB_EXT2: u32 = 0; 74 | pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0; 75 | pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0; 76 | pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0; 77 | pub const _BITS_TYPES_H: u32 = 1; 78 | pub const __TIMESIZE: u32 = 64; 79 | pub const _BITS_TYPESIZES_H: u32 = 1; 80 | pub const __OFF_T_MATCHES_OFF64_T: u32 = 1; 81 | pub const __INO_T_MATCHES_INO64_T: u32 = 1; 82 | pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1; 83 | pub const __FD_SETSIZE: u32 = 1024; 84 | pub const _BITS_TIME64_H: u32 = 1; 85 | pub const _BITS_WCHAR_H: u32 = 1; 86 | pub const _BITS_STDINT_INTN_H: u32 = 1; 87 | pub const _BITS_STDINT_UINTN_H: u32 = 1; 88 | pub const INT8_MIN: i32 = -128; 89 | pub const INT16_MIN: i32 = -32768; 90 | pub const INT32_MIN: i32 = -2147483648; 91 | pub const INT8_MAX: u32 = 127; 92 | pub const INT16_MAX: u32 = 32767; 93 | pub const INT32_MAX: u32 = 2147483647; 94 | pub const UINT8_MAX: u32 = 255; 95 | pub const UINT16_MAX: u32 = 65535; 96 | pub const UINT32_MAX: u32 = 4294967295; 97 | pub const INT_LEAST8_MIN: i32 = -128; 98 | pub const INT_LEAST16_MIN: i32 = -32768; 99 | pub const INT_LEAST32_MIN: i32 = -2147483648; 100 | pub const INT_LEAST8_MAX: u32 = 127; 101 | pub const INT_LEAST16_MAX: u32 = 32767; 102 | pub const INT_LEAST32_MAX: u32 = 2147483647; 103 | pub const UINT_LEAST8_MAX: u32 = 255; 104 | pub const UINT_LEAST16_MAX: u32 = 65535; 105 | pub const UINT_LEAST32_MAX: u32 = 4294967295; 106 | pub const INT_FAST8_MIN: i32 = -128; 107 | pub const INT_FAST16_MIN: i64 = -9223372036854775808; 108 | pub const INT_FAST32_MIN: i64 = -9223372036854775808; 109 | pub const INT_FAST8_MAX: u32 = 127; 110 | pub const INT_FAST16_MAX: u64 = 9223372036854775807; 111 | pub const INT_FAST32_MAX: u64 = 9223372036854775807; 112 | pub const UINT_FAST8_MAX: u32 = 255; 113 | pub const UINT_FAST16_MAX: i32 = -1; 114 | pub const UINT_FAST32_MAX: i32 = -1; 115 | pub const INTPTR_MIN: i64 = -9223372036854775808; 116 | pub const INTPTR_MAX: u64 = 9223372036854775807; 117 | pub const UINTPTR_MAX: i32 = -1; 118 | pub const PTRDIFF_MIN: i64 = -9223372036854775808; 119 | pub const PTRDIFF_MAX: u64 = 9223372036854775807; 120 | pub const SIG_ATOMIC_MIN: i32 = -2147483648; 121 | pub const SIG_ATOMIC_MAX: u32 = 2147483647; 122 | pub const SIZE_MAX: i32 = -1; 123 | pub const WINT_MIN: u32 = 0; 124 | pub const WINT_MAX: u32 = 4294967295; 125 | pub const __BITS_PER_LONG: u32 = 64; 126 | pub const VRING_DESC_F_NEXT: u32 = 1; 127 | pub const VRING_DESC_F_WRITE: u32 = 2; 128 | pub const VRING_DESC_F_INDIRECT: u32 = 4; 129 | pub const VRING_PACKED_DESC_F_AVAIL: u32 = 7; 130 | pub const VRING_PACKED_DESC_F_USED: u32 = 15; 131 | pub const VRING_USED_F_NO_NOTIFY: u32 = 1; 132 | pub const VRING_AVAIL_F_NO_INTERRUPT: u32 = 1; 133 | pub const VRING_PACKED_EVENT_FLAG_ENABLE: u32 = 0; 134 | pub const VRING_PACKED_EVENT_FLAG_DISABLE: u32 = 1; 135 | pub const VRING_PACKED_EVENT_FLAG_DESC: u32 = 2; 136 | pub const VRING_PACKED_EVENT_F_WRAP_CTR: u32 = 15; 137 | pub const VIRTIO_RING_F_INDIRECT_DESC: u32 = 28; 138 | pub const VIRTIO_RING_F_EVENT_IDX: u32 = 29; 139 | pub const VRING_AVAIL_ALIGN_SIZE: u32 = 2; 140 | pub const VRING_USED_ALIGN_SIZE: u32 = 4; 141 | pub const VRING_DESC_ALIGN_SIZE: u32 = 16; 142 | pub type __u_char = ::std::os::raw::c_uchar; 143 | pub type __u_short = ::std::os::raw::c_ushort; 144 | pub type __u_int = ::std::os::raw::c_uint; 145 | pub type __u_long = ::std::os::raw::c_ulong; 146 | pub type __int8_t = ::std::os::raw::c_schar; 147 | pub type __uint8_t = ::std::os::raw::c_uchar; 148 | pub type __int16_t = ::std::os::raw::c_short; 149 | pub type __uint16_t = ::std::os::raw::c_ushort; 150 | pub type __int32_t = ::std::os::raw::c_int; 151 | pub type __uint32_t = ::std::os::raw::c_uint; 152 | pub type __int64_t = ::std::os::raw::c_long; 153 | pub type __uint64_t = ::std::os::raw::c_ulong; 154 | pub type __int_least8_t = __int8_t; 155 | pub type __uint_least8_t = __uint8_t; 156 | pub type __int_least16_t = __int16_t; 157 | pub type __uint_least16_t = __uint16_t; 158 | pub type __int_least32_t = __int32_t; 159 | pub type __uint_least32_t = __uint32_t; 160 | pub type __int_least64_t = __int64_t; 161 | pub type __uint_least64_t = __uint64_t; 162 | pub type __quad_t = ::std::os::raw::c_long; 163 | pub type __u_quad_t = ::std::os::raw::c_ulong; 164 | pub type __intmax_t = ::std::os::raw::c_long; 165 | pub type __uintmax_t = ::std::os::raw::c_ulong; 166 | pub type __dev_t = ::std::os::raw::c_ulong; 167 | pub type __uid_t = ::std::os::raw::c_uint; 168 | pub type __gid_t = ::std::os::raw::c_uint; 169 | pub type __ino_t = ::std::os::raw::c_ulong; 170 | pub type __ino64_t = ::std::os::raw::c_ulong; 171 | pub type __mode_t = ::std::os::raw::c_uint; 172 | pub type __nlink_t = ::std::os::raw::c_ulong; 173 | pub type __off_t = ::std::os::raw::c_long; 174 | pub type __off64_t = ::std::os::raw::c_long; 175 | pub type __pid_t = ::std::os::raw::c_int; 176 | #[repr(C)] 177 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 178 | pub struct __fsid_t { 179 | pub __val: [::std::os::raw::c_int; 2usize], 180 | } 181 | #[test] 182 | fn bindgen_test_layout___fsid_t() { 183 | assert_eq!( 184 | ::std::mem::size_of::<__fsid_t>(), 185 | 8usize, 186 | concat!("Size of: ", stringify!(__fsid_t)) 187 | ); 188 | assert_eq!( 189 | ::std::mem::align_of::<__fsid_t>(), 190 | 4usize, 191 | concat!("Alignment of ", stringify!(__fsid_t)) 192 | ); 193 | assert_eq!( 194 | unsafe { &(*(::std::ptr::null::<__fsid_t>())).__val as *const _ as usize }, 195 | 0usize, 196 | concat!( 197 | "Offset of field: ", 198 | stringify!(__fsid_t), 199 | "::", 200 | stringify!(__val) 201 | ) 202 | ); 203 | } 204 | pub type __clock_t = ::std::os::raw::c_long; 205 | pub type __rlim_t = ::std::os::raw::c_ulong; 206 | pub type __rlim64_t = ::std::os::raw::c_ulong; 207 | pub type __id_t = ::std::os::raw::c_uint; 208 | pub type __time_t = ::std::os::raw::c_long; 209 | pub type __useconds_t = ::std::os::raw::c_uint; 210 | pub type __suseconds_t = ::std::os::raw::c_long; 211 | pub type __daddr_t = ::std::os::raw::c_int; 212 | pub type __key_t = ::std::os::raw::c_int; 213 | pub type __clockid_t = ::std::os::raw::c_int; 214 | pub type __timer_t = *mut ::std::os::raw::c_void; 215 | pub type __blksize_t = ::std::os::raw::c_long; 216 | pub type __blkcnt_t = ::std::os::raw::c_long; 217 | pub type __blkcnt64_t = ::std::os::raw::c_long; 218 | pub type __fsblkcnt_t = ::std::os::raw::c_ulong; 219 | pub type __fsblkcnt64_t = ::std::os::raw::c_ulong; 220 | pub type __fsfilcnt_t = ::std::os::raw::c_ulong; 221 | pub type __fsfilcnt64_t = ::std::os::raw::c_ulong; 222 | pub type __fsword_t = ::std::os::raw::c_long; 223 | pub type __ssize_t = ::std::os::raw::c_long; 224 | pub type __syscall_slong_t = ::std::os::raw::c_long; 225 | pub type __syscall_ulong_t = ::std::os::raw::c_ulong; 226 | pub type __loff_t = __off64_t; 227 | pub type __caddr_t = *mut ::std::os::raw::c_char; 228 | pub type __intptr_t = ::std::os::raw::c_long; 229 | pub type __socklen_t = ::std::os::raw::c_uint; 230 | pub type __sig_atomic_t = ::std::os::raw::c_int; 231 | pub type int_least8_t = __int_least8_t; 232 | pub type int_least16_t = __int_least16_t; 233 | pub type int_least32_t = __int_least32_t; 234 | pub type int_least64_t = __int_least64_t; 235 | pub type uint_least8_t = __uint_least8_t; 236 | pub type uint_least16_t = __uint_least16_t; 237 | pub type uint_least32_t = __uint_least32_t; 238 | pub type uint_least64_t = __uint_least64_t; 239 | pub type int_fast8_t = ::std::os::raw::c_schar; 240 | pub type int_fast16_t = ::std::os::raw::c_long; 241 | pub type int_fast32_t = ::std::os::raw::c_long; 242 | pub type int_fast64_t = ::std::os::raw::c_long; 243 | pub type uint_fast8_t = ::std::os::raw::c_uchar; 244 | pub type uint_fast16_t = ::std::os::raw::c_ulong; 245 | pub type uint_fast32_t = ::std::os::raw::c_ulong; 246 | pub type uint_fast64_t = ::std::os::raw::c_ulong; 247 | pub type intmax_t = __intmax_t; 248 | pub type uintmax_t = __uintmax_t; 249 | pub type __s8 = ::std::os::raw::c_schar; 250 | pub type __u8 = ::std::os::raw::c_uchar; 251 | pub type __s16 = ::std::os::raw::c_short; 252 | pub type __u16 = ::std::os::raw::c_ushort; 253 | pub type __s32 = ::std::os::raw::c_int; 254 | pub type __u32 = ::std::os::raw::c_uint; 255 | pub type __s64 = ::std::os::raw::c_longlong; 256 | pub type __u64 = ::std::os::raw::c_ulonglong; 257 | #[repr(C)] 258 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 259 | pub struct __kernel_fd_set { 260 | pub fds_bits: [::std::os::raw::c_ulong; 16usize], 261 | } 262 | #[test] 263 | fn bindgen_test_layout___kernel_fd_set() { 264 | assert_eq!( 265 | ::std::mem::size_of::<__kernel_fd_set>(), 266 | 128usize, 267 | concat!("Size of: ", stringify!(__kernel_fd_set)) 268 | ); 269 | assert_eq!( 270 | ::std::mem::align_of::<__kernel_fd_set>(), 271 | 8usize, 272 | concat!("Alignment of ", stringify!(__kernel_fd_set)) 273 | ); 274 | assert_eq!( 275 | unsafe { &(*(::std::ptr::null::<__kernel_fd_set>())).fds_bits as *const _ as usize }, 276 | 0usize, 277 | concat!( 278 | "Offset of field: ", 279 | stringify!(__kernel_fd_set), 280 | "::", 281 | stringify!(fds_bits) 282 | ) 283 | ); 284 | } 285 | pub type __kernel_sighandler_t = 286 | ::std::option::Option; 287 | pub type __kernel_key_t = ::std::os::raw::c_int; 288 | pub type __kernel_mqd_t = ::std::os::raw::c_int; 289 | pub type __kernel_old_uid_t = ::std::os::raw::c_ushort; 290 | pub type __kernel_old_gid_t = ::std::os::raw::c_ushort; 291 | pub type __kernel_old_dev_t = ::std::os::raw::c_ulong; 292 | pub type __kernel_long_t = ::std::os::raw::c_long; 293 | pub type __kernel_ulong_t = ::std::os::raw::c_ulong; 294 | pub type __kernel_ino_t = __kernel_ulong_t; 295 | pub type __kernel_mode_t = ::std::os::raw::c_uint; 296 | pub type __kernel_pid_t = ::std::os::raw::c_int; 297 | pub type __kernel_ipc_pid_t = ::std::os::raw::c_int; 298 | pub type __kernel_uid_t = ::std::os::raw::c_uint; 299 | pub type __kernel_gid_t = ::std::os::raw::c_uint; 300 | pub type __kernel_suseconds_t = __kernel_long_t; 301 | pub type __kernel_daddr_t = ::std::os::raw::c_int; 302 | pub type __kernel_uid32_t = ::std::os::raw::c_uint; 303 | pub type __kernel_gid32_t = ::std::os::raw::c_uint; 304 | pub type __kernel_size_t = __kernel_ulong_t; 305 | pub type __kernel_ssize_t = __kernel_long_t; 306 | pub type __kernel_ptrdiff_t = __kernel_long_t; 307 | #[repr(C)] 308 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 309 | pub struct __kernel_fsid_t { 310 | pub val: [::std::os::raw::c_int; 2usize], 311 | } 312 | #[test] 313 | fn bindgen_test_layout___kernel_fsid_t() { 314 | assert_eq!( 315 | ::std::mem::size_of::<__kernel_fsid_t>(), 316 | 8usize, 317 | concat!("Size of: ", stringify!(__kernel_fsid_t)) 318 | ); 319 | assert_eq!( 320 | ::std::mem::align_of::<__kernel_fsid_t>(), 321 | 4usize, 322 | concat!("Alignment of ", stringify!(__kernel_fsid_t)) 323 | ); 324 | assert_eq!( 325 | unsafe { &(*(::std::ptr::null::<__kernel_fsid_t>())).val as *const _ as usize }, 326 | 0usize, 327 | concat!( 328 | "Offset of field: ", 329 | stringify!(__kernel_fsid_t), 330 | "::", 331 | stringify!(val) 332 | ) 333 | ); 334 | } 335 | pub type __kernel_off_t = __kernel_long_t; 336 | pub type __kernel_loff_t = ::std::os::raw::c_longlong; 337 | pub type __kernel_time_t = __kernel_long_t; 338 | pub type __kernel_time64_t = ::std::os::raw::c_longlong; 339 | pub type __kernel_clock_t = __kernel_long_t; 340 | pub type __kernel_timer_t = ::std::os::raw::c_int; 341 | pub type __kernel_clockid_t = ::std::os::raw::c_int; 342 | pub type __kernel_caddr_t = *mut ::std::os::raw::c_char; 343 | pub type __kernel_uid16_t = ::std::os::raw::c_ushort; 344 | pub type __kernel_gid16_t = ::std::os::raw::c_ushort; 345 | pub type __le16 = __u16; 346 | pub type __be16 = __u16; 347 | pub type __le32 = __u32; 348 | pub type __be32 = __u32; 349 | pub type __le64 = __u64; 350 | pub type __be64 = __u64; 351 | pub type __sum16 = __u16; 352 | pub type __wsum = __u32; 353 | pub type __poll_t = ::std::os::raw::c_uint; 354 | pub type __virtio16 = __u16; 355 | pub type __virtio32 = __u32; 356 | pub type __virtio64 = __u64; 357 | #[repr(C)] 358 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 359 | pub struct vring_desc { 360 | pub addr: __virtio64, 361 | pub len: __virtio32, 362 | pub flags: __virtio16, 363 | pub next: __virtio16, 364 | } 365 | #[test] 366 | fn bindgen_test_layout_vring_desc() { 367 | assert_eq!( 368 | ::std::mem::size_of::(), 369 | 16usize, 370 | concat!("Size of: ", stringify!(vring_desc)) 371 | ); 372 | assert_eq!( 373 | ::std::mem::align_of::(), 374 | 8usize, 375 | concat!("Alignment of ", stringify!(vring_desc)) 376 | ); 377 | assert_eq!( 378 | unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, 379 | 0usize, 380 | concat!( 381 | "Offset of field: ", 382 | stringify!(vring_desc), 383 | "::", 384 | stringify!(addr) 385 | ) 386 | ); 387 | assert_eq!( 388 | unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, 389 | 8usize, 390 | concat!( 391 | "Offset of field: ", 392 | stringify!(vring_desc), 393 | "::", 394 | stringify!(len) 395 | ) 396 | ); 397 | assert_eq!( 398 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 399 | 12usize, 400 | concat!( 401 | "Offset of field: ", 402 | stringify!(vring_desc), 403 | "::", 404 | stringify!(flags) 405 | ) 406 | ); 407 | assert_eq!( 408 | unsafe { &(*(::std::ptr::null::())).next as *const _ as usize }, 409 | 14usize, 410 | concat!( 411 | "Offset of field: ", 412 | stringify!(vring_desc), 413 | "::", 414 | stringify!(next) 415 | ) 416 | ); 417 | } 418 | #[repr(C)] 419 | #[derive(Debug, Default)] 420 | pub struct vring_avail { 421 | pub flags: __virtio16, 422 | pub idx: __virtio16, 423 | pub ring: __IncompleteArrayField<__virtio16>, 424 | } 425 | #[test] 426 | fn bindgen_test_layout_vring_avail() { 427 | assert_eq!( 428 | ::std::mem::size_of::(), 429 | 4usize, 430 | concat!("Size of: ", stringify!(vring_avail)) 431 | ); 432 | assert_eq!( 433 | ::std::mem::align_of::(), 434 | 2usize, 435 | concat!("Alignment of ", stringify!(vring_avail)) 436 | ); 437 | } 438 | #[repr(C)] 439 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 440 | pub struct vring_used_elem { 441 | pub id: __virtio32, 442 | pub len: __virtio32, 443 | } 444 | #[test] 445 | fn bindgen_test_layout_vring_used_elem() { 446 | assert_eq!( 447 | ::std::mem::size_of::(), 448 | 8usize, 449 | concat!("Size of: ", stringify!(vring_used_elem)) 450 | ); 451 | assert_eq!( 452 | ::std::mem::align_of::(), 453 | 4usize, 454 | concat!("Alignment of ", stringify!(vring_used_elem)) 455 | ); 456 | assert_eq!( 457 | unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, 458 | 0usize, 459 | concat!( 460 | "Offset of field: ", 461 | stringify!(vring_used_elem), 462 | "::", 463 | stringify!(id) 464 | ) 465 | ); 466 | assert_eq!( 467 | unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, 468 | 4usize, 469 | concat!( 470 | "Offset of field: ", 471 | stringify!(vring_used_elem), 472 | "::", 473 | stringify!(len) 474 | ) 475 | ); 476 | } 477 | #[repr(C)] 478 | #[derive(Debug, Default)] 479 | pub struct vring_used { 480 | pub flags: __virtio16, 481 | pub idx: __virtio16, 482 | pub ring: __IncompleteArrayField, 483 | pub __bindgen_align: [u32; 0usize], 484 | } 485 | #[test] 486 | fn bindgen_test_layout_vring_used() { 487 | assert_eq!( 488 | ::std::mem::size_of::(), 489 | 4usize, 490 | concat!("Size of: ", stringify!(vring_used)) 491 | ); 492 | assert_eq!( 493 | ::std::mem::align_of::(), 494 | 4usize, 495 | concat!("Alignment of ", stringify!(vring_used)) 496 | ); 497 | } 498 | #[repr(C)] 499 | #[derive(Debug, Copy, Clone, PartialEq)] 500 | pub struct vring { 501 | pub num: ::std::os::raw::c_uint, 502 | pub desc: *mut vring_desc, 503 | pub avail: *mut vring_avail, 504 | pub used: *mut vring_used, 505 | } 506 | #[test] 507 | fn bindgen_test_layout_vring() { 508 | assert_eq!( 509 | ::std::mem::size_of::(), 510 | 32usize, 511 | concat!("Size of: ", stringify!(vring)) 512 | ); 513 | assert_eq!( 514 | ::std::mem::align_of::(), 515 | 8usize, 516 | concat!("Alignment of ", stringify!(vring)) 517 | ); 518 | assert_eq!( 519 | unsafe { &(*(::std::ptr::null::())).num as *const _ as usize }, 520 | 0usize, 521 | concat!( 522 | "Offset of field: ", 523 | stringify!(vring), 524 | "::", 525 | stringify!(num) 526 | ) 527 | ); 528 | assert_eq!( 529 | unsafe { &(*(::std::ptr::null::())).desc as *const _ as usize }, 530 | 8usize, 531 | concat!( 532 | "Offset of field: ", 533 | stringify!(vring), 534 | "::", 535 | stringify!(desc) 536 | ) 537 | ); 538 | assert_eq!( 539 | unsafe { &(*(::std::ptr::null::())).avail as *const _ as usize }, 540 | 16usize, 541 | concat!( 542 | "Offset of field: ", 543 | stringify!(vring), 544 | "::", 545 | stringify!(avail) 546 | ) 547 | ); 548 | assert_eq!( 549 | unsafe { &(*(::std::ptr::null::())).used as *const _ as usize }, 550 | 24usize, 551 | concat!( 552 | "Offset of field: ", 553 | stringify!(vring), 554 | "::", 555 | stringify!(used) 556 | ) 557 | ); 558 | } 559 | impl Default for vring { 560 | fn default() -> Self { 561 | unsafe { ::std::mem::zeroed() } 562 | } 563 | } 564 | #[repr(C)] 565 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 566 | pub struct vring_packed_desc_event { 567 | pub off_wrap: __le16, 568 | pub flags: __le16, 569 | } 570 | #[test] 571 | fn bindgen_test_layout_vring_packed_desc_event() { 572 | assert_eq!( 573 | ::std::mem::size_of::(), 574 | 4usize, 575 | concat!("Size of: ", stringify!(vring_packed_desc_event)) 576 | ); 577 | assert_eq!( 578 | ::std::mem::align_of::(), 579 | 2usize, 580 | concat!("Alignment of ", stringify!(vring_packed_desc_event)) 581 | ); 582 | assert_eq!( 583 | unsafe { 584 | &(*(::std::ptr::null::())).off_wrap as *const _ as usize 585 | }, 586 | 0usize, 587 | concat!( 588 | "Offset of field: ", 589 | stringify!(vring_packed_desc_event), 590 | "::", 591 | stringify!(off_wrap) 592 | ) 593 | ); 594 | assert_eq!( 595 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 596 | 2usize, 597 | concat!( 598 | "Offset of field: ", 599 | stringify!(vring_packed_desc_event), 600 | "::", 601 | stringify!(flags) 602 | ) 603 | ); 604 | } 605 | #[repr(C)] 606 | #[derive(Debug, Default, Copy, Clone, PartialEq)] 607 | pub struct vring_packed_desc { 608 | pub addr: __le64, 609 | pub len: __le32, 610 | pub id: __le16, 611 | pub flags: __le16, 612 | } 613 | #[test] 614 | fn bindgen_test_layout_vring_packed_desc() { 615 | assert_eq!( 616 | ::std::mem::size_of::(), 617 | 16usize, 618 | concat!("Size of: ", stringify!(vring_packed_desc)) 619 | ); 620 | assert_eq!( 621 | ::std::mem::align_of::(), 622 | 8usize, 623 | concat!("Alignment of ", stringify!(vring_packed_desc)) 624 | ); 625 | assert_eq!( 626 | unsafe { &(*(::std::ptr::null::())).addr as *const _ as usize }, 627 | 0usize, 628 | concat!( 629 | "Offset of field: ", 630 | stringify!(vring_packed_desc), 631 | "::", 632 | stringify!(addr) 633 | ) 634 | ); 635 | assert_eq!( 636 | unsafe { &(*(::std::ptr::null::())).len as *const _ as usize }, 637 | 8usize, 638 | concat!( 639 | "Offset of field: ", 640 | stringify!(vring_packed_desc), 641 | "::", 642 | stringify!(len) 643 | ) 644 | ); 645 | assert_eq!( 646 | unsafe { &(*(::std::ptr::null::())).id as *const _ as usize }, 647 | 12usize, 648 | concat!( 649 | "Offset of field: ", 650 | stringify!(vring_packed_desc), 651 | "::", 652 | stringify!(id) 653 | ) 654 | ); 655 | assert_eq!( 656 | unsafe { &(*(::std::ptr::null::())).flags as *const _ as usize }, 657 | 14usize, 658 | concat!( 659 | "Offset of field: ", 660 | stringify!(vring_packed_desc), 661 | "::", 662 | stringify!(flags) 663 | ) 664 | ); 665 | } 666 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2019 Red Hat, Inc. All Rights Reserved. 2 | // SPDX-License-Identifier: (BSD-3-Clause OR Apache-2.0) 3 | 4 | #[cfg(all(feature = "virtio-v4_14_0", not(feature = "virtio-v5_0_0")))] 5 | mod bindings_v4_14_0; 6 | #[cfg(feature = "virtio-v5_0_0")] 7 | mod bindings_v5_0_0; 8 | 9 | // Major hack to have a default version in case no feature is specified: 10 | // If no version is specified by using the features, just use the latest one 11 | // which currently is 5.0. 12 | #[cfg(all(not(feature = "virtio-v4_14_0"), not(feature = "virtio-v5_0_0")))] 13 | mod bindings_v5_0_0; 14 | 15 | pub mod bindings { 16 | #[cfg(all(feature = "virtio-v4_14_0", not(feature = "virtio-v5_0_0")))] 17 | pub use super::bindings_v4_14_0::*; 18 | 19 | #[cfg(feature = "virtio-v5_0_0")] 20 | pub use super::bindings_v5_0_0::*; 21 | 22 | #[cfg(all(not(feature = "virtio-v4_14_0"), not(feature = "virtio-v5_0_0")))] 23 | pub use super::bindings_v5_0_0::*; 24 | } 25 | --------------------------------------------------------------------------------