network: add data arg to set callback

parent 663e9916
...@@ -64,198 +64,269 @@ ...@@ -64,198 +64,269 @@
lxc_log_define(lxc_confile, lxc); lxc_log_define(lxc_confile, lxc);
static int set_config_personality(const char *, const char *, struct lxc_conf *); static int set_config_personality(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_personality(const char *, char *, int, struct lxc_conf *); static int get_config_personality(const char *, char *, int, struct lxc_conf *);
static int clr_config_personality(const char *, struct lxc_conf *); static int clr_config_personality(const char *, struct lxc_conf *);
static int set_config_pts(const char *, const char *, struct lxc_conf *); static int set_config_pts(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_pts(const char *, char *, int, struct lxc_conf *); static int get_config_pts(const char *, char *, int, struct lxc_conf *);
static int clr_config_pts(const char *, struct lxc_conf *); static int clr_config_pts(const char *, struct lxc_conf *);
static int set_config_tty(const char *, const char *, struct lxc_conf *); static int set_config_tty(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_tty(const char *, char *, int, struct lxc_conf *); static int get_config_tty(const char *, char *, int, struct lxc_conf *);
static int clr_config_tty(const char *, struct lxc_conf *); static int clr_config_tty(const char *, struct lxc_conf *);
static int set_config_ttydir(const char *, const char *, struct lxc_conf *); static int set_config_ttydir(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_ttydir(const char *, char *, int, struct lxc_conf *); static int get_config_ttydir(const char *, char *, int, struct lxc_conf *);
static int clr_config_ttydir(const char *, struct lxc_conf *); static int clr_config_ttydir(const char *, struct lxc_conf *);
static int set_config_kmsg(const char *, const char *, struct lxc_conf *); static int set_config_kmsg(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_kmsg(const char *, char *, int, struct lxc_conf *); static int get_config_kmsg(const char *, char *, int, struct lxc_conf *);
static int clr_config_kmsg(const char *, struct lxc_conf *); static int clr_config_kmsg(const char *, struct lxc_conf *);
static int set_config_lsm_aa_profile(const char *, const char *, struct lxc_conf *); static int set_config_lsm_aa_profile(const char *, const char *,
static int get_config_lsm_aa_profile(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_lsm_aa_profile(const char *, char *, int,
struct lxc_conf *);
static int clr_config_lsm_aa_profile(const char *, struct lxc_conf *); static int clr_config_lsm_aa_profile(const char *, struct lxc_conf *);
static int set_config_lsm_aa_incomplete(const char *, const char *, struct lxc_conf *); static int set_config_lsm_aa_incomplete(const char *, const char *,
static int get_config_lsm_aa_incomplete(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_lsm_aa_incomplete(const char *, char *, int,
struct lxc_conf *);
static int clr_config_lsm_aa_incomplete(const char *, struct lxc_conf *); static int clr_config_lsm_aa_incomplete(const char *, struct lxc_conf *);
static int set_config_lsm_se_context(const char *, const char *, struct lxc_conf *); static int set_config_lsm_se_context(const char *, const char *,
static int get_config_lsm_se_context(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_lsm_se_context(const char *, char *, int,
struct lxc_conf *);
static int clr_config_lsm_se_context(const char *, struct lxc_conf *); static int clr_config_lsm_se_context(const char *, struct lxc_conf *);
static int set_config_cgroup(const char *, const char *, struct lxc_conf *); static int set_config_cgroup(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_cgroup(const char *, char *, int, struct lxc_conf *); static int get_config_cgroup(const char *, char *, int, struct lxc_conf *);
static int clr_config_cgroup(const char *, struct lxc_conf *); static int clr_config_cgroup(const char *, struct lxc_conf *);
static int set_config_idmaps(const char *, const char *, struct lxc_conf *); static int set_config_idmaps(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_idmaps(const char *, char *, int, struct lxc_conf *); static int get_config_idmaps(const char *, char *, int, struct lxc_conf *);
static int clr_config_idmaps(const char *, struct lxc_conf *); static int clr_config_idmaps(const char *, struct lxc_conf *);
static int set_config_loglevel(const char *, const char *, struct lxc_conf *); static int set_config_loglevel(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_loglevel(const char *, char *, int, struct lxc_conf *); static int get_config_loglevel(const char *, char *, int, struct lxc_conf *);
static int clr_config_loglevel(const char *, struct lxc_conf *); static int clr_config_loglevel(const char *, struct lxc_conf *);
static int set_config_logfile(const char *, const char *, struct lxc_conf *); static int set_config_logfile(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_logfile(const char *, char *, int, struct lxc_conf *); static int get_config_logfile(const char *, char *, int, struct lxc_conf *);
static int clr_config_logfile(const char *, struct lxc_conf *); static int clr_config_logfile(const char *, struct lxc_conf *);
static int set_config_mount(const char *, const char *, struct lxc_conf *); static int set_config_mount(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_mount(const char *, char *, int, struct lxc_conf *); static int get_config_mount(const char *, char *, int, struct lxc_conf *);
static int clr_config_mount(const char *, struct lxc_conf *); static int clr_config_mount(const char *, struct lxc_conf *);
static int set_config_mount_auto(const char *, const char *, struct lxc_conf *); static int set_config_mount_auto(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_mount_auto(const char *, char *, int, struct lxc_conf *); static int get_config_mount_auto(const char *, char *, int, struct lxc_conf *);
static int clr_config_mount_auto(const char *, struct lxc_conf *); static int clr_config_mount_auto(const char *, struct lxc_conf *);
static int set_config_fstab(const char *, const char *, struct lxc_conf *); static int set_config_fstab(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_fstab(const char *, char *, int, struct lxc_conf *); static int get_config_fstab(const char *, char *, int, struct lxc_conf *);
static int clr_config_fstab(const char *, struct lxc_conf *); static int clr_config_fstab(const char *, struct lxc_conf *);
static int set_config_rootfs_mount(const char *, const char *, struct lxc_conf *); static int set_config_rootfs_mount(const char *, const char *,
static int get_config_rootfs_mount(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_rootfs_mount(const char *, char *, int,
struct lxc_conf *);
static int clr_config_rootfs_mount(const char *, struct lxc_conf *); static int clr_config_rootfs_mount(const char *, struct lxc_conf *);
static int set_config_rootfs_options(const char *, const char *, struct lxc_conf *); static int set_config_rootfs_options(const char *, const char *,
static int get_config_rootfs_options(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_rootfs_options(const char *, char *, int,
struct lxc_conf *);
static int clr_config_rootfs_options(const char *, struct lxc_conf *); static int clr_config_rootfs_options(const char *, struct lxc_conf *);
static int set_config_rootfs_backend(const char *, const char *, struct lxc_conf *); static int set_config_rootfs_backend(const char *, const char *,
static int get_config_rootfs_backend(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_rootfs_backend(const char *, char *, int,
struct lxc_conf *);
static int clr_config_rootfs_backend(const char *, struct lxc_conf *); static int clr_config_rootfs_backend(const char *, struct lxc_conf *);
static int set_config_rootfs(const char *, const char *, struct lxc_conf *); static int set_config_rootfs(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_rootfs(const char *, char *, int, struct lxc_conf *); static int get_config_rootfs(const char *, char *, int, struct lxc_conf *);
static int clr_config_rootfs(const char *, struct lxc_conf *); static int clr_config_rootfs(const char *, struct lxc_conf *);
static int set_config_pivotdir(const char *, const char *, struct lxc_conf *); static int set_config_pivotdir(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_pivotdir(const char *, char *, int, struct lxc_conf *); static int get_config_pivotdir(const char *, char *, int, struct lxc_conf *);
static int clr_config_pivotdir(const char *, struct lxc_conf *); static int clr_config_pivotdir(const char *, struct lxc_conf *);
static int set_config_utsname(const char *, const char *, struct lxc_conf *); static int set_config_utsname(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_utsname(const char *, char *, int, struct lxc_conf *); static int get_config_utsname(const char *, char *, int, struct lxc_conf *);
static int clr_config_utsname(const char *, struct lxc_conf *); static int clr_config_utsname(const char *, struct lxc_conf *);
static int set_config_hooks(const char *, const char *, struct lxc_conf *lxc_conf); static int set_config_hooks(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_hooks(const char *, char *, int, struct lxc_conf *); static int get_config_hooks(const char *, char *, int, struct lxc_conf *);
static int clr_config_hooks(const char *, struct lxc_conf *); static int clr_config_hooks(const char *, struct lxc_conf *);
static int set_config_network_type(const char *, const char *, struct lxc_conf *); static int set_config_network_type(const char *, const char *,
static int set_config_network_flags(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int set_config_network_link(const char *, const char *, struct lxc_conf *); static int set_config_network_flags(const char *, const char *,
static int set_config_network_name(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int set_config_network_veth_pair(const char *, const char *, struct lxc_conf *); static int set_config_network_link(const char *, const char *,
static int set_config_network_macvlan_mode(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int set_config_network_hwaddr(const char *, const char *, struct lxc_conf *); static int set_config_network_name(const char *, const char *,
static int set_config_network_vlan_id(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int set_config_network_mtu(const char *, const char *, struct lxc_conf *); static int set_config_network_veth_pair(const char *, const char *,
static int set_config_network_ipv4(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int set_config_network_ipv4_gateway(const char *, const char *, struct lxc_conf *); static int set_config_network_macvlan_mode(const char *, const char *,
static int set_config_network_script_up(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int set_config_network_script_down(const char *, const char *, struct lxc_conf *); static int set_config_network_hwaddr(const char *, const char *,
static int set_config_network_ipv6(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int set_config_network_ipv6_gateway(const char *, const char *, struct lxc_conf *); static int set_config_network_vlan_id(const char *, const char *,
static int set_config_network_nic(const char *, const char *, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_network_item(const char *, char *, int, struct lxc_conf *); static int set_config_network_mtu(const char *, const char *, struct lxc_conf *,
void *);
static int set_config_network_ipv4(const char *, const char *,
struct lxc_conf *, void *);
static int set_config_network_ipv4_gateway(const char *, const char *,
struct lxc_conf *, void *);
static int set_config_network_script_up(const char *, const char *,
struct lxc_conf *, void *);
static int set_config_network_script_down(const char *, const char *,
struct lxc_conf *, void *);
static int set_config_network_ipv6(const char *, const char *,
struct lxc_conf *, void *);
static int set_config_network_ipv6_gateway(const char *, const char *,
struct lxc_conf *, void *);
static int set_config_network_nic(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_network_item(const char *, char *, int,
struct lxc_conf *);
static int clr_config_network_item(const char *, struct lxc_conf *); static int clr_config_network_item(const char *, struct lxc_conf *);
static int set_config_network(const char *, const char *, struct lxc_conf *); static int set_config_network(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_network(const char *, char *, int, struct lxc_conf *); static int get_config_network(const char *, char *, int, struct lxc_conf *);
static int clr_config_network(const char *, struct lxc_conf *); static int clr_config_network(const char *, struct lxc_conf *);
static int set_config_cap_drop(const char *, const char *, struct lxc_conf *); static int set_config_cap_drop(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_cap_drop(const char *, char *, int, struct lxc_conf *); static int get_config_cap_drop(const char *, char *, int, struct lxc_conf *);
static int clr_config_cap_drop(const char *, struct lxc_conf *); static int clr_config_cap_drop(const char *, struct lxc_conf *);
static int set_config_cap_keep(const char *, const char *, struct lxc_conf *); static int set_config_cap_keep(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_cap_keep(const char *, char *, int, struct lxc_conf *); static int get_config_cap_keep(const char *, char *, int, struct lxc_conf *);
static int clr_config_cap_keep(const char *, struct lxc_conf *); static int clr_config_cap_keep(const char *, struct lxc_conf *);
static int set_config_console_logfile(const char *, const char *, struct lxc_conf *); static int set_config_console_logfile(const char *, const char *,
static int get_config_console_logfile(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_console_logfile(const char *, char *, int,
struct lxc_conf *);
static int clr_config_console_logfile(const char *, struct lxc_conf *); static int clr_config_console_logfile(const char *, struct lxc_conf *);
static int set_config_console(const char *, const char *, struct lxc_conf *); static int set_config_console(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_console(const char *, char *, int, struct lxc_conf *); static int get_config_console(const char *, char *, int, struct lxc_conf *);
static int clr_config_console(const char *, struct lxc_conf *); static int clr_config_console(const char *, struct lxc_conf *);
static int set_config_seccomp(const char *, const char *, struct lxc_conf *); static int set_config_seccomp(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_seccomp(const char *, char *, int, struct lxc_conf *); static int get_config_seccomp(const char *, char *, int, struct lxc_conf *);
static int clr_config_seccomp(const char *, struct lxc_conf *); static int clr_config_seccomp(const char *, struct lxc_conf *);
static int set_config_includefiles(const char *, const char *, struct lxc_conf *); static int set_config_includefiles(const char *, const char *,
static int get_config_includefiles(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_includefiles(const char *, char *, int,
struct lxc_conf *);
static int clr_config_includefiles(const char *, struct lxc_conf *); static int clr_config_includefiles(const char *, struct lxc_conf *);
static int set_config_autodev(const char *, const char *, struct lxc_conf *); static int set_config_autodev(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_autodev(const char *, char *, int, struct lxc_conf *); static int get_config_autodev(const char *, char *, int, struct lxc_conf *);
static int clr_config_autodev(const char *, struct lxc_conf *); static int clr_config_autodev(const char *, struct lxc_conf *);
static int set_config_haltsignal(const char *, const char *, struct lxc_conf *); static int set_config_haltsignal(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_haltsignal(const char *, char *, int, struct lxc_conf *); static int get_config_haltsignal(const char *, char *, int, struct lxc_conf *);
static int clr_config_haltsignal(const char *, struct lxc_conf *); static int clr_config_haltsignal(const char *, struct lxc_conf *);
static int set_config_rebootsignal(const char *, const char *, struct lxc_conf *); static int set_config_rebootsignal(const char *, const char *,
static int get_config_rebootsignal(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_rebootsignal(const char *, char *, int,
struct lxc_conf *);
static int clr_config_rebootsignal(const char *, struct lxc_conf *); static int clr_config_rebootsignal(const char *, struct lxc_conf *);
static int set_config_stopsignal(const char *, const char *, struct lxc_conf *); static int set_config_stopsignal(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_stopsignal(const char *, char *, int, struct lxc_conf *); static int get_config_stopsignal(const char *, char *, int, struct lxc_conf *);
static int clr_config_stopsignal(const char *, struct lxc_conf *); static int clr_config_stopsignal(const char *, struct lxc_conf *);
static int set_config_start(const char *, const char *, struct lxc_conf *); static int set_config_start(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_start(const char *, char *, int, struct lxc_conf *); static int get_config_start(const char *, char *, int, struct lxc_conf *);
static int clr_config_start(const char *, struct lxc_conf *); static int clr_config_start(const char *, struct lxc_conf *);
static int set_config_monitor(const char *, const char *, struct lxc_conf *); static int set_config_monitor(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_monitor(const char *, char *, int, struct lxc_conf *); static int get_config_monitor(const char *, char *, int, struct lxc_conf *);
static int clr_config_monitor(const char *, struct lxc_conf *); static int clr_config_monitor(const char *, struct lxc_conf *);
static int set_config_group(const char *, const char *, struct lxc_conf *); static int set_config_group(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_group(const char *, char *, int, struct lxc_conf *); static int get_config_group(const char *, char *, int, struct lxc_conf *);
static int clr_config_group(const char *, struct lxc_conf *); static int clr_config_group(const char *, struct lxc_conf *);
static int set_config_environment(const char *, const char *, struct lxc_conf *); static int set_config_environment(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_environment(const char *, char *, int, struct lxc_conf *); static int get_config_environment(const char *, char *, int, struct lxc_conf *);
static int clr_config_environment(const char *, struct lxc_conf *); static int clr_config_environment(const char *, struct lxc_conf *);
static int set_config_init_cmd(const char *, const char *, struct lxc_conf *); static int set_config_init_cmd(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_init_cmd(const char *, char *, int, struct lxc_conf *); static int get_config_init_cmd(const char *, char *, int, struct lxc_conf *);
static int clr_config_init_cmd(const char *, struct lxc_conf *); static int clr_config_init_cmd(const char *, struct lxc_conf *);
static int set_config_init_uid(const char *, const char *, struct lxc_conf *); static int set_config_init_uid(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_init_uid(const char *, char *, int, struct lxc_conf *); static int get_config_init_uid(const char *, char *, int, struct lxc_conf *);
static int clr_config_init_uid(const char *, struct lxc_conf *); static int clr_config_init_uid(const char *, struct lxc_conf *);
static int set_config_init_gid(const char *, const char *, struct lxc_conf *); static int set_config_init_gid(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_init_gid(const char *, char *, int, struct lxc_conf *); static int get_config_init_gid(const char *, char *, int, struct lxc_conf *);
static int clr_config_init_gid(const char *, struct lxc_conf *); static int clr_config_init_gid(const char *, struct lxc_conf *);
static int set_config_ephemeral(const char *, const char *, struct lxc_conf *); static int set_config_ephemeral(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_ephemeral(const char *, char *, int, struct lxc_conf *); static int get_config_ephemeral(const char *, char *, int, struct lxc_conf *);
static int clr_config_ephemeral(const char *, struct lxc_conf *); static int clr_config_ephemeral(const char *, struct lxc_conf *);
static int set_config_syslog(const char *, const char *, struct lxc_conf *); static int set_config_syslog(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_syslog(const char *, char *, int, struct lxc_conf *); static int get_config_syslog(const char *, char *, int, struct lxc_conf *);
static int clr_config_syslog(const char *, struct lxc_conf *); static int clr_config_syslog(const char *, struct lxc_conf *);
static int set_config_no_new_privs(const char *, const char *, struct lxc_conf *); static int set_config_no_new_privs(const char *, const char *,
static int get_config_no_new_privs(const char *, char *, int, struct lxc_conf *); struct lxc_conf *, void *);
static int get_config_no_new_privs(const char *, char *, int,
struct lxc_conf *);
static int clr_config_no_new_privs(const char *, struct lxc_conf *); static int clr_config_no_new_privs(const char *, struct lxc_conf *);
static int set_config_limit(const char *, const char *, struct lxc_conf *); static int set_config_limit(const char *, const char *, struct lxc_conf *,
void *);
static int get_config_limit(const char *, char *, int, struct lxc_conf *); static int get_config_limit(const char *, char *, int, struct lxc_conf *);
static int clr_config_limit(const char *, struct lxc_conf *); static int clr_config_limit(const char *, struct lxc_conf *);
...@@ -510,7 +581,7 @@ static int set_config_path_item(char **conf_item, const char *value) ...@@ -510,7 +581,7 @@ static int set_config_path_item(char **conf_item, const char *value)
* (by rewriting the key), and call it. * (by rewriting the key), and call it.
*/ */
static int set_config_network_nic(const char *key, const char *value, static int set_config_network_nic(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *copy = strdup(key), *p; char *copy = strdup(key), *p;
int ret = -1; int ret = -1;
...@@ -539,7 +610,7 @@ static int set_config_network_nic(const char *key, const char *value, ...@@ -539,7 +610,7 @@ static int set_config_network_nic(const char *key, const char *value,
ERROR("unknown key %s", key); ERROR("unknown key %s", key);
goto out; goto out;
} }
ret = config->set(key, value, lxc_conf); ret = config->set(key, value, lxc_conf, data);
out: out:
free(copy); free(copy);
...@@ -547,7 +618,7 @@ out: ...@@ -547,7 +618,7 @@ out:
} }
static int set_config_network(const char *key, const char *value, static int set_config_network(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
if (!lxc_config_value_empty(value)) { if (!lxc_config_value_empty(value)) {
ERROR("lxc.network must not have a value"); ERROR("lxc.network must not have a value");
...@@ -560,7 +631,7 @@ static int set_config_network(const char *key, const char *value, ...@@ -560,7 +631,7 @@ static int set_config_network(const char *key, const char *value,
static int macvlan_mode(int *valuep, const char *value); static int macvlan_mode(int *valuep, const char *value);
static int set_config_network_type(const char *key, const char *value, static int set_config_network_type(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_list *network = &lxc_conf->network; struct lxc_list *network = &lxc_conf->network;
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -819,7 +890,7 @@ static int rand_complete_hwaddr(char *hwaddr) ...@@ -819,7 +890,7 @@ static int rand_complete_hwaddr(char *hwaddr)
} }
static int set_config_network_flags(const char *key, const char *value, static int set_config_network_flags(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -833,7 +904,7 @@ static int set_config_network_flags(const char *key, const char *value, ...@@ -833,7 +904,7 @@ static int set_config_network_flags(const char *key, const char *value,
} }
static int set_network_link(const char *key, const char *value, static int set_network_link(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -866,10 +937,10 @@ static int create_matched_ifnames(const char *value, struct lxc_conf *lxc_conf) ...@@ -866,10 +937,10 @@ static int create_matched_ifnames(const char *value, struct lxc_conf *lxc_conf)
if (!strncmp(value, ifa->ifa_name, strlen(value) - 1)) { if (!strncmp(value, ifa->ifa_name, strlen(value) - 1)) {
ret = set_config_network_type(type_key, tmpvalue, ret = set_config_network_type(type_key, tmpvalue,
lxc_conf); lxc_conf, NULL);
if (!ret) { if (!ret) {
ret = set_network_link(link_key, ifa->ifa_name, ret = set_network_link(link_key, ifa->ifa_name,
lxc_conf); lxc_conf, NULL);
if (ret) { if (ret) {
ERROR("failed to create matched ifnames"); ERROR("failed to create matched ifnames");
break; break;
...@@ -888,7 +959,7 @@ static int create_matched_ifnames(const char *value, struct lxc_conf *lxc_conf) ...@@ -888,7 +959,7 @@ static int create_matched_ifnames(const char *value, struct lxc_conf *lxc_conf)
} }
static int set_config_network_link(const char *key, const char *value, static int set_config_network_link(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
struct lxc_list *it; struct lxc_list *it;
...@@ -918,7 +989,7 @@ static int set_config_network_link(const char *key, const char *value, ...@@ -918,7 +989,7 @@ static int set_config_network_link(const char *key, const char *value,
} }
static int set_config_network_name(const char *key, const char *value, static int set_config_network_name(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -930,7 +1001,7 @@ static int set_config_network_name(const char *key, const char *value, ...@@ -930,7 +1001,7 @@ static int set_config_network_name(const char *key, const char *value,
} }
static int set_config_network_veth_pair(const char *key, const char *value, static int set_config_network_veth_pair(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -947,7 +1018,8 @@ static int set_config_network_veth_pair(const char *key, const char *value, ...@@ -947,7 +1018,8 @@ static int set_config_network_veth_pair(const char *key, const char *value,
} }
static int set_config_network_macvlan_mode(const char *key, const char *value, static int set_config_network_macvlan_mode(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf,
void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -964,7 +1036,7 @@ static int set_config_network_macvlan_mode(const char *key, const char *value, ...@@ -964,7 +1036,7 @@ static int set_config_network_macvlan_mode(const char *key, const char *value,
} }
static int set_config_network_hwaddr(const char *key, const char *value, static int set_config_network_hwaddr(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
char *new_value; char *new_value;
...@@ -993,7 +1065,7 @@ static int set_config_network_hwaddr(const char *key, const char *value, ...@@ -993,7 +1065,7 @@ static int set_config_network_hwaddr(const char *key, const char *value,
} }
static int set_config_network_vlan_id(const char *key, const char *value, static int set_config_network_vlan_id(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -1013,7 +1085,7 @@ static int set_config_network_vlan_id(const char *key, const char *value, ...@@ -1013,7 +1085,7 @@ static int set_config_network_vlan_id(const char *key, const char *value,
} }
static int set_config_network_mtu(const char *key, const char *value, static int set_config_network_mtu(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -1025,7 +1097,7 @@ static int set_config_network_mtu(const char *key, const char *value, ...@@ -1025,7 +1097,7 @@ static int set_config_network_mtu(const char *key, const char *value,
} }
static int set_config_network_ipv4(const char *key, const char *value, static int set_config_network_ipv4(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
struct lxc_inetdev *inetdev; struct lxc_inetdev *inetdev;
...@@ -1117,7 +1189,8 @@ static int set_config_network_ipv4(const char *key, const char *value, ...@@ -1117,7 +1189,8 @@ static int set_config_network_ipv4(const char *key, const char *value,
} }
static int set_config_network_ipv4_gateway(const char *key, const char *value, static int set_config_network_ipv4_gateway(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf,
void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -1155,7 +1228,7 @@ static int set_config_network_ipv4_gateway(const char *key, const char *value, ...@@ -1155,7 +1228,7 @@ static int set_config_network_ipv4_gateway(const char *key, const char *value,
} }
static int set_config_network_ipv6(const char *key, const char *value, static int set_config_network_ipv6(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
struct lxc_inet6dev *inet6dev; struct lxc_inet6dev *inet6dev;
...@@ -1218,7 +1291,8 @@ static int set_config_network_ipv6(const char *key, const char *value, ...@@ -1218,7 +1291,8 @@ static int set_config_network_ipv6(const char *key, const char *value,
} }
static int set_config_network_ipv6_gateway(const char *key, const char *value, static int set_config_network_ipv6_gateway(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf,
void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -1256,7 +1330,7 @@ static int set_config_network_ipv6_gateway(const char *key, const char *value, ...@@ -1256,7 +1330,7 @@ static int set_config_network_ipv6_gateway(const char *key, const char *value,
} }
static int set_config_network_script_up(const char *key, const char *value, static int set_config_network_script_up(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -1268,7 +1342,7 @@ static int set_config_network_script_up(const char *key, const char *value, ...@@ -1268,7 +1342,7 @@ static int set_config_network_script_up(const char *key, const char *value,
} }
static int set_config_network_script_down(const char *key, const char *value, static int set_config_network_script_down(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_netdev *netdev; struct lxc_netdev *netdev;
...@@ -1295,19 +1369,19 @@ static int add_hook(struct lxc_conf *lxc_conf, int which, char *hook) ...@@ -1295,19 +1369,19 @@ static int add_hook(struct lxc_conf *lxc_conf, int which, char *hook)
} }
static int set_config_seccomp(const char *key, const char *value, static int set_config_seccomp(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_path_item(&lxc_conf->seccomp, value); return set_config_path_item(&lxc_conf->seccomp, value);
} }
static int set_config_init_cmd(const char *key, const char *value, static int set_config_init_cmd(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_path_item(&lxc_conf->init_cmd, value); return set_config_path_item(&lxc_conf->init_cmd, value);
} }
static int set_config_init_uid(const char *key, const char *value, static int set_config_init_uid(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
unsigned int init_uid; unsigned int init_uid;
...@@ -1326,7 +1400,7 @@ static int set_config_init_uid(const char *key, const char *value, ...@@ -1326,7 +1400,7 @@ static int set_config_init_uid(const char *key, const char *value,
} }
static int set_config_init_gid(const char *key, const char *value, static int set_config_init_gid(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
unsigned int init_gid; unsigned int init_gid;
...@@ -1345,7 +1419,7 @@ static int set_config_init_gid(const char *key, const char *value, ...@@ -1345,7 +1419,7 @@ static int set_config_init_gid(const char *key, const char *value,
} }
static int set_config_hooks(const char *key, const char *value, static int set_config_hooks(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *copy; char *copy;
...@@ -1387,7 +1461,7 @@ static int set_config_hooks(const char *key, const char *value, ...@@ -1387,7 +1461,7 @@ static int set_config_hooks(const char *key, const char *value,
} }
static int set_config_personality(const char *key, const char *value, static int set_config_personality(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
signed long personality = lxc_config_parse_arch(value); signed long personality = lxc_config_parse_arch(value);
...@@ -1400,7 +1474,7 @@ static int set_config_personality(const char *key, const char *value, ...@@ -1400,7 +1474,7 @@ static int set_config_personality(const char *key, const char *value,
} }
static int set_config_pts(const char *key, const char *value, static int set_config_pts(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -1421,7 +1495,7 @@ static int set_config_pts(const char *key, const char *value, ...@@ -1421,7 +1495,7 @@ static int set_config_pts(const char *key, const char *value,
* noticed when the callback was called. * noticed when the callback was called.
*/ */
static int set_config_start(const char *key, const char *value, static int set_config_start(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
bool is_empty; bool is_empty;
...@@ -1467,7 +1541,7 @@ static int set_config_start(const char *key, const char *value, ...@@ -1467,7 +1541,7 @@ static int set_config_start(const char *key, const char *value,
} }
static int set_config_monitor(const char *key, const char *value, static int set_config_monitor(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -1484,7 +1558,7 @@ static int set_config_monitor(const char *key, const char *value, ...@@ -1484,7 +1558,7 @@ static int set_config_monitor(const char *key, const char *value,
} }
static int set_config_group(const char *key, const char *value, static int set_config_group(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *groups, *groupptr, *sptr, *token; char *groups, *groupptr, *sptr, *token;
struct lxc_list *grouplist; struct lxc_list *grouplist;
...@@ -1530,7 +1604,7 @@ static int set_config_group(const char *key, const char *value, ...@@ -1530,7 +1604,7 @@ static int set_config_group(const char *key, const char *value,
} }
static int set_config_environment(const char *key, const char *value, static int set_config_environment(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_list *list_item = NULL; struct lxc_list *list_item = NULL;
...@@ -1556,7 +1630,7 @@ on_error: ...@@ -1556,7 +1630,7 @@ on_error:
} }
static int set_config_tty(const char *key, const char *value, static int set_config_tty(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -1569,14 +1643,14 @@ static int set_config_tty(const char *key, const char *value, ...@@ -1569,14 +1643,14 @@ static int set_config_tty(const char *key, const char *value,
} }
static int set_config_ttydir(const char *key, const char *value, static int set_config_ttydir(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_string_item_max(&lxc_conf->ttydir, value, return set_config_string_item_max(&lxc_conf->ttydir, value,
NAME_MAX + 1); NAME_MAX + 1);
} }
static int set_config_kmsg(const char *key, const char *value, static int set_config_kmsg(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -1595,13 +1669,13 @@ static int set_config_kmsg(const char *key, const char *value, ...@@ -1595,13 +1669,13 @@ static int set_config_kmsg(const char *key, const char *value,
} }
static int set_config_lsm_aa_profile(const char *key, const char *value, static int set_config_lsm_aa_profile(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_string_item(&lxc_conf->lsm_aa_profile, value); return set_config_string_item(&lxc_conf->lsm_aa_profile, value);
} }
static int set_config_lsm_aa_incomplete(const char *key, const char *value, static int set_config_lsm_aa_incomplete(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -1623,13 +1697,13 @@ static int set_config_lsm_aa_incomplete(const char *key, const char *value, ...@@ -1623,13 +1697,13 @@ static int set_config_lsm_aa_incomplete(const char *key, const char *value,
} }
static int set_config_lsm_se_context(const char *key, const char *value, static int set_config_lsm_se_context(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_string_item(&lxc_conf->lsm_se_context, value); return set_config_string_item(&lxc_conf->lsm_se_context, value);
} }
static int set_config_logfile(const char *key, const char *value, static int set_config_logfile(const char *key, const char *value,
struct lxc_conf *c) struct lxc_conf *c, void *data)
{ {
int ret; int ret;
...@@ -1649,7 +1723,7 @@ static int set_config_logfile(const char *key, const char *value, ...@@ -1649,7 +1723,7 @@ static int set_config_logfile(const char *key, const char *value,
} }
static int set_config_loglevel(const char *key, const char *value, static int set_config_loglevel(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
int newlevel; int newlevel;
...@@ -1675,7 +1749,7 @@ static int set_config_loglevel(const char *key, const char *value, ...@@ -1675,7 +1749,7 @@ static int set_config_loglevel(const char *key, const char *value,
} }
static int set_config_autodev(const char *key, const char *value, static int set_config_autodev(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -1745,7 +1819,7 @@ static int sig_parse(const char *signame) ...@@ -1745,7 +1819,7 @@ static int sig_parse(const char *signame)
} }
static int set_config_haltsignal(const char *key, const char *value, static int set_config_haltsignal(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
int sig_n; int sig_n;
...@@ -1766,7 +1840,7 @@ static int set_config_haltsignal(const char *key, const char *value, ...@@ -1766,7 +1840,7 @@ static int set_config_haltsignal(const char *key, const char *value,
} }
static int set_config_rebootsignal(const char *key, const char *value, static int set_config_rebootsignal(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
int sig_n; int sig_n;
...@@ -1786,7 +1860,7 @@ static int set_config_rebootsignal(const char *key, const char *value, ...@@ -1786,7 +1860,7 @@ static int set_config_rebootsignal(const char *key, const char *value,
} }
static int set_config_stopsignal(const char *key, const char *value, static int set_config_stopsignal(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
int sig_n; int sig_n;
...@@ -1806,7 +1880,7 @@ static int set_config_stopsignal(const char *key, const char *value, ...@@ -1806,7 +1880,7 @@ static int set_config_stopsignal(const char *key, const char *value,
} }
static int set_config_cgroup(const char *key, const char *value, static int set_config_cgroup(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *subkey; char *subkey;
char *token = "lxc.cgroup."; char *token = "lxc.cgroup.";
...@@ -1883,7 +1957,7 @@ static bool parse_limit_value(const char **value, unsigned long *res) ...@@ -1883,7 +1957,7 @@ static bool parse_limit_value(const char **value, unsigned long *res)
} }
static int set_config_limit(const char *key, const char *value, static int set_config_limit(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct lxc_list *iter; struct lxc_list *iter;
struct rlimit limit; struct rlimit limit;
...@@ -1974,7 +2048,7 @@ out: ...@@ -1974,7 +2048,7 @@ out:
} }
static int set_config_idmaps(const char *key, const char *value, static int set_config_idmaps(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
unsigned long hostid, nsid, range; unsigned long hostid, nsid, range;
char type; char type;
...@@ -2023,7 +2097,7 @@ on_error: ...@@ -2023,7 +2097,7 @@ on_error:
} }
static int set_config_fstab(const char *key, const char *value, static int set_config_fstab(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
clr_config_fstab(key, lxc_conf); clr_config_fstab(key, lxc_conf);
...@@ -2034,7 +2108,7 @@ static int set_config_fstab(const char *key, const char *value, ...@@ -2034,7 +2108,7 @@ static int set_config_fstab(const char *key, const char *value,
} }
static int set_config_mount_auto(const char *key, const char *value, static int set_config_mount_auto(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *autos, *autoptr, *sptr, *token; char *autos, *autoptr, *sptr, *token;
int i; int i;
...@@ -2103,7 +2177,7 @@ static int set_config_mount_auto(const char *key, const char *value, ...@@ -2103,7 +2177,7 @@ static int set_config_mount_auto(const char *key, const char *value,
} }
static int set_config_mount(const char *key, const char *value, static int set_config_mount(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *mntelem; char *mntelem;
struct lxc_list *mntlist; struct lxc_list *mntlist;
...@@ -2128,7 +2202,7 @@ static int set_config_mount(const char *key, const char *value, ...@@ -2128,7 +2202,7 @@ static int set_config_mount(const char *key, const char *value,
} }
static int set_config_cap_keep(const char *key, const char *value, static int set_config_cap_keep(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *keepcaps, *keepptr, *sptr, *token; char *keepcaps, *keepptr, *sptr, *token;
struct lxc_list *keeplist; struct lxc_list *keeplist;
...@@ -2178,7 +2252,7 @@ static int set_config_cap_keep(const char *key, const char *value, ...@@ -2178,7 +2252,7 @@ static int set_config_cap_keep(const char *key, const char *value,
} }
static int set_config_cap_drop(const char *key, const char *value, static int set_config_cap_drop(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
char *dropcaps, *dropptr, *sptr, *token; char *dropcaps, *dropptr, *sptr, *token;
struct lxc_list *droplist; struct lxc_list *droplist;
...@@ -2225,13 +2299,13 @@ static int set_config_cap_drop(const char *key, const char *value, ...@@ -2225,13 +2299,13 @@ static int set_config_cap_drop(const char *key, const char *value,
} }
static int set_config_console(const char *key, const char *value, static int set_config_console(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_path_item(&lxc_conf->console.path, value); return set_config_path_item(&lxc_conf->console.path, value);
} }
static int set_config_console_logfile(const char *key, const char *value, static int set_config_console_logfile(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_path_item(&lxc_conf->console.log_path, value); return set_config_path_item(&lxc_conf->console.log_path, value);
} }
...@@ -2346,7 +2420,7 @@ out: ...@@ -2346,7 +2420,7 @@ out:
} }
static int set_config_includefiles(const char *key, const char *value, static int set_config_includefiles(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -2362,25 +2436,25 @@ static int set_config_includefiles(const char *key, const char *value, ...@@ -2362,25 +2436,25 @@ static int set_config_includefiles(const char *key, const char *value,
} }
static int set_config_rootfs(const char *key, const char *value, static int set_config_rootfs(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_path_item(&lxc_conf->rootfs.path, value); return set_config_path_item(&lxc_conf->rootfs.path, value);
} }
static int set_config_rootfs_mount(const char *key, const char *value, static int set_config_rootfs_mount(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_path_item(&lxc_conf->rootfs.mount, value); return set_config_path_item(&lxc_conf->rootfs.mount, value);
} }
static int set_config_rootfs_options(const char *key, const char *value, static int set_config_rootfs_options(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
return set_config_string_item(&lxc_conf->rootfs.options, value); return set_config_string_item(&lxc_conf->rootfs.options, value);
} }
static int set_config_rootfs_backend(const char *key, const char *value, static int set_config_rootfs_backend(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
free(lxc_conf->rootfs.bdev_type); free(lxc_conf->rootfs.bdev_type);
...@@ -2397,14 +2471,14 @@ static int set_config_rootfs_backend(const char *key, const char *value, ...@@ -2397,14 +2471,14 @@ static int set_config_rootfs_backend(const char *key, const char *value,
} }
static int set_config_pivotdir(const char *key, const char *value, static int set_config_pivotdir(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
WARN("lxc.pivotdir is ignored. It will soon become an error."); WARN("lxc.pivotdir is ignored. It will soon become an error.");
return 0; return 0;
} }
static int set_config_utsname(const char *key, const char *value, static int set_config_utsname(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
struct utsname *utsname; struct utsname *utsname;
...@@ -2502,7 +2576,7 @@ static int parse_line(char *buffer, void *data) ...@@ -2502,7 +2576,7 @@ static int parse_line(char *buffer, void *data)
goto out; goto out;
} }
ret = config->set(key, value, plc->conf); ret = config->set(key, value, plc->conf, data);
out: out:
free(linep); free(linep);
...@@ -3045,7 +3119,7 @@ bool network_new_hwaddrs(struct lxc_conf *conf) ...@@ -3045,7 +3119,7 @@ bool network_new_hwaddrs(struct lxc_conf *conf)
} }
static int set_config_ephemeral(const char *key, const char *value, static int set_config_ephemeral(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
/* Set config value to default. */ /* Set config value to default. */
if (lxc_config_value_empty(value)) { if (lxc_config_value_empty(value)) {
...@@ -3067,7 +3141,7 @@ static int set_config_ephemeral(const char *key, const char *value, ...@@ -3067,7 +3141,7 @@ static int set_config_ephemeral(const char *key, const char *value,
} }
static int set_config_syslog(const char *key, const char *value, static int set_config_syslog(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
int facility; int facility;
...@@ -3093,7 +3167,7 @@ static int set_config_syslog(const char *key, const char *value, ...@@ -3093,7 +3167,7 @@ static int set_config_syslog(const char *key, const char *value,
} }
static int set_config_no_new_privs(const char *key, const char *value, static int set_config_no_new_privs(const char *key, const char *value,
struct lxc_conf *lxc_conf) struct lxc_conf *lxc_conf, void *data)
{ {
unsigned int v; unsigned int v;
......
...@@ -31,7 +31,8 @@ ...@@ -31,7 +31,8 @@
struct lxc_conf; struct lxc_conf;
struct lxc_list; struct lxc_list;
typedef int (*config_set_cb)(const char *, const char *, struct lxc_conf *); typedef int (*config_set_cb)(const char *, const char *, struct lxc_conf *,
void *data);
typedef int (*config_get_cb)(const char *, char *, int, struct lxc_conf *); typedef int (*config_get_cb)(const char *, char *, int, struct lxc_conf *);
typedef int (*config_clr_cb)(const char *key, struct lxc_conf *c); typedef int (*config_clr_cb)(const char *key, struct lxc_conf *c);
struct lxc_config_t { struct lxc_config_t {
......
...@@ -2511,7 +2511,7 @@ static bool set_config_item_locked(struct lxc_container *c, const char *key, con ...@@ -2511,7 +2511,7 @@ static bool set_config_item_locked(struct lxc_container *c, const char *key, con
config = lxc_getconfig(key); config = lxc_getconfig(key);
if (!config) if (!config)
return false; return false;
if (config->set(key, v, c->lxc_conf) != 0) if (config->set(key, v, c->lxc_conf, NULL) != 0)
return false; return false;
return do_append_unexp_config_line(c->lxc_conf, key, v); return do_append_unexp_config_line(c->lxc_conf, key, v);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment