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 _UAPI_HYPERV_H
20#define _UAPI_HYPERV_H
21#include <linux/uuid.h>
22#define UTIL_FW_MINOR 0
23#define UTIL_WS2K8_FW_MAJOR 1
24#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
25#define UTIL_FW_MAJOR 3
26#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
27#define VSS_OP_REGISTER 128
28#define VSS_OP_REGISTER1 129
29enum hv_vss_op {
30  VSS_OP_CREATE = 0,
31  VSS_OP_DELETE,
32  VSS_OP_HOT_BACKUP,
33  VSS_OP_GET_DM_INFO,
34  VSS_OP_BU_COMPLETE,
35  VSS_OP_FREEZE,
36  VSS_OP_THAW,
37  VSS_OP_AUTO_RECOVER,
38  VSS_OP_COUNT
39};
40struct hv_vss_hdr {
41  __u8 operation;
42  __u8 reserved[7];
43} __attribute__((packed));
44#define VSS_HBU_NO_AUTO_RECOVERY 0x00000005
45struct hv_vss_check_feature {
46  __u32 flags;
47} __attribute__((packed));
48struct hv_vss_check_dm_info {
49  __u32 flags;
50} __attribute__((packed));
51struct hv_vss_msg {
52  union {
53    struct hv_vss_hdr vss_hdr;
54    int error;
55  };
56  union {
57    struct hv_vss_check_feature vss_cf;
58    struct hv_vss_check_dm_info dm_info;
59  };
60} __attribute__((packed));
61#define FCOPY_VERSION_0 0
62#define FCOPY_VERSION_1 1
63#define FCOPY_CURRENT_VERSION FCOPY_VERSION_1
64#define W_MAX_PATH 260
65enum hv_fcopy_op {
66  START_FILE_COPY = 0,
67  WRITE_TO_FILE,
68  COMPLETE_FCOPY,
69  CANCEL_FCOPY,
70};
71struct hv_fcopy_hdr {
72  __u32 operation;
73  uuid_le service_id0;
74  uuid_le service_id1;
75} __attribute__((packed));
76#define OVER_WRITE 0x1
77#define CREATE_PATH 0x2
78struct hv_start_fcopy {
79  struct hv_fcopy_hdr hdr;
80  __u16 file_name[W_MAX_PATH];
81  __u16 path_name[W_MAX_PATH];
82  __u32 copy_flags;
83  __u64 file_size;
84} __attribute__((packed));
85#define DATA_FRAGMENT (6 * 1024)
86struct hv_do_fcopy {
87  struct hv_fcopy_hdr hdr;
88  __u32 pad;
89  __u64 offset;
90  __u32 size;
91  __u8 data[DATA_FRAGMENT];
92} __attribute__((packed));
93#define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048)
94#define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512)
95#define REG_SZ 1
96#define REG_U32 4
97#define REG_U64 8
98#define KVP_OP_REGISTER 4
99#define KVP_OP_REGISTER1 100
100enum hv_kvp_exchg_op {
101  KVP_OP_GET = 0,
102  KVP_OP_SET,
103  KVP_OP_DELETE,
104  KVP_OP_ENUMERATE,
105  KVP_OP_GET_IP_INFO,
106  KVP_OP_SET_IP_INFO,
107  KVP_OP_COUNT
108};
109enum hv_kvp_exchg_pool {
110  KVP_POOL_EXTERNAL = 0,
111  KVP_POOL_GUEST,
112  KVP_POOL_AUTO,
113  KVP_POOL_AUTO_EXTERNAL,
114  KVP_POOL_AUTO_INTERNAL,
115  KVP_POOL_COUNT
116};
117#define HV_S_OK 0x00000000
118#define HV_E_FAIL 0x80004005
119#define HV_S_CONT 0x80070103
120#define HV_ERROR_NOT_SUPPORTED 0x80070032
121#define HV_ERROR_MACHINE_LOCKED 0x800704F7
122#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F
123#define HV_INVALIDARG 0x80070057
124#define HV_GUID_NOTFOUND 0x80041002
125#define HV_ERROR_ALREADY_EXISTS 0x80070050
126#define HV_ERROR_DISK_FULL 0x80070070
127#define ADDR_FAMILY_NONE 0x00
128#define ADDR_FAMILY_IPV4 0x01
129#define ADDR_FAMILY_IPV6 0x02
130#define MAX_ADAPTER_ID_SIZE 128
131#define MAX_IP_ADDR_SIZE 1024
132#define MAX_GATEWAY_SIZE 512
133struct hv_kvp_ipaddr_value {
134  __u16 adapter_id[MAX_ADAPTER_ID_SIZE];
135  __u8 addr_family;
136  __u8 dhcp_enabled;
137  __u16 ip_addr[MAX_IP_ADDR_SIZE];
138  __u16 sub_net[MAX_IP_ADDR_SIZE];
139  __u16 gate_way[MAX_GATEWAY_SIZE];
140  __u16 dns_addr[MAX_IP_ADDR_SIZE];
141} __attribute__((packed));
142struct hv_kvp_hdr {
143  __u8 operation;
144  __u8 pool;
145  __u16 pad;
146} __attribute__((packed));
147struct hv_kvp_exchg_msg_value {
148  __u32 value_type;
149  __u32 key_size;
150  __u32 value_size;
151  __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
152  union {
153    __u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
154    __u32 value_u32;
155    __u64 value_u64;
156  };
157} __attribute__((packed));
158struct hv_kvp_msg_enumerate {
159  __u32 index;
160  struct hv_kvp_exchg_msg_value data;
161} __attribute__((packed));
162struct hv_kvp_msg_get {
163  struct hv_kvp_exchg_msg_value data;
164};
165struct hv_kvp_msg_set {
166  struct hv_kvp_exchg_msg_value data;
167};
168struct hv_kvp_msg_delete {
169  __u32 key_size;
170  __u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
171};
172struct hv_kvp_register {
173  __u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
174};
175struct hv_kvp_msg {
176  union {
177    struct hv_kvp_hdr kvp_hdr;
178    int error;
179  };
180  union {
181    struct hv_kvp_msg_get kvp_get;
182    struct hv_kvp_msg_set kvp_set;
183    struct hv_kvp_msg_delete kvp_delete;
184    struct hv_kvp_msg_enumerate kvp_enum_data;
185    struct hv_kvp_ipaddr_value kvp_ip_val;
186    struct hv_kvp_register kvp_register;
187  } body;
188} __attribute__((packed));
189struct hv_kvp_ip_msg {
190  __u8 operation;
191  __u8 pool;
192  struct hv_kvp_ipaddr_value kvp_ip_val;
193} __attribute__((packed));
194#endif
195