1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2015 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
28 #include "nspawn-mount.h"
29 #include "nspawn-expose-ports.h"
31 typedef enum SettingsMask
{
32 SETTING_BOOT
= 1 << 0,
33 SETTING_ENVIRONMENT
= 1 << 1,
34 SETTING_USER
= 1 << 2,
35 SETTING_CAPABILITY
= 1 << 3,
36 SETTING_KILL_SIGNAL
= 1 << 4,
37 SETTING_PERSONALITY
= 1 << 5,
38 SETTING_MACHINE_ID
= 1 << 6,
39 SETTING_NETWORK
= 1 << 7,
40 SETTING_EXPOSE_PORTS
= 1 << 8,
41 SETTING_READ_ONLY
= 1 << 9,
42 SETTING_VOLATILE_MODE
= 1 << 10,
43 SETTING_CUSTOM_MOUNTS
= 1 << 11,
44 _SETTINGS_MASK_ALL
= (1 << 12) -1
47 typedef struct Settings
{
54 uint64_t drop_capability
;
56 unsigned long personality
;
57 sd_id128_t machine_id
;
61 VolatileMode volatile_mode
;
62 CustomMount
*custom_mounts
;
63 unsigned n_custom_mounts
;
69 char **network_interfaces
;
70 char **network_macvlan
;
71 char **network_ipvlan
;
72 ExposePort
*expose_ports
;
75 int settings_load(FILE *f
, const char *path
, Settings
**ret
);
76 Settings
* settings_free(Settings
*s
);
78 DEFINE_TRIVIAL_CLEANUP_FUNC(Settings
*, settings_free
);
80 const struct ConfigPerfItem
* nspawn_gperf_lookup(const char *key
, unsigned length
);
82 int config_parse_capability(const char *unit
, const char *filename
, unsigned line
, const char *section
, unsigned section_line
, const char *lvalue
, int ltype
, const char *rvalue
, void *data
, void *userdata
);
83 int config_parse_id128(const char *unit
, const char *filename
, unsigned line
, const char *section
, unsigned section_line
, const char *lvalue
, int ltype
, const char *rvalue
, void *data
, void *userdata
);
84 int config_parse_expose_port(const char *unit
, const char *filename
, unsigned line
, const char *section
, unsigned section_line
, const char *lvalue
, int ltype
, const char *rvalue
, void *data
, void *userdata
);
85 int config_parse_volatile_mode(const char *unit
, const char *filename
, unsigned line
, const char *section
, unsigned section_line
, const char *lvalue
, int ltype
, const char *rvalue
, void *data
, void *userdata
);
86 int config_parse_bind(const char *unit
, const char *filename
, unsigned line
, const char *section
, unsigned section_line
, const char *lvalue
, int ltype
, const char *rvalue
, void *data
, void *userdata
);
87 int config_parse_tmpfs(const char *unit
, const char *filename
, unsigned line
, const char *section
, unsigned section_line
, const char *lvalue
, int ltype
, const char *rvalue
, void *data
, void *userdata
);