Debian Codegraph @

tools/xl/xl_parse.h

raw
1 /*
2 * Copyright 2009-2017 Citrix Ltd and other contributors
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published
6 * by the Free Software Foundation; version 2.1 only. with the special
7 * exception on linking described in file LICENSE.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
13 */
14
15 #ifndef XL_PARSE_H
16 #define XL_PARSE_H
17
18 #include <libxl.h>
19
20 void parse_config_data(const char *config_source,
21 const char *config_data,
22 int config_len,
23 libxl_domain_config *d_config);
24 int parse_range(const char *str, unsigned long *a, unsigned long *b);
25 int64_t parse_mem_size_kb(const char *mem);
26 void parse_disk_config(XLU_Config **config, const char *spec,
27 libxl_device_disk *disk);
28
29 void parse_disk_config_multistring(XLU_Config **config,
30 int nspecs, const char *const *specs,
31 libxl_device_disk *disk);
32 int parse_usbctrl_config(libxl_device_usbctrl *usbctrl, char *token);
33 int parse_usbdev_config(libxl_device_usbdev *usbdev, char *token);
34 int parse_cpurange(const char *cpu, libxl_bitmap *cpumap);
35 int parse_nic_config(libxl_device_nic *nic, XLU_Config **config, char *token);
36 int parse_vdispl_config(libxl_device_vdispl *vdispl, char *token);
37 int parse_vsnd_item(libxl_device_vsnd *vsnd, const char *spec);
38 int parse_vkb_config(libxl_device_vkb *vkb, char *token);
39
40 int match_option_size(const char *prefix, size_t len,
41 char *arg, char **argopt);
42 #define MATCH_OPTION(prefix, arg, oparg) \
43 match_option_size((prefix "="), sizeof((prefix)), (arg), &(oparg))
44
45
46 void split_string_into_string_list(const char *str, const char *delim,
47 libxl_string_list *psl);
48 void replace_string(char **str, const char *val);
49
50 /* NB: this follows the interface used by <ctype.h>. See 'man 3 ctype'
51 and look for CTYPE in libxl_internal.h */
52 typedef int (*char_predicate_t)(const int c);
53 void trim(char_predicate_t predicate, const char *input, char **output);
54 int split_string_into_pair(const char *str, char delim, char **a, char **b,
55 char_predicate_t predicate);
56
57 const char *get_action_on_shutdown_name(libxl_action_on_shutdown a);
58
59 #endif /* XL_PARSE_H */
60
61 /*
62 * Local variables:
63 * mode: C
64 * c-basic-offset: 4
65 * indent-tabs-mode: nil
66 * End:
67 */