]> git.proxmox.com Git - mirror_lxc.git/blame - src/lxc/confile.h
Merge pull request #3059 from brauner/2019-06-21/seccomp_notify
[mirror_lxc.git] / src / lxc / confile.h
CommitLineData
c2cc9f0a 1/*
2 * lxc: linux Container library
3 *
4 * (C) Copyright IBM Corp. 2007, 2008
5 *
6 * Authors:
9afe19d6 7 * Daniel Lezcano <daniel.lezcano at free.fr>
70c1e708
CB
8 * Serge Hallyn <serge@hallyn.com>
9 * Christian Brauner <christian.brauner@ubuntu.com>
c2cc9f0a 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
250b1eec 23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
c2cc9f0a 24 */
8173e600 25
f1a4a029
ÇO
26#ifndef __LXC_CONFILE_H
27#define __LXC_CONFILE_H
28
861d1ada 29#include <stdbool.h>
8173e600 30#include <stdio.h>
54fc984b 31
f2363e38 32#include <lxc/attach_options.h>
54fc984b 33#include <lxc/lxccontainer.h>
c2cc9f0a 34
00b3c2e2 35struct lxc_conf;
62e46035 36struct lxc_list;
00b3c2e2 37
fe9b7349
CB
38/* Callback prototype to set a configuration item.
39 * Must be implemented when adding a new configuration key.
40 */
3aea1a76
CB
41typedef int (*config_set_cb)(const char *key, const char *value,
42 struct lxc_conf *conf, void *data);
fe9b7349
CB
43
44/* Callback prototype to get a configuration item.
45 * Must be implemented when adding a new configuration key.
46 */
3aea1a76
CB
47typedef int (*config_get_cb)(const char *key, char *value, int inlen,
48 struct lxc_conf *conf, void *data);
fe9b7349
CB
49
50/* Callback prototype to clear a configuration item.
51 * Must be implemented when adding a new configuration key.
52 */
3aea1a76 53typedef int (*config_clr_cb)(const char *key, struct lxc_conf *conf,
c7e27aaf 54 void *data);
01f55c40 55
72d0e1cb
SG
56struct lxc_config_t {
57 char *name;
821a76f1
CB
58 config_set_cb set;
59 config_get_cb get;
6afd673f 60 config_clr_cb clr;
72d0e1cb
SG
61};
62
eb0c9382 63struct new_config_item {
64 char *key;
65 char *val;
66};
67
fe9b7349 68/* Get the jump table entry for the given configuration key. */
300df83e 69extern struct lxc_config_t *lxc_get_config(const char *key);
01f55c40 70
fe9b7349
CB
71/* List all available config items. */
72extern 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 */
78extern int lxc_list_subkeys(struct lxc_conf *conf, const char *key, char *retv,
79 int inlen);
80
01f55c40
CB
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 */
85extern int lxc_list_net(struct lxc_conf *c, const char *key, char *retv,
86 int inlen);
fe9b7349
CB
87
88extern int lxc_config_read(const char *file, struct lxc_conf *conf,
89 bool from_include);
90
6b0d5538 91extern int append_unexp_config_line(const char *line, struct lxc_conf *conf);
c2cc9f0a 92
62e46035 93extern int lxc_config_define_add(struct lxc_list *defines, char* arg);
fe9b7349 94
eb0c9382 95extern bool lxc_config_define_load(struct lxc_list *defines,
96 struct lxc_container *c);
97
98extern void lxc_config_define_free(struct lxc_list *defines);
e16dad10 99
525f0002
CS
100/* needed for lxc-attach */
101extern signed long lxc_config_parse_arch(const char *arch);
fe9b7349 102
eb0c9382 103extern int lxc_fill_elevated_privileges(char *flaglist, int *flags);
104
12a50cc6 105extern int lxc_clear_config_item(struct lxc_conf *c, const char *key);
fe9b7349 106
0e1a60b0 107extern int write_config(int fd, const struct lxc_conf *conf);
6b0d5538 108
fe9b7349
CB
109extern bool do_append_unexp_config_line(struct lxc_conf *conf, const char *key,
110 const char *v);
6b0d5538
SH
111
112/* These are used when cloning a container */
fe9b7349
CB
113extern void clear_unexp_config_line(struct lxc_conf *conf, const char *key,
114 bool rm_subkeys);
115
67702c21 116extern bool clone_update_unexp_hooks(struct lxc_conf *conf, const char *oldpath,
fe9b7349
CB
117 const char *newpath, const char *oldname,
118 const char *newmame);
119
329b3625
CB
120bool 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);
fe9b7349 123
67702c21 124extern bool network_new_hwaddrs(struct lxc_conf *conf);
fe9b7349 125
0d190408
LT
126extern int add_elem_to_mount_list(const char *value, struct lxc_conf *lxc_conf);
127
fe9b7349 128#endif /* __LXC_CONFILE_H */