]> git.proxmox.com Git - systemd.git/blob - src/nspawn/nspawn-settings.h
Imported Upstream version 226
[systemd.git] / src / nspawn / nspawn-settings.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright 2015 Lennart Poettering
9
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.
14
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.
19
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/>.
22 ***/
23
24 #include <stdio.h>
25
26 #include "macro.h"
27
28 #include "nspawn-mount.h"
29 #include "nspawn-expose-ports.h"
30
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
45 } SettingsMask;
46
47 typedef struct Settings {
48 /* [Run] */
49 int boot;
50 char **parameters;
51 char **environment;
52 char *user;
53 uint64_t capability;
54 uint64_t drop_capability;
55 int kill_signal;
56 unsigned long personality;
57 sd_id128_t machine_id;
58
59 /* [Image] */
60 int read_only;
61 VolatileMode volatile_mode;
62 CustomMount *custom_mounts;
63 unsigned n_custom_mounts;
64
65 /* [Network] */
66 int private_network;
67 int network_veth;
68 char *network_bridge;
69 char **network_interfaces;
70 char **network_macvlan;
71 char **network_ipvlan;
72 ExposePort *expose_ports;
73 } Settings;
74
75 int settings_load(FILE *f, const char *path, Settings **ret);
76 Settings* settings_free(Settings *s);
77
78 DEFINE_TRIVIAL_CLEANUP_FUNC(Settings*, settings_free);
79
80 const struct ConfigPerfItem* nspawn_gperf_lookup(const char *key, unsigned length);
81
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);