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