• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef __TARGET_CORE_USER_H
20 #define __TARGET_CORE_USER_H
21 #include <linux/types.h>
22 #include <linux/uio.h>
23 #define TCMU_VERSION "2.0"
24 #define TCMU_MAILBOX_VERSION 2
25 #define ALIGN_SIZE 64
26 #define TCMU_MAILBOX_FLAG_CAP_OOOC (1 << 0)
27 #define TCMU_MAILBOX_FLAG_CAP_READ_LEN (1 << 1)
28 struct tcmu_mailbox {
29   __u16 version;
30   __u16 flags;
31   __u32 cmdr_off;
32   __u32 cmdr_size;
33   __u32 cmd_head;
34   __u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE)));
35 } __packed;
36 enum tcmu_opcode {
37   TCMU_OP_PAD = 0,
38   TCMU_OP_CMD,
39 };
40 struct tcmu_cmd_entry_hdr {
41   __u32 len_op;
42   __u16 cmd_id;
43   __u8 kflags;
44 #define TCMU_UFLAG_UNKNOWN_OP 0x1
45 #define TCMU_UFLAG_READ_LEN 0x2
46   __u8 uflags;
47 } __packed;
48 #define TCMU_OP_MASK 0x7
49 #define TCMU_SENSE_BUFFERSIZE 96
50 struct tcmu_cmd_entry {
51   struct tcmu_cmd_entry_hdr hdr;
52   union {
53     struct {
54       __u32 iov_cnt;
55       __u32 iov_bidi_cnt;
56       __u32 iov_dif_cnt;
57       __u64 cdb_off;
58       __u64 __pad1;
59       __u64 __pad2;
60       struct iovec iov[0];
61     } req;
62     struct {
63       __u8 scsi_status;
64       __u8 __pad1;
65       __u16 __pad2;
66       __u32 read_len;
67       char sense_buffer[TCMU_SENSE_BUFFERSIZE];
68     } rsp;
69   };
70 } __packed;
71 #define TCMU_OP_ALIGN_SIZE sizeof(__u64)
72 enum tcmu_genl_cmd {
73   TCMU_CMD_UNSPEC,
74   TCMU_CMD_ADDED_DEVICE,
75   TCMU_CMD_REMOVED_DEVICE,
76   TCMU_CMD_RECONFIG_DEVICE,
77   TCMU_CMD_ADDED_DEVICE_DONE,
78   TCMU_CMD_REMOVED_DEVICE_DONE,
79   TCMU_CMD_RECONFIG_DEVICE_DONE,
80   TCMU_CMD_SET_FEATURES,
81   __TCMU_CMD_MAX,
82 };
83 #define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
84 enum tcmu_genl_attr {
85   TCMU_ATTR_UNSPEC,
86   TCMU_ATTR_DEVICE,
87   TCMU_ATTR_MINOR,
88   TCMU_ATTR_PAD,
89   TCMU_ATTR_DEV_CFG,
90   TCMU_ATTR_DEV_SIZE,
91   TCMU_ATTR_WRITECACHE,
92   TCMU_ATTR_CMD_STATUS,
93   TCMU_ATTR_DEVICE_ID,
94   TCMU_ATTR_SUPP_KERN_CMD_REPLY,
95   __TCMU_ATTR_MAX,
96 };
97 #define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
98 #endif
99