1 // Copyright 2017 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 //! Linux virtio bindings. 6 7 #![allow(non_upper_case_globals)] 8 #![allow(non_camel_case_types)] 9 #![allow(non_snake_case)] 10 11 use base::ioctl_io_nr; 12 use base::ioctl_ior_nr; 13 use base::ioctl_iow_nr; 14 use base::ioctl_iowr_nr; 15 16 pub mod vhost; 17 pub mod virtio_config; 18 pub mod virtio_fs; 19 pub mod virtio_ids; 20 pub mod virtio_mmio; 21 pub mod virtio_net; 22 pub mod virtio_ring; 23 pub use crate::virtio_mmio::*; 24 25 pub const VHOST: ::std::os::raw::c_uint = 0xaf; 26 27 ioctl_ior_nr!(VHOST_GET_FEATURES, VHOST, 0x00, ::std::os::raw::c_ulonglong); 28 ioctl_iow_nr!(VHOST_SET_FEATURES, VHOST, 0x00, ::std::os::raw::c_ulonglong); 29 ioctl_io_nr!(VHOST_SET_OWNER, VHOST, 0x01); 30 ioctl_io_nr!(VHOST_RESET_OWNER, VHOST, 0x02); 31 ioctl_iow_nr!(VHOST_SET_MEM_TABLE, VHOST, 0x03, vhost::vhost_memory); 32 ioctl_iow_nr!(VHOST_SET_LOG_BASE, VHOST, 0x04, ::std::os::raw::c_ulonglong); 33 ioctl_iow_nr!(VHOST_SET_LOG_FD, VHOST, 0x07, ::std::os::raw::c_int); 34 ioctl_iow_nr!(VHOST_SET_VRING_NUM, VHOST, 0x10, vhost::vhost_vring_state); 35 ioctl_iow_nr!(VHOST_SET_VRING_ADDR, VHOST, 0x11, vhost::vhost_vring_addr); 36 ioctl_iow_nr!(VHOST_SET_VRING_BASE, VHOST, 0x12, vhost::vhost_vring_state); 37 ioctl_iowr_nr!(VHOST_GET_VRING_BASE, VHOST, 0x12, vhost::vhost_vring_state); 38 ioctl_iow_nr!(VHOST_SET_VRING_KICK, VHOST, 0x20, vhost::vhost_vring_file); 39 ioctl_iow_nr!(VHOST_SET_VRING_CALL, VHOST, 0x21, vhost::vhost_vring_file); 40 ioctl_iow_nr!(VHOST_SET_VRING_ERR, VHOST, 0x22, vhost::vhost_vring_file); 41 ioctl_iow_nr!(VHOST_NET_SET_BACKEND, VHOST, 0x30, vhost::vhost_vring_file); 42 ioctl_iow_nr!( 43 VHOST_SCSI_SET_ENDPOINT, 44 VHOST, 45 0x40, 46 vhost::vhost_scsi_target 47 ); 48 ioctl_iow_nr!( 49 VHOST_SCSI_CLEAR_ENDPOINT, 50 VHOST, 51 0x41, 52 vhost::vhost_scsi_target 53 ); 54 ioctl_iow_nr!( 55 VHOST_SCSI_GET_ABI_VERSION, 56 VHOST, 57 0x42, 58 ::std::os::raw::c_int 59 ); 60 ioctl_iow_nr!( 61 VHOST_SCSI_SET_EVENTS_MISSED, 62 VHOST, 63 0x43, 64 ::std::os::raw::c_uint 65 ); 66 ioctl_iow_nr!( 67 VHOST_SCSI_GET_EVENTS_MISSED, 68 VHOST, 69 0x44, 70 ::std::os::raw::c_uint 71 ); 72 ioctl_iow_nr!( 73 VHOST_VSOCK_SET_GUEST_CID, 74 VHOST, 75 0x60, 76 ::std::os::raw::c_ulonglong 77 ); 78 ioctl_iow_nr!(VHOST_VSOCK_SET_RUNNING, VHOST, 0x61, ::std::os::raw::c_int); 79