]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/mount.h
mount: add new LazyUnmount= setting for mount units, mapping to umount(8)'s "-l"...
[thirdparty/systemd.git] / src / core / mount.h
CommitLineData
c2f1db8f 1#pragma once
5cb5a6ff 2
a7334b09
LP
3/***
4 This file is part of systemd.
5
6 Copyright 2010 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
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
a7334b09
LP
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
5430f7f2 16 Lesser General Public License for more details.
a7334b09 17
5430f7f2 18 You should have received a copy of the GNU Lesser General Public License
a7334b09
LP
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20***/
21
5cb5a6ff
LP
22typedef struct Mount Mount;
23
71d35b6b 24#include "kill.h"
29206d46 25#include "dynamic-user.h"
5cb5a6ff 26
e537352b
LP
27typedef enum MountExecCommand {
28 MOUNT_EXEC_MOUNT,
29 MOUNT_EXEC_UNMOUNT,
30 MOUNT_EXEC_REMOUNT,
31 _MOUNT_EXEC_COMMAND_MAX,
32 _MOUNT_EXEC_COMMAND_INVALID = -1
33} MountExecCommand;
34
9d2f5178
LP
35typedef enum MountResult {
36 MOUNT_SUCCESS,
37 MOUNT_FAILURE_RESOURCES,
38 MOUNT_FAILURE_TIMEOUT,
39 MOUNT_FAILURE_EXIT_CODE,
40 MOUNT_FAILURE_SIGNAL,
41 MOUNT_FAILURE_CORE_DUMP,
07299350 42 MOUNT_FAILURE_START_LIMIT_HIT,
9d2f5178
LP
43 _MOUNT_RESULT_MAX,
44 _MOUNT_RESULT_INVALID = -1
45} MountResult;
46
5bcb0f2b
LP
47typedef struct MountParameters {
48 char *what;
49 char *options;
50 char *fstype;
51} MountParameters;
52
5cb5a6ff 53struct Mount {
ac155bb8 54 Unit meta;
5cb5a6ff 55
e537352b 56 char *where;
b08d03ff 57
e537352b
LP
58 MountParameters parameters_proc_self_mountinfo;
59 MountParameters parameters_fragment;
f50e0a01 60
f50e0a01 61 bool from_proc_self_mountinfo:1;
e537352b 62 bool from_fragment:1;
ef734fd6
LP
63
64 /* Used while looking for mount points that vanished or got
65 * added from/to /proc/self/mountinfo */
e537352b
LP
66 bool is_mounted:1;
67 bool just_mounted:1;
68 bool just_changed:1;
69
5ad096b3
LP
70 bool reset_cpu_usage:1;
71
2dbd4a94
LP
72 bool sloppy_options;
73
e520950a
BR
74 bool lazy_unmount;
75
9d2f5178
LP
76 MountResult result;
77 MountResult reload_result;
e537352b 78
3e5235b0
LP
79 mode_t directory_mode;
80
7fab9d01
LP
81 usec_t timeout_usec;
82
e537352b 83 ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
4ad49000 84
e537352b 85 ExecContext exec_context;
4819ff03 86 KillContext kill_context;
4ad49000 87 CGroupContext cgroup_context;
e537352b 88
613b411c 89 ExecRuntime *exec_runtime;
29206d46 90 DynamicCreds dynamic_creds;
613b411c 91
a16e1123 92 MountState state, deserialized_state;
e537352b 93
e537352b 94 ExecCommand* control_command;
a16e1123 95 MountExecCommand control_command_id;
e537352b
LP
96 pid_t control_pid;
97
718db961 98 sd_event_source *timer_event_source;
7d54a03a
LP
99
100 unsigned n_retry_umount;
5cb5a6ff
LP
101};
102
87f0e418 103extern const UnitVTable mount_vtable;
5cb5a6ff 104
ef734fd6
LP
105void mount_fd_event(Manager *m, int events);
106
44a6b1b6
ZJS
107const char* mount_exec_command_to_string(MountExecCommand i) _const_;
108MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
a16e1123 109
44a6b1b6
ZJS
110const char* mount_result_to_string(MountResult i) _const_;
111MountResult mount_result_from_string(const char *s) _pure_;