]>
Commit | Line | Data |
---|---|---|
cc73685d | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
0b843d35 CB |
2 | |
3 | #ifndef __LXC_CONFILE_UTILS_H | |
4 | #define __LXC_CONFILE_UTILS_H | |
5 | ||
1160ce89 CB |
6 | #include "config.h" |
7 | ||
663e9916 CB |
8 | #include <stdbool.h> |
9 | ||
674c9692 | 10 | #include "compiler.h" |
ce2f5ae8 | 11 | #include "conf.h" |
f9373e40 | 12 | #include "confile_utils.h" |
ce2f5ae8 | 13 | |
1530e041 CB |
14 | #define strprint(str, inlen, ...) \ |
15 | do { \ | |
16 | if (str) \ | |
17 | len = snprintf(str, inlen, ##__VA_ARGS__); \ | |
18 | else \ | |
19 | len = snprintf((char *){""}, 0, ##__VA_ARGS__); \ | |
20 | if (len < 0) \ | |
21 | return log_error_errno(-EIO, EIO, "failed to create string"); \ | |
22 | fulllen += len; \ | |
23 | if (inlen > 0) { \ | |
24 | if (str) \ | |
25 | str += len; \ | |
26 | inlen -= len; \ | |
27 | if (inlen < 0) \ | |
28 | inlen = 0; \ | |
29 | } \ | |
f9373e40 CB |
30 | } while (0); |
31 | ||
f64e249d CB |
32 | __hidden extern int parse_idmaps(const char *idmap, char *type, unsigned long *nsid, |
33 | unsigned long *hostid, unsigned long *range); | |
0b843d35 | 34 | |
f64e249d | 35 | __hidden extern bool lxc_config_value_empty(const char *value); |
f64e249d CB |
36 | __hidden extern struct lxc_netdev *lxc_get_netdev_by_idx(struct lxc_conf *conf, unsigned int idx, |
37 | bool allocate); | |
38 | __hidden extern void lxc_log_configured_netdevs(const struct lxc_conf *conf); | |
39 | __hidden extern bool lxc_remove_nic_by_idx(struct lxc_conf *conf, unsigned int idx); | |
87d0990c | 40 | __hidden extern void lxc_free_networks(struct lxc_conf *conf); |
8d508eaa | 41 | __hidden extern void lxc_clear_netdev(struct lxc_netdev *netdev); |
f64e249d CB |
42 | __hidden extern int lxc_veth_mode_to_flag(int *mode, const char *value); |
43 | __hidden extern char *lxc_veth_flag_to_mode(int mode); | |
44 | __hidden extern int lxc_macvlan_mode_to_flag(int *mode, const char *value); | |
45 | __hidden extern char *lxc_macvlan_flag_to_mode(int mode); | |
46 | __hidden extern int lxc_ipvlan_mode_to_flag(int *mode, const char *value); | |
47 | __hidden extern char *lxc_ipvlan_flag_to_mode(int mode); | |
48 | __hidden extern int lxc_ipvlan_isolation_to_flag(int *mode, const char *value); | |
49 | __hidden extern char *lxc_ipvlan_flag_to_isolation(int mode); | |
663e9916 | 50 | |
f64e249d CB |
51 | __hidden extern int set_config_string_item(char **conf_item, const char *value); |
52 | __hidden extern int set_config_string_item_max(char **conf_item, const char *value, size_t max) | |
53 | __access_r(2, 3); | |
674c9692 | 54 | |
f64e249d CB |
55 | __hidden extern int set_config_path_item(char **conf_item, const char *value); |
56 | __hidden extern int set_config_bool_item(bool *conf_item, const char *value, bool empty_conf_action); | |
57 | __hidden extern int config_ip_prefix(struct in_addr *addr); | |
58 | __hidden extern int network_ifname(char *valuep, const char *value, size_t size) __access_r(2, 3); | |
674c9692 | 59 | |
f64e249d CB |
60 | __hidden extern void rand_complete_hwaddr(char *hwaddr); |
61 | __hidden extern bool lxc_config_net_is_hwaddr(const char *line); | |
62 | __hidden extern bool new_hwaddr(char *hwaddr); | |
63 | __hidden extern int lxc_get_conf_str(char *retv, int inlen, const char *value); | |
64 | __hidden extern int lxc_get_conf_bool(struct lxc_conf *c, char *retv, int inlen, bool v); | |
65 | __hidden extern int lxc_get_conf_int(struct lxc_conf *c, char *retv, int inlen, int v); | |
66 | __hidden extern int lxc_get_conf_size_t(struct lxc_conf *c, char *retv, int inlen, size_t v); | |
67 | __hidden extern int lxc_get_conf_uint64(struct lxc_conf *c, char *retv, int inlen, uint64_t v); | |
68 | __hidden extern int lxc_inherit_namespace(const char *lxcname_or_pid, const char *lxcpath, | |
69 | const char *namespace); | |
70 | __hidden extern int sig_parse(const char *signame); | |
2ea479c9 | 71 | |
0b843d35 | 72 | #endif /* __LXC_CONFILE_UTILS_H */ |