1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/* automatically generated by tools/bindgen-all-the-things */

#![allow(clippy::missing_safety_doc)]
#![allow(clippy::undocumented_unsafe_blocks)]
#![allow(clippy::upper_case_acronyms)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]

// Added by virtio_sys/bindgen.sh
use zerocopy::AsBytes;
use zerocopy::FromBytes;
use zerocopy::FromZeroes;

pub const VIRTIO_SCSI_CDB_DEFAULT_SIZE: u32 = 32;
pub const VIRTIO_SCSI_SENSE_DEFAULT_SIZE: u32 = 96;
pub const VIRTIO_SCSI_CDB_SIZE: u32 = 32;
pub const VIRTIO_SCSI_SENSE_SIZE: u32 = 96;
pub const VIRTIO_SCSI_F_INOUT: u32 = 0;
pub const VIRTIO_SCSI_F_HOTPLUG: u32 = 1;
pub const VIRTIO_SCSI_F_CHANGE: u32 = 2;
pub const VIRTIO_SCSI_F_T10_PI: u32 = 3;
pub const VIRTIO_SCSI_S_OK: u32 = 0;
pub const VIRTIO_SCSI_S_OVERRUN: u32 = 1;
pub const VIRTIO_SCSI_S_ABORTED: u32 = 2;
pub const VIRTIO_SCSI_S_BAD_TARGET: u32 = 3;
pub const VIRTIO_SCSI_S_RESET: u32 = 4;
pub const VIRTIO_SCSI_S_BUSY: u32 = 5;
pub const VIRTIO_SCSI_S_TRANSPORT_FAILURE: u32 = 6;
pub const VIRTIO_SCSI_S_TARGET_FAILURE: u32 = 7;
pub const VIRTIO_SCSI_S_NEXUS_FAILURE: u32 = 8;
pub const VIRTIO_SCSI_S_FAILURE: u32 = 9;
pub const VIRTIO_SCSI_S_FUNCTION_SUCCEEDED: u32 = 10;
pub const VIRTIO_SCSI_S_FUNCTION_REJECTED: u32 = 11;
pub const VIRTIO_SCSI_S_INCORRECT_LUN: u32 = 12;
pub const VIRTIO_SCSI_T_TMF: u32 = 0;
pub const VIRTIO_SCSI_T_AN_QUERY: u32 = 1;
pub const VIRTIO_SCSI_T_AN_SUBSCRIBE: u32 = 2;
pub const VIRTIO_SCSI_T_TMF_ABORT_TASK: u32 = 0;
pub const VIRTIO_SCSI_T_TMF_ABORT_TASK_SET: u32 = 1;
pub const VIRTIO_SCSI_T_TMF_CLEAR_ACA: u32 = 2;
pub const VIRTIO_SCSI_T_TMF_CLEAR_TASK_SET: u32 = 3;
pub const VIRTIO_SCSI_T_TMF_I_T_NEXUS_RESET: u32 = 4;
pub const VIRTIO_SCSI_T_TMF_LOGICAL_UNIT_RESET: u32 = 5;
pub const VIRTIO_SCSI_T_TMF_QUERY_TASK: u32 = 6;
pub const VIRTIO_SCSI_T_TMF_QUERY_TASK_SET: u32 = 7;
pub const VIRTIO_SCSI_T_EVENTS_MISSED: u32 = 2147483648;
pub const VIRTIO_SCSI_T_NO_EVENT: u32 = 0;
pub const VIRTIO_SCSI_T_TRANSPORT_RESET: u32 = 1;
pub const VIRTIO_SCSI_T_ASYNC_NOTIFY: u32 = 2;
pub const VIRTIO_SCSI_T_PARAM_CHANGE: u32 = 3;
pub const VIRTIO_SCSI_EVT_RESET_HARD: u32 = 0;
pub const VIRTIO_SCSI_EVT_RESET_RESCAN: u32 = 1;
pub const VIRTIO_SCSI_EVT_RESET_REMOVED: u32 = 2;
pub const VIRTIO_SCSI_S_SIMPLE: u32 = 0;
pub const VIRTIO_SCSI_S_ORDERED: u32 = 1;
pub const VIRTIO_SCSI_S_HEAD: u32 = 2;
pub const VIRTIO_SCSI_S_ACA: u32 = 3;
pub type __virtio16 = u16;
pub type __virtio32 = u32;
pub type __virtio64 = u64;
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)]
pub struct virtio_scsi_cmd_req {
    pub lun: [u8; 8usize],
    pub tag: __virtio64,
    pub task_attr: u8,
    pub prio: u8,
    pub crn: u8,
    pub cdb: [u8; 32usize],
}
#[repr(C, packed)]
#[derive(Debug, Copy, Clone, FromZeroes, FromBytes, AsBytes)]
pub struct virtio_scsi_cmd_resp {
    pub sense_len: __virtio32,
    pub resid: __virtio32,
    pub status_qualifier: __virtio16,
    pub status: u8,
    pub response: u8,
    pub sense: [u8; 96usize],
}
impl Default for virtio_scsi_cmd_resp {
    fn default() -> Self {
        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
        unsafe {
            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
            s.assume_init()
        }
    }
}
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)]
pub struct virtio_scsi_ctrl_tmf_req {
    pub type_: __virtio32,
    pub subtype: __virtio32,
    pub lun: [u8; 8usize],
    pub tag: __virtio64,
}
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)]
pub struct virtio_scsi_ctrl_tmf_resp {
    pub response: u8,
}
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)]
pub struct virtio_scsi_ctrl_an_req {
    pub type_: __virtio32,
    pub lun: [u8; 8usize],
    pub event_requested: __virtio32,
}
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)]
pub struct virtio_scsi_ctrl_an_resp {
    pub event_actual: __virtio32,
    pub response: u8,
}
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone)]
pub struct virtio_scsi_event {
    pub event: __virtio32,
    pub lun: [u8; 8usize],
    pub reason: __virtio32,
}
#[repr(C, packed)]
#[derive(Debug, Default, Copy, Clone, FromZeroes, FromBytes, AsBytes)]
pub struct virtio_scsi_config {
    pub num_queues: __virtio32,
    pub seg_max: __virtio32,
    pub max_sectors: __virtio32,
    pub cmd_per_lun: __virtio32,
    pub event_info_size: __virtio32,
    pub sense_size: __virtio32,
    pub cdb_size: __virtio32,
    pub max_channel: __virtio16,
    pub max_target: __virtio16,
    pub max_lun: __virtio32,
}