]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
c2f1db8f | 2 | #pragma once |
5cb5a6ff | 3 | |
a7334b09 LP |
4 | /*** |
5 | This file is part of systemd. | |
6 | ||
7 | Copyright 2010 Lennart Poettering | |
8 | ||
9 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
10 | under the terms of the GNU Lesser General Public License as published by |
11 | the Free Software Foundation; either version 2.1 of the License, or | |
a7334b09 LP |
12 | (at your option) any later version. |
13 | ||
14 | systemd is distributed in the hope that it will be useful, but | |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 17 | Lesser General Public License for more details. |
a7334b09 | 18 | |
5430f7f2 | 19 | You should have received a copy of the GNU Lesser General Public License |
a7334b09 LP |
20 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
21 | ***/ | |
22 | ||
5cb5a6ff LP |
23 | typedef struct Mount Mount; |
24 | ||
71d35b6b | 25 | #include "kill.h" |
29206d46 | 26 | #include "dynamic-user.h" |
5cb5a6ff | 27 | |
e537352b LP |
28 | typedef enum MountExecCommand { |
29 | MOUNT_EXEC_MOUNT, | |
30 | MOUNT_EXEC_UNMOUNT, | |
31 | MOUNT_EXEC_REMOUNT, | |
32 | _MOUNT_EXEC_COMMAND_MAX, | |
33 | _MOUNT_EXEC_COMMAND_INVALID = -1 | |
34 | } MountExecCommand; | |
35 | ||
9d2f5178 LP |
36 | typedef enum MountResult { |
37 | MOUNT_SUCCESS, | |
38 | MOUNT_FAILURE_RESOURCES, | |
39 | MOUNT_FAILURE_TIMEOUT, | |
40 | MOUNT_FAILURE_EXIT_CODE, | |
41 | MOUNT_FAILURE_SIGNAL, | |
42 | MOUNT_FAILURE_CORE_DUMP, | |
07299350 | 43 | MOUNT_FAILURE_START_LIMIT_HIT, |
9d2f5178 LP |
44 | _MOUNT_RESULT_MAX, |
45 | _MOUNT_RESULT_INVALID = -1 | |
46 | } MountResult; | |
47 | ||
5bcb0f2b LP |
48 | typedef struct MountParameters { |
49 | char *what; | |
50 | char *options; | |
51 | char *fstype; | |
52 | } MountParameters; | |
53 | ||
5cb5a6ff | 54 | struct Mount { |
ac155bb8 | 55 | Unit meta; |
5cb5a6ff | 56 | |
e537352b | 57 | char *where; |
b08d03ff | 58 | |
e537352b LP |
59 | MountParameters parameters_proc_self_mountinfo; |
60 | MountParameters parameters_fragment; | |
f50e0a01 | 61 | |
f50e0a01 | 62 | bool from_proc_self_mountinfo:1; |
e537352b | 63 | bool from_fragment:1; |
ef734fd6 LP |
64 | |
65 | /* Used while looking for mount points that vanished or got | |
66 | * added from/to /proc/self/mountinfo */ | |
e537352b LP |
67 | bool is_mounted:1; |
68 | bool just_mounted:1; | |
69 | bool just_changed:1; | |
70 | ||
906c06f6 | 71 | bool reset_accounting:1; |
5ad096b3 | 72 | |
2dbd4a94 LP |
73 | bool sloppy_options; |
74 | ||
e520950a | 75 | bool lazy_unmount; |
4f8d40a9 | 76 | bool force_unmount; |
e520950a | 77 | |
9d2f5178 LP |
78 | MountResult result; |
79 | MountResult reload_result; | |
e537352b | 80 | |
3e5235b0 LP |
81 | mode_t directory_mode; |
82 | ||
7fab9d01 LP |
83 | usec_t timeout_usec; |
84 | ||
e537352b | 85 | ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX]; |
4ad49000 | 86 | |
e537352b | 87 | ExecContext exec_context; |
4819ff03 | 88 | KillContext kill_context; |
4ad49000 | 89 | CGroupContext cgroup_context; |
e537352b | 90 | |
613b411c | 91 | ExecRuntime *exec_runtime; |
29206d46 | 92 | DynamicCreds dynamic_creds; |
613b411c | 93 | |
a16e1123 | 94 | MountState state, deserialized_state; |
e537352b | 95 | |
e537352b | 96 | ExecCommand* control_command; |
a16e1123 | 97 | MountExecCommand control_command_id; |
e537352b LP |
98 | pid_t control_pid; |
99 | ||
718db961 | 100 | sd_event_source *timer_event_source; |
7d54a03a LP |
101 | |
102 | unsigned n_retry_umount; | |
5cb5a6ff LP |
103 | }; |
104 | ||
87f0e418 | 105 | extern const UnitVTable mount_vtable; |
5cb5a6ff | 106 | |
ef734fd6 LP |
107 | void mount_fd_event(Manager *m, int events); |
108 | ||
44a6b1b6 ZJS |
109 | const char* mount_exec_command_to_string(MountExecCommand i) _const_; |
110 | MountExecCommand mount_exec_command_from_string(const char *s) _pure_; | |
a16e1123 | 111 | |
44a6b1b6 ZJS |
112 | const char* mount_result_to_string(MountResult i) _const_; |
113 | MountResult mount_result_from_string(const char *s) _pure_; |