]>
Commit | Line | Data |
---|---|---|
03467c88 | 1 | /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ |
5cb5a6ff LP |
2 | |
3 | #ifndef foomounthfoo | |
4 | #define foomounthfoo | |
5 | ||
a7334b09 LP |
6 | /*** |
7 | This file is part of systemd. | |
8 | ||
9 | Copyright 2010 Lennart Poettering | |
10 | ||
11 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
12 | under the terms of the GNU Lesser General Public License as published by |
13 | the Free Software Foundation; either version 2.1 of the License, or | |
a7334b09 LP |
14 | (at your option) any later version. |
15 | ||
16 | systemd is distributed in the hope that it will be useful, but | |
17 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 19 | Lesser General Public License for more details. |
a7334b09 | 20 | |
5430f7f2 | 21 | You should have received a copy of the GNU Lesser General Public License |
a7334b09 LP |
22 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
23 | ***/ | |
24 | ||
5cb5a6ff LP |
25 | typedef struct Mount Mount; |
26 | ||
87f0e418 | 27 | #include "unit.h" |
5cb5a6ff LP |
28 | |
29 | typedef enum MountState { | |
30 | MOUNT_DEAD, | |
e537352b LP |
31 | MOUNT_MOUNTING, /* /bin/mount is running, but the mount is not done yet. */ |
32 | MOUNT_MOUNTING_DONE, /* /bin/mount is running, and the mount is done. */ | |
5cb5a6ff | 33 | MOUNT_MOUNTED, |
e537352b | 34 | MOUNT_REMOUNTING, |
5cb5a6ff | 35 | MOUNT_UNMOUNTING, |
e537352b LP |
36 | MOUNT_MOUNTING_SIGTERM, |
37 | MOUNT_MOUNTING_SIGKILL, | |
38 | MOUNT_REMOUNTING_SIGTERM, | |
39 | MOUNT_REMOUNTING_SIGKILL, | |
40 | MOUNT_UNMOUNTING_SIGTERM, | |
41 | MOUNT_UNMOUNTING_SIGKILL, | |
fdf20a31 | 42 | MOUNT_FAILED, |
e537352b LP |
43 | _MOUNT_STATE_MAX, |
44 | _MOUNT_STATE_INVALID = -1 | |
5cb5a6ff LP |
45 | } MountState; |
46 | ||
e537352b LP |
47 | typedef enum MountExecCommand { |
48 | MOUNT_EXEC_MOUNT, | |
49 | MOUNT_EXEC_UNMOUNT, | |
50 | MOUNT_EXEC_REMOUNT, | |
51 | _MOUNT_EXEC_COMMAND_MAX, | |
52 | _MOUNT_EXEC_COMMAND_INVALID = -1 | |
53 | } MountExecCommand; | |
54 | ||
55 | typedef struct MountParameters { | |
56 | char *what; | |
57 | char *options; | |
58 | char *fstype; | |
9fff8a1f | 59 | int passno; |
e537352b LP |
60 | } MountParameters; |
61 | ||
9d2f5178 LP |
62 | typedef enum MountResult { |
63 | MOUNT_SUCCESS, | |
64 | MOUNT_FAILURE_RESOURCES, | |
65 | MOUNT_FAILURE_TIMEOUT, | |
66 | MOUNT_FAILURE_EXIT_CODE, | |
67 | MOUNT_FAILURE_SIGNAL, | |
68 | MOUNT_FAILURE_CORE_DUMP, | |
69 | _MOUNT_RESULT_MAX, | |
70 | _MOUNT_RESULT_INVALID = -1 | |
71 | } MountResult; | |
72 | ||
5cb5a6ff | 73 | struct Mount { |
ac155bb8 | 74 | Unit meta; |
5cb5a6ff | 75 | |
e537352b | 76 | char *where; |
b08d03ff | 77 | |
e537352b LP |
78 | MountParameters parameters_etc_fstab; |
79 | MountParameters parameters_proc_self_mountinfo; | |
80 | MountParameters parameters_fragment; | |
f50e0a01 LP |
81 | |
82 | bool from_etc_fstab:1; | |
83 | bool from_proc_self_mountinfo:1; | |
e537352b | 84 | bool from_fragment:1; |
ef734fd6 LP |
85 | |
86 | /* Used while looking for mount points that vanished or got | |
87 | * added from/to /proc/self/mountinfo */ | |
e537352b LP |
88 | bool is_mounted:1; |
89 | bool just_mounted:1; | |
90 | bool just_changed:1; | |
91 | ||
9d2f5178 LP |
92 | MountResult result; |
93 | MountResult reload_result; | |
e537352b | 94 | |
3e5235b0 LP |
95 | mode_t directory_mode; |
96 | ||
7fab9d01 LP |
97 | usec_t timeout_usec; |
98 | ||
e537352b LP |
99 | ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX]; |
100 | ExecContext exec_context; | |
101 | ||
a16e1123 | 102 | MountState state, deserialized_state; |
e537352b | 103 | |
e537352b | 104 | ExecCommand* control_command; |
a16e1123 | 105 | MountExecCommand control_command_id; |
e537352b LP |
106 | pid_t control_pid; |
107 | ||
108 | Watch timer_watch; | |
5cb5a6ff LP |
109 | }; |
110 | ||
87f0e418 | 111 | extern const UnitVTable mount_vtable; |
5cb5a6ff | 112 | |
ef734fd6 LP |
113 | void mount_fd_event(Manager *m, int events); |
114 | ||
a16e1123 LP |
115 | const char* mount_state_to_string(MountState i); |
116 | MountState mount_state_from_string(const char *s); | |
117 | ||
118 | const char* mount_exec_command_to_string(MountExecCommand i); | |
119 | MountExecCommand mount_exec_command_from_string(const char *s); | |
120 | ||
9d2f5178 LP |
121 | const char* mount_result_to_string(MountResult i); |
122 | MountResult mount_result_from_string(const char *s); | |
123 | ||
5cb5a6ff | 124 | #endif |