diff options
author | K. Y. Srinivasan <kys@microsoft.com> | 2012-01-27 18:55:58 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-02 18:30:47 -0500 |
commit | 2939437ce8f2de07237eb2bcce29b6a699bfe799 (patch) | |
tree | 332fcfba624a5f9661eb456c9ae65d28829b2edd /drivers/hv | |
parent | 4f03a2c934894f30a64d397df8c7c4de129c5b30 (diff) |
drivers: hv: kvp: Move the contents of hv_kvp.h to hyperv.h
In preparation for consolidating all KVP related defines into a single header file
that both the kernel and user level components can use, move the contents of
hv_kvp.h into hyperv.h.
Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: Haiyang Zhang <haiyangz@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv')
-rw-r--r-- | drivers/hv/hv_kvp.c | 2 | ||||
-rw-r--r-- | drivers/hv/hv_kvp.h | 181 | ||||
-rw-r--r-- | drivers/hv/hv_util.c | 3 |
3 files changed, 0 insertions, 186 deletions
diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index 0e8343f585bb..4a6971e13539 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c | |||
@@ -28,8 +28,6 @@ | |||
28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
29 | #include <linux/hyperv.h> | 29 | #include <linux/hyperv.h> |
30 | 30 | ||
31 | #include "hv_kvp.h" | ||
32 | |||
33 | 31 | ||
34 | 32 | ||
35 | /* | 33 | /* |
diff --git a/drivers/hv/hv_kvp.h b/drivers/hv/hv_kvp.h deleted file mode 100644 index c2c5bba25a5a..000000000000 --- a/drivers/hv/hv_kvp.h +++ /dev/null | |||
@@ -1,181 +0,0 @@ | |||
1 | /* | ||
2 | * An implementation of HyperV key value pair (KVP) functionality for Linux. | ||
3 | * | ||
4 | * | ||
5 | * Copyright (C) 2010, Novell, Inc. | ||
6 | * Author : K. Y. Srinivasan <ksrinivasan@novell.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License version 2 as published | ||
10 | * by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, but | ||
13 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
15 | * NON INFRINGEMENT. See the GNU General Public License for more | ||
16 | * details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
21 | * | ||
22 | */ | ||
23 | #ifndef _KVP_H | ||
24 | #define _KVP_H_ | ||
25 | |||
26 | /* | ||
27 | * Maximum value size - used for both key names and value data, and includes | ||
28 | * any applicable NULL terminators. | ||
29 | * | ||
30 | * Note: This limit is somewhat arbitrary, but falls easily within what is | ||
31 | * supported for all native guests (back to Win 2000) and what is reasonable | ||
32 | * for the IC KVP exchange functionality. Note that Windows Me/98/95 are | ||
33 | * limited to 255 character key names. | ||
34 | * | ||
35 | * MSDN recommends not storing data values larger than 2048 bytes in the | ||
36 | * registry. | ||
37 | * | ||
38 | * Note: This value is used in defining the KVP exchange message - this value | ||
39 | * cannot be modified without affecting the message size and compatibility. | ||
40 | */ | ||
41 | |||
42 | /* | ||
43 | * bytes, including any null terminators | ||
44 | */ | ||
45 | #define HV_KVP_EXCHANGE_MAX_VALUE_SIZE (2048) | ||
46 | |||
47 | |||
48 | /* | ||
49 | * Maximum key size - the registry limit for the length of an entry name | ||
50 | * is 256 characters, including the null terminator | ||
51 | */ | ||
52 | |||
53 | #define HV_KVP_EXCHANGE_MAX_KEY_SIZE (512) | ||
54 | |||
55 | /* | ||
56 | * In Linux, we implement the KVP functionality in two components: | ||
57 | * 1) The kernel component which is packaged as part of the hv_utils driver | ||
58 | * is responsible for communicating with the host and responsible for | ||
59 | * implementing the host/guest protocol. 2) A user level daemon that is | ||
60 | * responsible for data gathering. | ||
61 | * | ||
62 | * Host/Guest Protocol: The host iterates over an index and expects the guest | ||
63 | * to assign a key name to the index and also return the value corresponding to | ||
64 | * the key. The host will have atmost one KVP transaction outstanding at any | ||
65 | * given point in time. The host side iteration stops when the guest returns | ||
66 | * an error. Microsoft has specified the following mapping of key names to | ||
67 | * host specified index: | ||
68 | * | ||
69 | * Index Key Name | ||
70 | * 0 FullyQualifiedDomainName | ||
71 | * 1 IntegrationServicesVersion | ||
72 | * 2 NetworkAddressIPv4 | ||
73 | * 3 NetworkAddressIPv6 | ||
74 | * 4 OSBuildNumber | ||
75 | * 5 OSName | ||
76 | * 6 OSMajorVersion | ||
77 | * 7 OSMinorVersion | ||
78 | * 8 OSVersion | ||
79 | * 9 ProcessorArchitecture | ||
80 | * | ||
81 | * The Windows host expects the Key Name and Key Value to be encoded in utf16. | ||
82 | * | ||
83 | * Guest Kernel/KVP Daemon Protocol: As noted earlier, we implement all of the | ||
84 | * data gathering functionality in a user mode daemon. The user level daemon | ||
85 | * is also responsible for binding the key name to the index as well. The | ||
86 | * kernel and user-level daemon communicate using a connector channel. | ||
87 | * | ||
88 | * The user mode component first registers with the | ||
89 | * the kernel component. Subsequently, the kernel component requests, data | ||
90 | * for the specified keys. In response to this message the user mode component | ||
91 | * fills in the value corresponding to the specified key. We overload the | ||
92 | * sequence field in the cn_msg header to define our KVP message types. | ||
93 | * | ||
94 | * | ||
95 | * The kernel component simply acts as a conduit for communication between the | ||
96 | * Windows host and the user-level daemon. The kernel component passes up the | ||
97 | * index received from the Host to the user-level daemon. If the index is | ||
98 | * valid (supported), the corresponding key as well as its | ||
99 | * value (both are strings) is returned. If the index is invalid | ||
100 | * (not supported), a NULL key string is returned. | ||
101 | */ | ||
102 | |||
103 | /* | ||
104 | * | ||
105 | * The following definitions are shared with the user-mode component; do not | ||
106 | * change any of this without making the corresponding changes in | ||
107 | * the KVP user-mode component. | ||
108 | */ | ||
109 | |||
110 | enum hv_ku_op { | ||
111 | KVP_REGISTER = 0, /* Register the user mode component */ | ||
112 | KVP_KERNEL_GET, /* Kernel is requesting the value */ | ||
113 | KVP_KERNEL_SET, /* Kernel is providing the value */ | ||
114 | KVP_USER_GET, /* User is requesting the value */ | ||
115 | KVP_USER_SET /* User is providing the value */ | ||
116 | }; | ||
117 | |||
118 | struct hv_ku_msg { | ||
119 | __u32 kvp_index; /* Key index */ | ||
120 | __u8 kvp_key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; /* Key name */ | ||
121 | __u8 kvp_value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; /* Key value */ | ||
122 | }; | ||
123 | |||
124 | |||
125 | |||
126 | |||
127 | #ifdef __KERNEL__ | ||
128 | |||
129 | /* | ||
130 | * Registry value types. | ||
131 | */ | ||
132 | |||
133 | #define REG_SZ 1 | ||
134 | |||
135 | enum hv_kvp_exchg_op { | ||
136 | KVP_OP_GET = 0, | ||
137 | KVP_OP_SET, | ||
138 | KVP_OP_DELETE, | ||
139 | KVP_OP_ENUMERATE, | ||
140 | KVP_OP_COUNT /* Number of operations, must be last. */ | ||
141 | }; | ||
142 | |||
143 | enum hv_kvp_exchg_pool { | ||
144 | KVP_POOL_EXTERNAL = 0, | ||
145 | KVP_POOL_GUEST, | ||
146 | KVP_POOL_AUTO, | ||
147 | KVP_POOL_AUTO_EXTERNAL, | ||
148 | KVP_POOL_AUTO_INTERNAL, | ||
149 | KVP_POOL_COUNT /* Number of pools, must be last. */ | ||
150 | }; | ||
151 | |||
152 | struct hv_kvp_hdr { | ||
153 | u8 operation; | ||
154 | u8 pool; | ||
155 | }; | ||
156 | |||
157 | struct hv_kvp_exchg_msg_value { | ||
158 | u32 value_type; | ||
159 | u32 key_size; | ||
160 | u32 value_size; | ||
161 | u8 key[HV_KVP_EXCHANGE_MAX_KEY_SIZE]; | ||
162 | u8 value[HV_KVP_EXCHANGE_MAX_VALUE_SIZE]; | ||
163 | }; | ||
164 | |||
165 | struct hv_kvp_msg_enumerate { | ||
166 | u32 index; | ||
167 | struct hv_kvp_exchg_msg_value data; | ||
168 | }; | ||
169 | |||
170 | struct hv_kvp_msg { | ||
171 | struct hv_kvp_hdr kvp_hdr; | ||
172 | struct hv_kvp_msg_enumerate kvp_data; | ||
173 | }; | ||
174 | |||
175 | int hv_kvp_init(struct hv_util_service *); | ||
176 | void hv_kvp_deinit(void); | ||
177 | void hv_kvp_onchannelcallback(void *); | ||
178 | |||
179 | #endif /* __KERNEL__ */ | ||
180 | #endif /* _KVP_H */ | ||
181 | |||
diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 55d58f21e6d4..dbb8b8eec210 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c | |||
@@ -28,9 +28,6 @@ | |||
28 | #include <linux/reboot.h> | 28 | #include <linux/reboot.h> |
29 | #include <linux/hyperv.h> | 29 | #include <linux/hyperv.h> |
30 | 30 | ||
31 | #include "hv_kvp.h" | ||
32 | |||
33 | |||
34 | static void shutdown_onchannelcallback(void *context); | 31 | static void shutdown_onchannelcallback(void *context); |
35 | static struct hv_util_service util_shutdown = { | 32 | static struct hv_util_service util_shutdown = { |
36 | .util_cb = shutdown_onchannelcallback, | 33 | .util_cb = shutdown_onchannelcallback, |