]>
Commit | Line | Data |
---|---|---|
03467c88 | 1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
5cb5a6ff | 2 | |
c2f1db8f | 3 | #pragma once |
5cb5a6ff | 4 | |
a7334b09 LP |
5 | /*** |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
11 | under the terms of the GNU Lesser General Public License as published by |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
a7334b09 LP |
13 | (at your option) any later version. |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 18 | Lesser General Public License for more details. |
a7334b09 | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
a7334b09 LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | ***/ | |
23 | ||
5cb5a6ff LP |
24 | typedef struct Mount Mount; |
25 | ||
4819ff03 | 26 | #include "kill.h" |
4ad49000 | 27 | #include "execute.h" |
5cb5a6ff | 28 | |
e537352b LP |
29 | typedef enum MountExecCommand { |
30 | MOUNT_EXEC_MOUNT, | |
31 | MOUNT_EXEC_UNMOUNT, | |
32 | MOUNT_EXEC_REMOUNT, | |
33 | _MOUNT_EXEC_COMMAND_MAX, | |
34 | _MOUNT_EXEC_COMMAND_INVALID = -1 | |
35 | } MountExecCommand; | |
36 | ||
9d2f5178 LP |
37 | typedef enum MountResult { |
38 | MOUNT_SUCCESS, | |
39 | MOUNT_FAILURE_RESOURCES, | |
40 | MOUNT_FAILURE_TIMEOUT, | |
41 | MOUNT_FAILURE_EXIT_CODE, | |
42 | MOUNT_FAILURE_SIGNAL, | |
43 | MOUNT_FAILURE_CORE_DUMP, | |
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 | ||
5ad096b3 LP |
71 | bool reset_cpu_usage:1; |
72 | ||
2dbd4a94 LP |
73 | bool sloppy_options; |
74 | ||
9d2f5178 LP |
75 | MountResult result; |
76 | MountResult reload_result; | |
e537352b | 77 | |
3e5235b0 LP |
78 | mode_t directory_mode; |
79 | ||
7fab9d01 LP |
80 | usec_t timeout_usec; |
81 | ||
e537352b | 82 | ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX]; |
4ad49000 | 83 | |
e537352b | 84 | ExecContext exec_context; |
4819ff03 | 85 | KillContext kill_context; |
4ad49000 | 86 | CGroupContext cgroup_context; |
e537352b | 87 | |
613b411c LP |
88 | ExecRuntime *exec_runtime; |
89 | ||
a16e1123 | 90 | MountState state, deserialized_state; |
e537352b | 91 | |
e537352b | 92 | ExecCommand* control_command; |
a16e1123 | 93 | MountExecCommand control_command_id; |
e537352b LP |
94 | pid_t control_pid; |
95 | ||
718db961 | 96 | sd_event_source *timer_event_source; |
7d54a03a LP |
97 | |
98 | unsigned n_retry_umount; | |
5cb5a6ff LP |
99 | }; |
100 | ||
87f0e418 | 101 | extern const UnitVTable mount_vtable; |
5cb5a6ff | 102 | |
ef734fd6 LP |
103 | void mount_fd_event(Manager *m, int events); |
104 | ||
44a6b1b6 ZJS |
105 | const char* mount_exec_command_to_string(MountExecCommand i) _const_; |
106 | MountExecCommand mount_exec_command_from_string(const char *s) _pure_; | |
a16e1123 | 107 | |
44a6b1b6 ZJS |
108 | const char* mount_result_to_string(MountResult i) _const_; |
109 | MountResult mount_result_from_string(const char *s) _pure_; |