]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/nspawn/nspawn-mount.h
core: rename cg_unified() to cg_all_unified()
[thirdparty/systemd.git] / src / nspawn / nspawn-mount.h
CommitLineData
e83bebef
LP
1#pragma once
2
3/***
4 This file is part of systemd.
5
6 Copyright 2015 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
22#include <stdbool.h>
23
24typedef enum VolatileMode {
25 VOLATILE_NO,
26 VOLATILE_YES,
27 VOLATILE_STATE,
28 _VOLATILE_MODE_MAX,
29 _VOLATILE_MODE_INVALID = -1
30} VolatileMode;
31
32typedef enum CustomMountType {
33 CUSTOM_MOUNT_BIND,
34 CUSTOM_MOUNT_TMPFS,
35 CUSTOM_MOUNT_OVERLAY,
36 _CUSTOM_MOUNT_TYPE_MAX,
37 _CUSTOM_MOUNT_TYPE_INVALID = -1
38} CustomMountType;
39
40typedef struct CustomMount {
41 CustomMountType type;
42 bool read_only;
43 char *source; /* for overlayfs this is the upper directory */
44 char *destination;
45 char *options;
46 char *work_dir;
47 char **lower;
48} CustomMount;
49
50CustomMount* custom_mount_add(CustomMount **l, unsigned *n, CustomMountType t);
51
52void custom_mount_free_all(CustomMount *l, unsigned n);
53int bind_mount_parse(CustomMount **l, unsigned *n, const char *s, bool read_only);
54int tmpfs_mount_parse(CustomMount **l, unsigned *n, const char *s);
55
56int custom_mount_compare(const void *a, const void *b);
57
d1678248 58int mount_all(const char *dest, bool use_userns, bool in_userns, bool use_netns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
d8fc6a00 59int mount_sysfs(const char *dest);
e83bebef 60
5a8ff0e6 61int mount_cgroups(const char *dest, bool unified_requested, bool userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context, bool use_cgns);
e83bebef
LP
62int mount_systemd_cgroup_writable(const char *dest, bool unified_requested);
63
64int mount_custom(const char *dest, CustomMount *mounts, unsigned n, bool userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
65
66int setup_volatile(const char *directory, VolatileMode mode, bool userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
67int setup_volatile_state(const char *directory, VolatileMode mode, bool userns, uid_t uid_shift, uid_t uid_range, const char *selinux_apifs_context);
68
69VolatileMode volatile_mode_from_string(const char *s);