]>
git.proxmox.com Git - mirror_lxc.git/blob - src/lxc/conf.h
2 * lxc: linux Container library
4 * (C) Copyright IBM Corp. 2007, 2008
7 * Daniel Lezcano <dlezcano at fr.ibm.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include <netinet/in.h>
27 #include <sys/param.h>
38 * Defines the structure to configure an ipv4 address
39 * @address : ipv4 address
40 * @broadcast : ipv4 broadcast address
41 * @mask : network mask
54 * Defines the structure to configure an ipv6 address
55 * @flags : set the address up
56 * @address : ipv6 address
57 * @broadcast : ipv6 broadcast address
58 * @mask : network mask
62 struct in6_addr bcast
;
63 struct in6_addr acast
;
71 * Defines a structure to configure a network device
72 * @ifname : network device name
73 * @flags : flag of the network device (IFF_UP, ... )
74 * @ipv4 : a list of ipv4 addresses to be set on the network device
75 * @ipv6 : a list of ipv6 addresses to be set on the network device
90 * Defines a generic struct to configure the control group.
91 * It is up to the programmer to specify the right subsystem.
92 * @subsystem : the targetted subsystem
93 * @value : the value to set
101 * Defines a structure containing a pty information for
103 * @name : the path name of the slave pty side
104 * @master : the file descriptor of the master
105 * @slave : the file descriptor of the slave
107 struct lxc_pty_info
{
108 char name
[MAXPATHLEN
];
115 * Defines the number of tty configured and contains the
117 * @nbtty = number of configured ttys
119 struct lxc_tty_info
{
121 struct lxc_pty_info
*pty_info
;
125 * Defines the global container configuration
126 * @rootfs : the root directory to run the container
127 * @mount : the list of mount points
128 * @network : the network configuration
129 * @utsname : the container utsname
136 struct utsname
*utsname
;
137 struct lxc_list cgroup
;
138 struct lxc_list network
;
139 struct lxc_tty_info tty_info
;
140 char console
[MAXPATHLEN
];
144 * Initialize the lxc configuration structure
146 extern int lxc_conf_init(struct lxc_conf
*conf
);
149 * Remove the resources created by the configuration
151 extern int lxc_unconfigure(const char *name
);
153 extern int lxc_create_network(struct lxc_list
*networks
);
154 extern int lxc_assign_network(struct lxc_list
*networks
, pid_t pid
);
156 extern int lxc_create_tty(const char *name
, struct lxc_conf
*conf
);
157 extern void lxc_delete_tty(struct lxc_tty_info
*tty_info
);
160 * Configure the container from inside
165 extern int lxc_setup(const char *name
, struct lxc_conf
*lxc_conf
);
167 extern int conf_has(const char *name
, const char *info
);
169 #define conf_has_fstab(__name) conf_has(__name, "fstab")
170 #define conf_has_rootfs(__name) conf_has(__name, "rootfs")
171 #define conf_has_utsname(__name) conf_has(__name, "utsname")
172 #define conf_has_network(__name) conf_has(__name, "network")
173 #define conf_has_console(__name) conf_has(__name, "console")
174 #define conf_has_cgroup(__name) conf_has(__name, "cgroup")
175 #define conf_has_tty(__name) conf_has(__name, "tty")
176 #define conf_has_pts(__name) conf_has(__name, "pts")