]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/conf.h
conf.c: change 'instanciate' to 'instantiate'
[mirror_lxc.git] / src / lxc / conf.h
index e88163545bdb5881f17992ca97b7ed854ceaa4b2..563109c5e28824a476b11c324d723fbc09b2447a 100644 (file)
@@ -20,8 +20,8 @@
  * License along with this library; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#ifndef _conf_h
-#define _conf_h
+#ifndef __LXC_CONF_H
+#define __LXC_CONF_H
 
 #include "config.h"
 
 typedef void * scmp_filter_ctx;
 #endif
 
+/* worth moving to configure.ac? */
+#define subuidfile "/etc/subuid"
+#define subgidfile "/etc/subgid"
+
 enum {
        LXC_NET_EMPTY,
        LXC_NET_VETH,
@@ -88,8 +92,8 @@ struct ifla_veth {
 };
 
 struct ifla_vlan {
-       uint   flags;
-       uint   fmask;
+       unsigned int   flags;
+       unsigned int   fmask;
        unsigned short   vid;
        unsigned short   pad;
 };
@@ -180,7 +184,7 @@ struct lxc_pty_info {
 
 /*
  * Defines the number of tty configured and contains the
- * instanciated ptys
+ * instantiated ptys
  * @nbtty = number of configured ttys
  */
 struct lxc_tty_info {
@@ -219,6 +223,7 @@ struct lxc_rootfs {
        char *path;
        char *mount;
        char *pivot;
+       char *options;
 };
 
 /*
@@ -239,9 +244,16 @@ enum {
        LXC_AUTO_CGROUP_FULL_RO       = 0x040,   /* /sys/fs/cgroup (full mount, read-only) */
        LXC_AUTO_CGROUP_FULL_RW       = 0x050,   /* /sys/fs/cgroup (full mount, read-write) */
        LXC_AUTO_CGROUP_FULL_MIXED    = 0x060,   /* /sys/fs/cgroup (full mount, parent r/o, own r/w) */
-       LXC_AUTO_CGROUP_MASK          = 0x070,
-
-       LXC_AUTO_ALL_MASK             = 0x07F,   /* all known settings */
+       /* These are defined in such a way as to retain
+        * binary compatibility with earlier versions of
+        * this code. If the previous mask is applied,
+        * both of these will default back to the _MIXED
+        * variants, which is safe. */
+       LXC_AUTO_CGROUP_NOSPEC        = 0x0B0,   /* /sys/fs/cgroup (partial mount, r/w or mixed, depending on caps) */
+       LXC_AUTO_CGROUP_FULL_NOSPEC   = 0x0E0,   /* /sys/fs/cgroup (full mount, r/w or mixed, depending on caps) */
+       LXC_AUTO_CGROUP_MASK          = 0x0F0,
+
+       LXC_AUTO_ALL_MASK             = 0x0FF,   /* all known settings */
 };
 
 /*
@@ -280,7 +292,7 @@ struct lxc_conf {
        int pts;
        int reboot;
        int need_utmp_watch;
-       int personality;
+       signed long personality;
        struct utsname *utsname;
        struct lxc_list cgroup;
        struct lxc_list id_map;
@@ -299,15 +311,17 @@ struct lxc_conf {
        struct lxc_list hooks[NUM_LXC_HOOKS];
 
        char *lsm_aa_profile;
+       int lsm_aa_allow_incomplete;
        char *lsm_se_context;
-       int lsm_umount_proc;
+       int tmp_umount_proc;
        char *seccomp;  // filename with the seccomp rules
 #if HAVE_SCMP_FILTER_CTX
-       scmp_filter_ctx *seccomp_ctx;
+       scmp_filter_ctx seccomp_ctx;
 #endif
        int maincmd_fd;
        int autodev;  // if 1, mount and fill a /dev at start
-       int stopsignal; // signal used to stop container
+       int haltsignal; // signal used to halt container
+       int stopsignal; // signal used to hard stop container
        int kmsg;  // if 1, create /dev/kmsg symlink
        char *rcfile;   // Copy of the top level rcfile we read
 
@@ -325,6 +339,23 @@ struct lxc_conf {
        int start_delay;
        int start_order;
        struct lxc_list groups;
+       int nbd_idx;
+
+       /* set to true when rootfs has been setup */
+       bool rootfs_setup;
+
+       /* list of included files */
+       struct lxc_list includes;
+       /* config entries which are not "lxc.*" are aliens */
+       struct lxc_list aliens;
+
+       /* list of environment variables we'll add to the container when
+        * started */
+       struct lxc_list environment;
+
+       /* text representation of the config file */
+       char *unexpanded_config;
+       size_t unexpanded_len, unexpanded_alloced;
 };
 
 int run_lxc_hooks(const char *name, char *hook, struct lxc_conf *conf,
@@ -356,25 +387,33 @@ extern int lxc_clear_config_caps(struct lxc_conf *c);
 extern int lxc_clear_config_keepcaps(struct lxc_conf *c);
 extern int lxc_clear_cgroups(struct lxc_conf *c, const char *key);
 extern int lxc_clear_mount_entries(struct lxc_conf *c);
+extern int lxc_clear_automounts(struct lxc_conf *c);
 extern int lxc_clear_hooks(struct lxc_conf *c, const char *key);
 extern int lxc_clear_idmaps(struct lxc_conf *c);
 extern int lxc_clear_groups(struct lxc_conf *c);
+extern int lxc_clear_environment(struct lxc_conf *c);
+extern int lxc_delete_autodev(struct lxc_handler *handler);
+
+extern int do_rootfs_setup(struct lxc_conf *conf, const char *name,
+                          const char *lxcpath);
 
 /*
  * Configure the container from inside
  */
 
 struct cgroup_process_info;
-extern int lxc_setup(const char *name, struct lxc_conf *lxc_conf,
-                       const char *lxcpath,
-                       struct cgroup_process_info *cgroup_info,
-                       void *data);
+extern int lxc_setup(struct lxc_handler *handler);
 
-extern void lxc_rename_phys_nics_on_shutdown(struct lxc_conf *conf);
+extern void lxc_rename_phys_nics_on_shutdown(int netnsfd, struct lxc_conf *conf);
 
-extern int find_unmapped_nsuid(struct lxc_conf *conf);
-extern int mapped_hostid(int id, struct lxc_conf *conf);
+extern int find_unmapped_nsuid(struct lxc_conf *conf, enum idtype idtype);
+extern int mapped_hostid(unsigned id, struct lxc_conf *conf, enum idtype idtype);
 extern int chown_mapped_root(char *path, struct lxc_conf *conf);
 extern int ttys_shift_ids(struct lxc_conf *c);
 extern int userns_exec_1(struct lxc_conf *conf, int (*fn)(void *), void *data);
+extern int parse_mntopts(const char *mntopts, unsigned long *mntflags,
+                        char **mntdata);
+extern void tmp_proc_unmount(struct lxc_conf *lxc_conf);
+void remount_all_slave(void);
+extern void suggest_default_idmap(void);
 #endif