]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/confile.h
2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <daniel.lezcano at free.fr>
8 * Serge Hallyn <serge@hallyn.com>
9 * Christian Brauner <christian.brauner@ubuntu.com>
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.
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.
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
26 #ifndef __LXC_CONFILE_H
27 #define __LXC_CONFILE_H
32 #include <lxc/attach_options.h>
33 #include <lxc/lxccontainer.h>
38 /* Callback prototype to set a configuration item.
39 * Must be implemented when adding a new configuration key.
41 typedef int (*config_set_cb
)(const char *key
, const char *value
,
42 struct lxc_conf
*conf
, void *data
);
44 /* Callback prototype to get a configuration item.
45 * Must be implemented when adding a new configuration key.
47 typedef int (*config_get_cb
)(const char *key
, char *value
, int inlen
,
48 struct lxc_conf
*conf
, void *data
);
50 /* Callback prototype to clear a configuration item.
51 * Must be implemented when adding a new configuration key.
53 typedef int (*config_clr_cb
)(const char *key
, struct lxc_conf
*conf
,
63 struct new_config_item
{
68 /* Get the jump table entry for the given configuration key. */
69 extern struct lxc_config_t
*lxc_get_config(const char *key
);
71 /* List all available config items. */
72 extern int lxc_list_config_items(char *retv
, int inlen
);
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.
78 extern int lxc_list_subkeys(struct lxc_conf
*conf
, const char *key
, char *retv
,
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].
85 extern int lxc_list_net(struct lxc_conf
*c
, const char *key
, char *retv
,
88 extern int lxc_config_read(const char *file
, struct lxc_conf
*conf
,
91 extern int append_unexp_config_line(const char *line
, struct lxc_conf
*conf
);
93 extern int lxc_config_define_add(struct lxc_list
*defines
, char* arg
);
95 extern bool lxc_config_define_load(struct lxc_list
*defines
,
96 struct lxc_container
*c
);
98 extern void lxc_config_define_free(struct lxc_list
*defines
);
100 /* needed for lxc-attach */
101 extern signed long lxc_config_parse_arch(const char *arch
);
103 extern int lxc_fill_elevated_privileges(char *flaglist
, int *flags
);
105 extern int lxc_clear_config_item(struct lxc_conf
*c
, const char *key
);
107 extern int write_config(int fd
, const struct lxc_conf
*conf
);
109 extern bool do_append_unexp_config_line(struct lxc_conf
*conf
, const char *key
,
112 /* These are used when cloning a container */
113 extern void clear_unexp_config_line(struct lxc_conf
*conf
, const char *key
,
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
);
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
);
124 extern bool network_new_hwaddrs(struct lxc_conf
*conf
);
126 extern int add_elem_to_mount_list(const char *value
, struct lxc_conf
*lxc_conf
);
128 #endif /* __LXC_CONFILE_H */