virtio_sys/
vhost_ioctl.rs

1// Copyright 2023 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 vhost kernel bindings.
6
7use base::ioctl_io_nr;
8use base::ioctl_ior_nr;
9use base::ioctl_iow_nr;
10use base::ioctl_iowr_nr;
11
12use crate::vhost;
13
14pub const VHOST: ::std::os::raw::c_uint = 0xaf;
15
16ioctl_ior_nr!(VHOST_GET_FEATURES, VHOST, 0x00, ::std::os::raw::c_ulonglong);
17ioctl_iow_nr!(VHOST_SET_FEATURES, VHOST, 0x00, ::std::os::raw::c_ulonglong);
18ioctl_io_nr!(VHOST_SET_OWNER, VHOST, 0x01);
19ioctl_io_nr!(VHOST_RESET_OWNER, VHOST, 0x02);
20ioctl_iow_nr!(VHOST_SET_MEM_TABLE, VHOST, 0x03, vhost::vhost_memory);
21ioctl_iow_nr!(VHOST_SET_LOG_BASE, VHOST, 0x04, ::std::os::raw::c_ulonglong);
22ioctl_iow_nr!(VHOST_SET_LOG_FD, VHOST, 0x07, ::std::os::raw::c_int);
23ioctl_iow_nr!(VHOST_SET_VRING_NUM, VHOST, 0x10, vhost::vhost_vring_state);
24ioctl_iow_nr!(VHOST_SET_VRING_ADDR, VHOST, 0x11, vhost::vhost_vring_addr);
25ioctl_iow_nr!(VHOST_SET_VRING_BASE, VHOST, 0x12, vhost::vhost_vring_state);
26ioctl_iowr_nr!(VHOST_GET_VRING_BASE, VHOST, 0x12, vhost::vhost_vring_state);
27ioctl_iow_nr!(VHOST_SET_VRING_KICK, VHOST, 0x20, vhost::vhost_vring_file);
28ioctl_iow_nr!(VHOST_SET_VRING_CALL, VHOST, 0x21, vhost::vhost_vring_file);
29ioctl_iow_nr!(VHOST_SET_VRING_ERR, VHOST, 0x22, vhost::vhost_vring_file);
30ioctl_iow_nr!(VHOST_NET_SET_BACKEND, VHOST, 0x30, vhost::vhost_vring_file);
31ioctl_iow_nr!(
32    VHOST_SCSI_SET_ENDPOINT,
33    VHOST,
34    0x40,
35    vhost::vhost_scsi_target
36);
37ioctl_iow_nr!(
38    VHOST_SCSI_CLEAR_ENDPOINT,
39    VHOST,
40    0x41,
41    vhost::vhost_scsi_target
42);
43ioctl_iow_nr!(
44    VHOST_SCSI_GET_ABI_VERSION,
45    VHOST,
46    0x42,
47    ::std::os::raw::c_int
48);
49ioctl_iow_nr!(
50    VHOST_SCSI_SET_EVENTS_MISSED,
51    VHOST,
52    0x43,
53    ::std::os::raw::c_uint
54);
55ioctl_iow_nr!(
56    VHOST_SCSI_GET_EVENTS_MISSED,
57    VHOST,
58    0x44,
59    ::std::os::raw::c_uint
60);
61ioctl_iow_nr!(
62    VHOST_VSOCK_SET_GUEST_CID,
63    VHOST,
64    0x60,
65    ::std::os::raw::c_ulonglong
66);
67ioctl_iow_nr!(VHOST_VSOCK_SET_RUNNING, VHOST, 0x61, ::std::os::raw::c_int);