]> git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/confile.h
seccomp: s/seccomp_notif_id_valid/seccomp_notify_id_valid/g
[mirror_lxc.git] / src / lxc / confile.h
1 /*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2008
5 *
6 * Authors:
7 * Daniel Lezcano <daniel.lezcano at free.fr>
8 * Serge Hallyn <serge@hallyn.com>
9 * Christian Brauner <christian.brauner@ubuntu.com>
10 *
11 * This library is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU Lesser General Public
13 * License as published by the Free Software Foundation; either
14 * version 2.1 of the License, or (at your option) any later version.
15 *
16 * This library is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 */
25
26 #ifndef __LXC_CONFILE_H
27 #define __LXC_CONFILE_H
28
29 #include <stdbool.h>
30 #include <stdio.h>
31
32 #include <lxc/attach_options.h>
33 #include <lxc/lxccontainer.h>
34
35 struct lxc_conf;
36 struct lxc_list;
37
38 /* Callback prototype to set a configuration item.
39 * Must be implemented when adding a new configuration key.
40 */
41 typedef int (*config_set_cb)(const char *key, const char *value,
42 struct lxc_conf *conf, void *data);
43
44 /* Callback prototype to get a configuration item.
45 * Must be implemented when adding a new configuration key.
46 */
47 typedef int (*config_get_cb)(const char *key, char *value, int inlen,
48 struct lxc_conf *conf, void *data);
49
50 /* Callback prototype to clear a configuration item.
51 * Must be implemented when adding a new configuration key.
52 */
53 typedef int (*config_clr_cb)(const char *key, struct lxc_conf *conf,
54 void *data);
55
56 struct lxc_config_t {
57 char *name;
58 config_set_cb set;
59 config_get_cb get;
60 config_clr_cb clr;
61 };
62
63 struct new_config_item {
64 char *key;
65 char *val;
66 };
67
68 /* Get the jump table entry for the given configuration key. */
69 extern struct lxc_config_t *lxc_get_config(const char *key);
70
71 /* List all available config items. */
72 extern int lxc_list_config_items(char *retv, int inlen);
73
74 /* Given a configuration key namespace (e.g. lxc.apparmor) list all associated
75 * subkeys for that namespace.
76 * Must be implemented when adding a new configuration key.
77 */
78 extern int lxc_list_subkeys(struct lxc_conf *conf, const char *key, char *retv,
79 int inlen);
80
81 /* List all configuration items associated with a given network. For example
82 * pass "lxc.net.[i]" to retrieve all configuration items associated with
83 * the network associated with index [i].
84 */
85 extern int lxc_list_net(struct lxc_conf *c, const char *key, char *retv,
86 int inlen);
87
88 extern int lxc_config_read(const char *file, struct lxc_conf *conf,
89 bool from_include);
90
91 extern int append_unexp_config_line(const char *line, struct lxc_conf *conf);
92
93 extern int lxc_config_define_add(struct lxc_list *defines, char* arg);
94
95 extern bool lxc_config_define_load(struct lxc_list *defines,
96 struct lxc_container *c);
97
98 extern void lxc_config_define_free(struct lxc_list *defines);
99
100 /* needed for lxc-attach */
101 extern signed long lxc_config_parse_arch(const char *arch);
102
103 extern int lxc_fill_elevated_privileges(char *flaglist, int *flags);
104
105 extern int lxc_clear_config_item(struct lxc_conf *c, const char *key);
106
107 extern int write_config(int fd, const struct lxc_conf *conf);
108
109 extern bool do_append_unexp_config_line(struct lxc_conf *conf, const char *key,
110 const char *v);
111
112 /* These are used when cloning a container */
113 extern void clear_unexp_config_line(struct lxc_conf *conf, const char *key,
114 bool rm_subkeys);
115
116 extern bool clone_update_unexp_hooks(struct lxc_conf *conf, const char *oldpath,
117 const char *newpath, const char *oldname,
118 const char *newmame);
119
120 bool clone_update_unexp_ovl_paths(struct lxc_conf *conf, const char *oldpath,
121 const char *newpath, const char *oldname,
122 const char *newname, const char *ovldir);
123
124 extern bool network_new_hwaddrs(struct lxc_conf *conf);
125
126 extern int add_elem_to_mount_list(const char *value, struct lxc_conf *lxc_conf);
127
128 #endif /* __LXC_CONFILE_H */