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