]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/core/mount.h
analyze: fix typo
[thirdparty/systemd.git] / src / core / mount.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
c2f1db8f 2#pragma once
5cb5a6ff 3
836e4e7e
DDM
4#include "cgroup.h"
5#include "core-forward.h"
6#include "execute.h"
360f384f
LP
7#include "kill.h"
8#include "pidref.h"
57b7a260 9#include "unit.h"
5cb5a6ff 10
e537352b
LP
11typedef enum MountExecCommand {
12 MOUNT_EXEC_MOUNT,
13 MOUNT_EXEC_UNMOUNT,
14 MOUNT_EXEC_REMOUNT,
15 _MOUNT_EXEC_COMMAND_MAX,
2d93c20e 16 _MOUNT_EXEC_COMMAND_INVALID = -EINVAL,
e537352b
LP
17} MountExecCommand;
18
9d2f5178
LP
19typedef enum MountResult {
20 MOUNT_SUCCESS,
006aabbd 21 MOUNT_FAILURE_RESOURCES, /* a bit of a misnomer, just our catch-all error for errnos we didn't expect */
9d2f5178
LP
22 MOUNT_FAILURE_TIMEOUT,
23 MOUNT_FAILURE_EXIT_CODE,
24 MOUNT_FAILURE_SIGNAL,
25 MOUNT_FAILURE_CORE_DUMP,
07299350 26 MOUNT_FAILURE_START_LIMIT_HIT,
006aabbd 27 MOUNT_FAILURE_PROTOCOL,
9d2f5178 28 _MOUNT_RESULT_MAX,
2d93c20e 29 _MOUNT_RESULT_INVALID = -EINVAL,
9d2f5178
LP
30} MountResult;
31
5bcb0f2b
LP
32typedef struct MountParameters {
33 char *what;
34 char *options;
35 char *fstype;
36} MountParameters;
37
ec88d1ea
LP
38/* Used while looking for mount points that vanished or got added from/to /proc/self/mountinfo */
39typedef enum MountProcFlags {
40 MOUNT_PROC_IS_MOUNTED = 1 << 0,
41 MOUNT_PROC_JUST_MOUNTED = 1 << 1,
42 MOUNT_PROC_JUST_CHANGED = 1 << 2,
43} MountProcFlags;
44
4ea4abb6 45typedef struct Mount {
ac155bb8 46 Unit meta;
5cb5a6ff 47
e537352b 48 char *where;
b08d03ff 49
e537352b
LP
50 MountParameters parameters_proc_self_mountinfo;
51 MountParameters parameters_fragment;
f50e0a01 52
f50e0a01 53 bool from_proc_self_mountinfo:1;
e537352b 54 bool from_fragment:1;
ef734fd6 55
ec88d1ea 56 MountProcFlags proc_flags;
e537352b 57
2dbd4a94
LP
58 bool sloppy_options;
59
e520950a 60 bool lazy_unmount;
4f8d40a9 61 bool force_unmount;
e520950a 62
c600357b
MH
63 bool read_write_only;
64
9d2f5178
LP
65 MountResult result;
66 MountResult reload_result;
17e9d53d 67 MountResult clean_result;
e537352b 68
3e5235b0
LP
69 mode_t directory_mode;
70
7fab9d01
LP
71 usec_t timeout_usec;
72
e537352b 73 ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
4ad49000 74
e537352b 75 ExecContext exec_context;
4819ff03 76 KillContext kill_context;
4ad49000 77 CGroupContext cgroup_context;
e537352b 78
28135da3 79 ExecRuntime *exec_runtime;
9cc54544 80 CGroupRuntime *cgroup_runtime;
613b411c 81
a16e1123 82 MountState state, deserialized_state;
e537352b 83
c7c6cf20 84 ExecCommand *control_command;
a16e1123 85 MountExecCommand control_command_id;
360f384f 86 PidRef control_pid;
e537352b 87
718db961 88 sd_event_source *timer_event_source;
7d54a03a
LP
89
90 unsigned n_retry_umount;
4ea4abb6 91} Mount;
5cb5a6ff 92
87f0e418 93extern const UnitVTable mount_vtable;
5cb5a6ff 94
ef734fd6
LP
95void mount_fd_event(Manager *m, int events);
96
222b0b05 97char* mount_get_where_escaped(const Mount *m);
8dbab37d
DDM
98char* mount_get_what_escaped(const Mount *m);
99char* mount_get_options_escaped(const Mount *m);
100const char* mount_get_fstype(const Mount *m);
101
44a6b1b6
ZJS
102const char* mount_exec_command_to_string(MountExecCommand i) _const_;
103MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
a16e1123 104
44a6b1b6
ZJS
105const char* mount_result_to_string(MountResult i) _const_;
106MountResult mount_result_from_string(const char *s) _pure_;
57b7a260
FS
107
108DEFINE_CAST(MOUNT, Mount);