Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/linux
File: hyperv.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
[0] Fix | Delete
/*
[1] Fix | Delete
*
[2] Fix | Delete
* Copyright (c) 2011, Microsoft Corporation.
[3] Fix | Delete
*
[4] Fix | Delete
* This program is free software; you can redistribute it and/or modify it
[5] Fix | Delete
* under the terms and conditions of the GNU General Public License,
[6] Fix | Delete
* version 2, as published by the Free Software Foundation.
[7] Fix | Delete
*
[8] Fix | Delete
* This program is distributed in the hope it will be useful, but WITHOUT
[9] Fix | Delete
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
[10] Fix | Delete
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
[11] Fix | Delete
* more details.
[12] Fix | Delete
*
[13] Fix | Delete
* You should have received a copy of the GNU General Public License along with
[14] Fix | Delete
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
[15] Fix | Delete
* Place - Suite 330, Boston, MA 02111-1307 USA.
[16] Fix | Delete
*
[17] Fix | Delete
* Authors:
[18] Fix | Delete
* Haiyang Zhang <haiyangz@microsoft.com>
[19] Fix | Delete
* Hank Janssen <hjanssen@microsoft.com>
[20] Fix | Delete
* K. Y. Srinivasan <kys@microsoft.com>
[21] Fix | Delete
*
[22] Fix | Delete
*/
[23] Fix | Delete
[24] Fix | Delete
#ifndef _HYPERV_H
[25] Fix | Delete
#define _HYPERV_H
[26] Fix | Delete
[27] Fix | Delete
#include <linux/types.h>
[28] Fix | Delete
[29] Fix | Delete
/*
[30] Fix | Delete
* Framework version for util services.
[31] Fix | Delete
*/
[32] Fix | Delete
#define UTIL_FW_MINOR 0
[33] Fix | Delete
[34] Fix | Delete
#define UTIL_WS2K8_FW_MAJOR 1
[35] Fix | Delete
#define UTIL_WS2K8_FW_VERSION (UTIL_WS2K8_FW_MAJOR << 16 | UTIL_FW_MINOR)
[36] Fix | Delete
[37] Fix | Delete
#define UTIL_FW_MAJOR 3
[38] Fix | Delete
#define UTIL_FW_VERSION (UTIL_FW_MAJOR << 16 | UTIL_FW_MINOR)
[39] Fix | Delete
[40] Fix | Delete
[41] Fix | Delete
/*
[42] Fix | Delete
* Implementation of host controlled snapshot of the guest.
[43] Fix | Delete
*/
[44] Fix | Delete
[45] Fix | Delete
#define VSS_OP_REGISTER 128
[46] Fix | Delete
[47] Fix | Delete
/*
[48] Fix | Delete
Daemon code with full handshake support.
[49] Fix | Delete
*/
[50] Fix | Delete
#define VSS_OP_REGISTER1 129
[51] Fix | Delete
[52] Fix | Delete
enum hv_vss_op {
[53] Fix | Delete
VSS_OP_CREATE = 0,
[54] Fix | Delete
VSS_OP_DELETE,
[55] Fix | Delete
VSS_OP_HOT_BACKUP,
[56] Fix | Delete
VSS_OP_GET_DM_INFO,
[57] Fix | Delete
VSS_OP_BU_COMPLETE,
[58] Fix | Delete
/*
[59] Fix | Delete
* Following operations are only supported with IC version >= 5.0
[60] Fix | Delete
*/
[61] Fix | Delete
VSS_OP_FREEZE, /* Freeze the file systems in the VM */
[62] Fix | Delete
VSS_OP_THAW, /* Unfreeze the file systems */
[63] Fix | Delete
VSS_OP_AUTO_RECOVER,
[64] Fix | Delete
VSS_OP_COUNT /* Number of operations, must be last */
[65] Fix | Delete
};
[66] Fix | Delete
[67] Fix | Delete
[68] Fix | Delete
/*
[69] Fix | Delete
* Header for all VSS messages.
[70] Fix | Delete
*/
[71] Fix | Delete
struct hv_vss_hdr {
[72] Fix | Delete
__u8 operation;
[73] Fix | Delete
__u8 reserved[7];
[74] Fix | Delete
} __attribute__((packed));
[75] Fix | Delete
[76] Fix | Delete
[77] Fix | Delete
/*
[78] Fix | Delete
* Flag values for the hv_vss_check_feature. Linux supports only
[79] Fix | Delete
* one value.
[80] Fix | Delete
*/
[81] Fix | Delete
#define VSS_HBU_NO_AUTO_RECOVERY 0x00000005
[82] Fix | Delete
[83] Fix | Delete
struct hv_vss_check_feature {
[84] Fix | Delete
__u32 flags;
[85] Fix | Delete
} __attribute__((packed));
[86] Fix | Delete
[87] Fix | Delete
struct hv_vss_check_dm_info {
[88] Fix | Delete
__u32 flags;
[89] Fix | Delete
} __attribute__((packed));
[90] Fix | Delete
[91] Fix | Delete
/*
[92] Fix | Delete
* struct hv_vss_msg encodes the fields that the Linux VSS
[93] Fix | Delete
* driver accesses. However, FREEZE messages from Hyper-V contain
[94] Fix | Delete
* additional LUN information that Linux doesn't use and are not
[95] Fix | Delete
* represented in struct hv_vss_msg. A received FREEZE message may
[96] Fix | Delete
* be as large as 6,260 bytes, so the driver must allocate at least
[97] Fix | Delete
* that much space, not sizeof(struct hv_vss_msg). Other messages
[98] Fix | Delete
* such as AUTO_RECOVER may be as large as 12,500 bytes. However,
[99] Fix | Delete
* because the Linux VSS driver responds that it doesn't support
[100] Fix | Delete
* auto-recovery, it should not receive such messages.
[101] Fix | Delete
*/
[102] Fix | Delete
struct hv_vss_msg {
[103] Fix | Delete
union {
[104] Fix | Delete
struct hv_vss_hdr vss_hdr;
[105] Fix | Delete
int error;
[106] Fix | Delete
};
[107] Fix | Delete
union {
[108] Fix | Delete
struct hv_vss_check_feature vss_cf;
[109] Fix | Delete
struct hv_vss_check_dm_info dm_info;
[110] Fix | Delete
};
[111] Fix | Delete
} __attribute__((packed));
[112] Fix | Delete
[113] Fix | Delete
/*
[114] Fix | Delete
* Implementation of a host to guest copy facility.
[115] Fix | Delete
*/
[116] Fix | Delete
[117] Fix | Delete
#define FCOPY_VERSION_0 0
[118] Fix | Delete
#define FCOPY_VERSION_1 1
[119] Fix | Delete
#define FCOPY_CURRENT_VERSION FCOPY_VERSION_1
[120] Fix | Delete
#define W_MAX_PATH 260
[121] Fix | Delete
[122] Fix | Delete
enum hv_fcopy_op {
[123] Fix | Delete
START_FILE_COPY = 0,
[124] Fix | Delete
WRITE_TO_FILE,
[125] Fix | Delete
COMPLETE_FCOPY,
[126] Fix | Delete
CANCEL_FCOPY,
[127] Fix | Delete
};
[128] Fix | Delete
[129] Fix | Delete
struct hv_fcopy_hdr {
[130] Fix | Delete
__u32 operation;
[131] Fix | Delete
__u8 service_id0[16]; /* currently unused */
[132] Fix | Delete
__u8 service_id1[16]; /* currently unused */
[133] Fix | Delete
} __attribute__((packed));
[134] Fix | Delete
[135] Fix | Delete
#define OVER_WRITE 0x1
[136] Fix | Delete
#define CREATE_PATH 0x2
[137] Fix | Delete
[138] Fix | Delete
struct hv_start_fcopy {
[139] Fix | Delete
struct hv_fcopy_hdr hdr;
[140] Fix | Delete
__u16 file_name[W_MAX_PATH];
[141] Fix | Delete
__u16 path_name[W_MAX_PATH];
[142] Fix | Delete
__u32 copy_flags;
[143] Fix | Delete
__u64 file_size;
[144] Fix | Delete
} __attribute__((packed));
[145] Fix | Delete
[146] Fix | Delete
/*
[147] Fix | Delete
* The file is chunked into fragments.
[148] Fix | Delete
*/
[149] Fix | Delete
#define DATA_FRAGMENT (6 * 1024)
[150] Fix | Delete
[151] Fix | Delete
struct hv_do_fcopy {
[152] Fix | Delete
struct hv_fcopy_hdr hdr;
[153] Fix | Delete
__u32 pad;
[154] Fix | Delete
__u64 offset;
[155] Fix | Delete
__u32 size;
[156] Fix | Delete
__u8 data[DATA_FRAGMENT];
[157] Fix | Delete
} __attribute__((packed));
[158] Fix | Delete
[159] Fix | Delete
/*
[160] Fix | Delete
* An implementation of HyperV key value pair (KVP) functionality for Linux.
[161] Fix | Delete
*
[162] Fix | Delete
*
[163] Fix | Delete
* Copyright (C) 2010, Novell, Inc.
[164] Fix | Delete
* Author : K. Y. Srinivasan <ksrinivasan@novell.com>
[165] Fix | Delete
*
[166] Fix | Delete
*/
[167] Fix | Delete
[168] Fix | Delete
/*
[169] Fix | Delete
* Maximum value size - used for both key names and value data, and includes
[170] Fix | Delete
* any applicable NULL terminators.
[171] Fix | Delete
*
[172] Fix | Delete
* Note: This limit is somewhat arbitrary, but falls easily within what is
[173] Fix | Delete
* supported for all native guests (back to Win 2000) and what is reasonable
[174] Fix | Delete
* for the IC KVP exchange functionality. Note that Windows Me/98/95 are
[175] Fix | Delete
* limited to 255 character key names.
[176] Fix | Delete
*
[177] Fix | Delete
* MSDN recommends not storing data values larger than 2048 bytes in the
[178] Fix | Delete
* registry.
[179] Fix | Delete
*
[180] Fix | Delete
* Note: This value is used in defining the KVP exchange message - this value
[181] Fix | Delete
* cannot be modified without affecting the message size and compatibility.
[182] Fix | Delete
*/
[183] Fix | Delete
[184] Fix | Delete
/*
[185] Fix | Delete
* bytes, including any null terminators
[186] Fix | Delete
*/
[187] Fix | Delete
#define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048)
[188] Fix | Delete
[189] Fix | Delete
[190] Fix | Delete
/*
[191] Fix | Delete
* Maximum key size - the registry limit for the length of an entry name
[192] Fix | Delete
* is 256 characters, including the null terminator
[193] Fix | Delete
*/
[194] Fix | Delete
[195] Fix | Delete
#define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512)
[196] Fix | Delete
[197] Fix | Delete
/*
[198] Fix | Delete
* In Linux, we implement the KVP functionality in two components:
[199] Fix | Delete
* 1) The kernel component which is packaged as part of the hv_utils driver
[200] Fix | Delete
* is responsible for communicating with the host and responsible for
[201] Fix | Delete
* implementing the host/guest protocol. 2) A user level daemon that is
[202] Fix | Delete
* responsible for data gathering.
[203] Fix | Delete
*
[204] Fix | Delete
* Host/Guest Protocol: The host iterates over an index and expects the guest
[205] Fix | Delete
* to assign a key name to the index and also return the value corresponding to
[206] Fix | Delete
* the key. The host will have atmost one KVP transaction outstanding at any
[207] Fix | Delete
* given point in time. The host side iteration stops when the guest returns
[208] Fix | Delete
* an error. Microsoft has specified the following mapping of key names to
[209] Fix | Delete
* host specified index:
[210] Fix | Delete
*
[211] Fix | Delete
* Index Key Name
[212] Fix | Delete
* 0 FullyQualifiedDomainName
[213] Fix | Delete
* 1 IntegrationServicesVersion
[214] Fix | Delete
* 2 NetworkAddressIPv4
[215] Fix | Delete
* 3 NetworkAddressIPv6
[216] Fix | Delete
* 4 OSBuildNumber
[217] Fix | Delete
* 5 OSName
[218] Fix | Delete
* 6 OSMajorVersion
[219] Fix | Delete
* 7 OSMinorVersion
[220] Fix | Delete
* 8 OSVersion
[221] Fix | Delete
* 9 ProcessorArchitecture
[222] Fix | Delete
*
[223] Fix | Delete
* The Windows host expects the Key Name and Key Value to be encoded in utf16.
[224] Fix | Delete
*
[225] Fix | Delete
* Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the
[226] Fix | Delete
* data gathering functionality in a user mode daemon. The user level daemon
[227] Fix | Delete
* is also responsible for binding the key name to the index as well. The
[228] Fix | Delete
* kernel and user-level daemon communicate using a connector channel.
[229] Fix | Delete
*
[230] Fix | Delete
* The user mode component first registers with the
[231] Fix | Delete
* kernel component. Subsequently, the kernel component requests, data
[232] Fix | Delete
* for the specified keys. In response to this message the user mode component
[233] Fix | Delete
* fills in the value corresponding to the specified key. We overload the
[234] Fix | Delete
* sequence field in the cn_msg header to define our KVP message types.
[235] Fix | Delete
*
[236] Fix | Delete
*
[237] Fix | Delete
* The kernel component simply acts as a conduit for communication between the
[238] Fix | Delete
* Windows host and the user-level daemon. The kernel component passes up the
[239] Fix | Delete
* index received from the Host to the user-level daemon. If the index is
[240] Fix | Delete
* valid (supported), the corresponding key as well as its
[241] Fix | Delete
* value (both are strings) is returned. If the index is invalid
[242] Fix | Delete
* (not supported), a NULL key string is returned.
[243] Fix | Delete
*/
[244] Fix | Delete
[245] Fix | Delete
[246] Fix | Delete
/*
[247] Fix | Delete
* Registry value types.
[248] Fix | Delete
*/
[249] Fix | Delete
[250] Fix | Delete
#define REG_SZ 1
[251] Fix | Delete
#define REG_U32 4
[252] Fix | Delete
#define REG_U64 8
[253] Fix | Delete
[254] Fix | Delete
/*
[255] Fix | Delete
* As we look at expanding the KVP functionality to include
[256] Fix | Delete
* IP injection functionality, we need to maintain binary
[257] Fix | Delete
* compatibility with older daemons.
[258] Fix | Delete
*
[259] Fix | Delete
* The KVP opcodes are defined by the host and it was unfortunate
[260] Fix | Delete
* that I chose to treat the registration operation as part of the
[261] Fix | Delete
* KVP operations defined by the host.
[262] Fix | Delete
* Here is the level of compatibility
[263] Fix | Delete
* (between the user level daemon and the kernel KVP driver) that we
[264] Fix | Delete
* will implement:
[265] Fix | Delete
*
[266] Fix | Delete
* An older daemon will always be supported on a newer driver.
[267] Fix | Delete
* A given user level daemon will require a minimal version of the
[268] Fix | Delete
* kernel driver.
[269] Fix | Delete
* If we cannot handle the version differences, we will fail gracefully
[270] Fix | Delete
* (this can happen when we have a user level daemon that is more
[271] Fix | Delete
* advanced than the KVP driver.
[272] Fix | Delete
*
[273] Fix | Delete
* We will use values used in this handshake for determining if we have
[274] Fix | Delete
* workable user level daemon and the kernel driver. We begin by taking the
[275] Fix | Delete
* registration opcode out of the KVP opcode namespace. We will however,
[276] Fix | Delete
* maintain compatibility with the existing user-level daemon code.
[277] Fix | Delete
*/
[278] Fix | Delete
[279] Fix | Delete
/*
[280] Fix | Delete
* Daemon code not supporting IP injection (legacy daemon).
[281] Fix | Delete
*/
[282] Fix | Delete
[283] Fix | Delete
#define KVP_OP_REGISTER 4
[284] Fix | Delete
[285] Fix | Delete
/*
[286] Fix | Delete
* Daemon code supporting IP injection.
[287] Fix | Delete
* The KVP opcode field is used to communicate the
[288] Fix | Delete
* registration information; so define a namespace that
[289] Fix | Delete
* will be distinct from the host defined KVP opcode.
[290] Fix | Delete
*/
[291] Fix | Delete
[292] Fix | Delete
#define KVP_OP_REGISTER1 100
[293] Fix | Delete
[294] Fix | Delete
enum hv_kvp_exchg_op {
[295] Fix | Delete
KVP_OP_GET = 0,
[296] Fix | Delete
KVP_OP_SET,
[297] Fix | Delete
KVP_OP_DELETE,
[298] Fix | Delete
KVP_OP_ENUMERATE,
[299] Fix | Delete
KVP_OP_GET_IP_INFO,
[300] Fix | Delete
KVP_OP_SET_IP_INFO,
[301] Fix | Delete
KVP_OP_COUNT /* Number of operations, must be last. */
[302] Fix | Delete
};
[303] Fix | Delete
[304] Fix | Delete
enum hv_kvp_exchg_pool {
[305] Fix | Delete
KVP_POOL_EXTERNAL = 0,
[306] Fix | Delete
KVP_POOL_GUEST,
[307] Fix | Delete
KVP_POOL_AUTO,
[308] Fix | Delete
KVP_POOL_AUTO_EXTERNAL,
[309] Fix | Delete
KVP_POOL_AUTO_INTERNAL,
[310] Fix | Delete
KVP_POOL_COUNT /* Number of pools, must be last. */
[311] Fix | Delete
};
[312] Fix | Delete
[313] Fix | Delete
/*
[314] Fix | Delete
* Some Hyper-V status codes.
[315] Fix | Delete
*/
[316] Fix | Delete
[317] Fix | Delete
#define HV_S_OK 0x00000000
[318] Fix | Delete
#define HV_E_FAIL 0x80004005
[319] Fix | Delete
#define HV_S_CONT 0x80070103
[320] Fix | Delete
#define HV_ERROR_NOT_SUPPORTED 0x80070032
[321] Fix | Delete
#define HV_ERROR_MACHINE_LOCKED 0x800704F7
[322] Fix | Delete
#define HV_ERROR_DEVICE_NOT_CONNECTED 0x8007048F
[323] Fix | Delete
#define HV_INVALIDARG 0x80070057
[324] Fix | Delete
#define HV_GUID_NOTFOUND 0x80041002
[325] Fix | Delete
#define HV_ERROR_ALREADY_EXISTS 0x80070050
[326] Fix | Delete
#define HV_ERROR_DISK_FULL 0x80070070
[327] Fix | Delete
[328] Fix | Delete
#define ADDR_FAMILY_NONE 0x00
[329] Fix | Delete
#define ADDR_FAMILY_IPV4 0x01
[330] Fix | Delete
#define ADDR_FAMILY_IPV6 0x02
[331] Fix | Delete
[332] Fix | Delete
#define MAX_ADAPTER_ID_SIZE 128
[333] Fix | Delete
#define MAX_IP_ADDR_SIZE 1024
[334] Fix | Delete
#define MAX_GATEWAY_SIZE 512
[335] Fix | Delete
[336] Fix | Delete
[337] Fix | Delete
struct hv_kvp_ipaddr_value {
[338] Fix | Delete
__u16 adapter_id[MAX_ADAPTER_ID_SIZE];
[339] Fix | Delete
__u8 addr_family;
[340] Fix | Delete
__u8 dhcp_enabled;
[341] Fix | Delete
__u16 ip_addr[MAX_IP_ADDR_SIZE];
[342] Fix | Delete
__u16 sub_net[MAX_IP_ADDR_SIZE];
[343] Fix | Delete
__u16 gate_way[MAX_GATEWAY_SIZE];
[344] Fix | Delete
__u16 dns_addr[MAX_IP_ADDR_SIZE];
[345] Fix | Delete
} __attribute__((packed));
[346] Fix | Delete
[347] Fix | Delete
[348] Fix | Delete
struct hv_kvp_hdr {
[349] Fix | Delete
__u8 operation;
[350] Fix | Delete
__u8 pool;
[351] Fix | Delete
__u16 pad;
[352] Fix | Delete
} __attribute__((packed));
[353] Fix | Delete
[354] Fix | Delete
struct hv_kvp_exchg_msg_value {
[355] Fix | Delete
__u32 value_type;
[356] Fix | Delete
__u32 key_size;
[357] Fix | Delete
__u32 value_size;
[358] Fix | Delete
__u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
[359] Fix | Delete
union {
[360] Fix | Delete
__u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE];
[361] Fix | Delete
__u32 value_u32;
[362] Fix | Delete
__u64 value_u64;
[363] Fix | Delete
};
[364] Fix | Delete
} __attribute__((packed));
[365] Fix | Delete
[366] Fix | Delete
struct hv_kvp_msg_enumerate {
[367] Fix | Delete
__u32 index;
[368] Fix | Delete
struct hv_kvp_exchg_msg_value data;
[369] Fix | Delete
} __attribute__((packed));
[370] Fix | Delete
[371] Fix | Delete
struct hv_kvp_msg_get {
[372] Fix | Delete
struct hv_kvp_exchg_msg_value data;
[373] Fix | Delete
};
[374] Fix | Delete
[375] Fix | Delete
struct hv_kvp_msg_set {
[376] Fix | Delete
struct hv_kvp_exchg_msg_value data;
[377] Fix | Delete
};
[378] Fix | Delete
[379] Fix | Delete
struct hv_kvp_msg_delete {
[380] Fix | Delete
__u32 key_size;
[381] Fix | Delete
__u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
[382] Fix | Delete
};
[383] Fix | Delete
[384] Fix | Delete
struct hv_kvp_register {
[385] Fix | Delete
__u8 version[HV_KVP_EXCHANGE_MAX_KEY_SIZE];
[386] Fix | Delete
};
[387] Fix | Delete
[388] Fix | Delete
struct hv_kvp_msg {
[389] Fix | Delete
union {
[390] Fix | Delete
struct hv_kvp_hdr kvp_hdr;
[391] Fix | Delete
int error;
[392] Fix | Delete
};
[393] Fix | Delete
union {
[394] Fix | Delete
struct hv_kvp_msg_get kvp_get;
[395] Fix | Delete
struct hv_kvp_msg_set kvp_set;
[396] Fix | Delete
struct hv_kvp_msg_delete kvp_delete;
[397] Fix | Delete
struct hv_kvp_msg_enumerate kvp_enum_data;
[398] Fix | Delete
struct hv_kvp_ipaddr_value kvp_ip_val;
[399] Fix | Delete
struct hv_kvp_register kvp_register;
[400] Fix | Delete
} body;
[401] Fix | Delete
} __attribute__((packed));
[402] Fix | Delete
[403] Fix | Delete
struct hv_kvp_ip_msg {
[404] Fix | Delete
__u8 operation;
[405] Fix | Delete
__u8 pool;
[406] Fix | Delete
struct hv_kvp_ipaddr_value kvp_ip_val;
[407] Fix | Delete
} __attribute__((packed));
[408] Fix | Delete
[409] Fix | Delete
#endif /* _HYPERV_H */
[410] Fix | Delete
[411] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function