target_core_user.h revision 525ce914edf136d2bd02ac8c404d56c52e737f4d
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)
27struct tcmu_mailbox {
28  __u16 version;
29  __u16 flags;
30  __u32 cmdr_off;
31  __u32 cmdr_size;
32  __u32 cmd_head;
33  __u32 cmd_tail __attribute__((__aligned__(ALIGN_SIZE)));
34} __packed;
35enum tcmu_opcode {
36  TCMU_OP_PAD = 0,
37  TCMU_OP_CMD,
38};
39struct tcmu_cmd_entry_hdr {
40  __u32 len_op;
41  __u16 cmd_id;
42  __u8 kflags;
43#define TCMU_UFLAG_UNKNOWN_OP 0x1
44  __u8 uflags;
45} __packed;
46#define TCMU_OP_MASK 0x7
47#define TCMU_SENSE_BUFFERSIZE 96
48struct tcmu_cmd_entry {
49  struct tcmu_cmd_entry_hdr hdr;
50  union {
51    struct {
52      __u32 iov_cnt;
53      __u32 iov_bidi_cnt;
54      __u32 iov_dif_cnt;
55      __u64 cdb_off;
56      __u64 __pad1;
57      __u64 __pad2;
58      struct iovec iov[0];
59    } req;
60    struct {
61      __u8 scsi_status;
62      __u8 __pad1;
63      __u16 __pad2;
64      __u32 __pad3;
65      char sense_buffer[TCMU_SENSE_BUFFERSIZE];
66    } rsp;
67  };
68} __packed;
69#define TCMU_OP_ALIGN_SIZE sizeof(__u64)
70enum tcmu_genl_cmd {
71  TCMU_CMD_UNSPEC,
72  TCMU_CMD_ADDED_DEVICE,
73  TCMU_CMD_REMOVED_DEVICE,
74  __TCMU_CMD_MAX,
75};
76#define TCMU_CMD_MAX (__TCMU_CMD_MAX - 1)
77enum tcmu_genl_attr {
78  TCMU_ATTR_UNSPEC,
79  TCMU_ATTR_DEVICE,
80  TCMU_ATTR_MINOR,
81  __TCMU_ATTR_MAX,
82};
83#define TCMU_ATTR_MAX (__TCMU_ATTR_MAX - 1)
84#endif
85