]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/mount.h
core: move enforcement of the start limit into per-unit-type code again
[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
4ad49000 24#include "execute.h"
71d35b6b 25#include "kill.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
9d2f5178
LP
74 MountResult result;
75 MountResult reload_result;
e537352b 76
3e5235b0
LP
77 mode_t directory_mode;
78
7fab9d01
LP
79 usec_t timeout_usec;
80
e537352b 81 ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
4ad49000 82
e537352b 83 ExecContext exec_context;
4819ff03 84 KillContext kill_context;
4ad49000 85 CGroupContext cgroup_context;
e537352b 86
613b411c
LP
87 ExecRuntime *exec_runtime;
88
a16e1123 89 MountState state, deserialized_state;
e537352b 90
e537352b 91 ExecCommand* control_command;
a16e1123 92 MountExecCommand control_command_id;
e537352b
LP
93 pid_t control_pid;
94
718db961 95 sd_event_source *timer_event_source;
7d54a03a
LP
96
97 unsigned n_retry_umount;
5cb5a6ff
LP
98};
99
87f0e418 100extern const UnitVTable mount_vtable;
5cb5a6ff 101
ef734fd6
LP
102void mount_fd_event(Manager *m, int events);
103
44a6b1b6
ZJS
104const char* mount_exec_command_to_string(MountExecCommand i) _const_;
105MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
a16e1123 106
44a6b1b6
ZJS
107const char* mount_result_to_string(MountResult i) _const_;
108MountResult mount_result_from_string(const char *s) _pure_;