|
8 | 8 | */ |
9 | 9 | #pragma once |
10 | 10 |
|
11 | | -#include <ifaddrs.h> |
12 | | - |
13 | 11 | #include <nvme/types.h> |
14 | 12 |
|
15 | 13 | /** |
@@ -149,121 +147,6 @@ const char *nvme_errno_to_string(int err); |
149 | 147 | */ |
150 | 148 | const char *nvme_strerror(int err); |
151 | 149 |
|
152 | | -struct nvme_root; |
153 | | -struct nvme_global_ctx; |
154 | | - |
155 | | -int hostname2traddr(struct nvme_global_ctx *ctx, const char *traddr, char **hostname); |
156 | | - |
157 | | -/** |
158 | | - * get_entity_name - Get Entity Name (ENAME). |
159 | | - * @buffer: The buffer where the ENAME will be saved as an ASCII string. |
160 | | - * @bufsz: The size of @buffer. |
161 | | - * |
162 | | - * Per TP8010, ENAME is defined as the name associated with the host (i.e. |
163 | | - * hostname). |
164 | | - * |
165 | | - * Return: Number of characters copied to @buffer. |
166 | | - */ |
167 | | -size_t get_entity_name(char *buffer, size_t bufsz); |
168 | | - |
169 | | -/** |
170 | | - * get_entity_version - Get Entity Version (EVER). |
171 | | - * @buffer: The buffer where the EVER will be saved as an ASCII string. |
172 | | - * @bufsz: The size of @buffer. |
173 | | - * |
174 | | - * EVER is defined as the operating system name and version as an ASCII |
175 | | - * string. This function reads different files from the file system and |
176 | | - * builds a string as follows: [os type] [os release] [distro release] |
177 | | - * |
178 | | - * E.g. "Linux 5.17.0-rc1 SLES 15.4" |
179 | | - * |
180 | | - * Return: Number of characters copied to @buffer. |
181 | | - */ |
182 | | -size_t get_entity_version(char *buffer, size_t bufsz); |
183 | | - |
184 | | -/** |
185 | | - * kv_strip - Strip blanks from key value string |
186 | | - * @kv: The key-value string to strip |
187 | | - * |
188 | | - * Strip leading/trailing blanks as well as trailing comments from the |
189 | | - * Key=Value string pointed to by @kv. |
190 | | - * |
191 | | - * Return: A pointer to the stripped string. Note that the original string, |
192 | | - * @kv, gets modified. |
193 | | - */ |
194 | | -char *kv_strip(char *kv); |
195 | | - |
196 | | -/** |
197 | | - * kv_keymatch - Look for key in key value string |
198 | | - * @kv: The key=value string to search for the presence of @key |
199 | | - * @key: The key to look for |
200 | | - * |
201 | | - * Look for @key in the Key=Value pair pointed to by @k and return a |
202 | | - * pointer to the Value if @key is found. |
203 | | - * |
204 | | - * Check if @kv starts with @key. If it does then make sure that we |
205 | | - * have a whole-word match on the @key, and if we do, return a pointer |
206 | | - * to the first character of value (i.e. skip leading spaces, tabs, |
207 | | - * and equal sign) |
208 | | - * |
209 | | - * Return: A pointer to the first character of "value" if a match is found. |
210 | | - * NULL otherwise. |
211 | | - */ |
212 | | -char *kv_keymatch(const char *kv, const char *key); |
213 | | - |
214 | | -/** |
215 | | - * startswith - Checks that a string starts with a given prefix. |
216 | | - * @s: The string to check |
217 | | - * @prefix: A string that @s could be starting with |
218 | | - * |
219 | | - * Return: If @s starts with @prefix, then return a pointer within @s at |
220 | | - * the first character after the matched @prefix. NULL otherwise. |
221 | | - */ |
222 | | -char *startswith(const char *s, const char *prefix); |
223 | | - |
224 | | -#define __round_mask(val, mult) ((__typeof__(val))((mult)-1)) |
225 | | - |
226 | | -/** |
227 | | - * round_up - Round a value @val to the next multiple specified by @mult. |
228 | | - * @val: Value to round |
229 | | - * @mult: Multiple to round to. |
230 | | - * |
231 | | - * usage: int x = round_up(13, sizeof(__u32)); // 13 -> 16 |
232 | | - */ |
233 | | -#define round_up(val, mult) ((((val)-1) | __round_mask((val), (mult)))+1) |
234 | | - |
235 | | -/** |
236 | | - * nvmf_exat_len() - Return length rounded up by 4 |
237 | | - * @val_len: Value length |
238 | | - * |
239 | | - * Return the size in bytes, rounded to a multiple of 4 (e.g., size of |
240 | | - * __u32), of the buffer needed to hold the exat value of size |
241 | | - * @val_len. |
242 | | - * |
243 | | - * Return: Length rounded up by 4 |
244 | | - */ |
245 | | -static inline __u16 nvmf_exat_len(size_t val_len) |
246 | | -{ |
247 | | - return (__u16)round_up(val_len, sizeof(__u32)); |
248 | | -} |
249 | | - |
250 | | -/** |
251 | | - * nvmf_exat_size - Return min aligned size to hold value |
252 | | - * @val_len: This is the length of the data to be copied to the "exatval" |
253 | | - * field of a "struct nvmf_ext_attr". |
254 | | - * |
255 | | - * Return the size of the "struct nvmf_ext_attr" needed to hold |
256 | | - * a value of size @val_len. |
257 | | - * |
258 | | - * Return: The size in bytes, rounded to a multiple of 4 (i.e. size of |
259 | | - * __u32), of the "struct nvmf_ext_attr" required to hold a string of |
260 | | - * length @val_len. |
261 | | - */ |
262 | | -static inline __u16 nvmf_exat_size(size_t val_len) |
263 | | -{ |
264 | | - return (__u16)(sizeof(struct nvmf_ext_attr) + nvmf_exat_len(val_len)); |
265 | | -} |
266 | | - |
267 | 150 | /** |
268 | 151 | * nvmf_exat_ptr_next - Increment @p to the next element in the array. |
269 | 152 | * @p: Pointer to an element of an array of "struct nvmf_ext_attr". |
@@ -335,38 +218,3 @@ int nvme_uuid_random(unsigned char uuid[NVME_UUID_LEN]); |
335 | 218 | */ |
336 | 219 | int nvme_uuid_find(struct nvme_id_uuid_list *uuid_list, const unsigned char uuid[NVME_UUID_LEN]); |
337 | 220 |
|
338 | | -/** |
339 | | - * nvme_ipaddrs_eq - Check if 2 IP addresses are equal. |
340 | | - * @addr1: IP address (can be IPv4 or IPv6) |
341 | | - * @addr2: IP address (can be IPv4 or IPv6) |
342 | | - * |
343 | | - * Return: true if addr1 == addr2. false otherwise. |
344 | | - */ |
345 | | -bool nvme_ipaddrs_eq(const char *addr1, const char *addr2); |
346 | | - |
347 | | -/** |
348 | | - * nvme_iface_matching_addr - Get interface matching @addr |
349 | | - * @iface_list: Interface list returned by getifaddrs() |
350 | | - * @addr: Address to match |
351 | | - * |
352 | | - * Parse the interface list pointed to by @iface_list looking |
353 | | - * for the interface that has @addr as one of its assigned |
354 | | - * addresses. |
355 | | - * |
356 | | - * Return: The name of the interface that owns @addr or NULL. |
357 | | - */ |
358 | | -const char *nvme_iface_matching_addr(const struct ifaddrs *iface_list, const char *addr); |
359 | | - |
360 | | -/** |
361 | | - * nvme_iface_primary_addr_matches - Check that interface's primary address matches |
362 | | - * @iface_list: Interface list returned by getifaddrs() |
363 | | - * @iface: Interface to match |
364 | | - * @addr: Address to match |
365 | | - * |
366 | | - * Parse the interface list pointed to by @iface_list and looking for |
367 | | - * interface @iface. The get its primary address and check if it matches |
368 | | - * @addr. |
369 | | - * |
370 | | - * Return: true if a match is found, false otherwise. |
371 | | - */ |
372 | | -bool nvme_iface_primary_addr_matches(const struct ifaddrs *iface_list, const char *iface, const char *addr); |
0 commit comments