]>
Commit | Line | Data |
---|---|---|
1 | /*-*- Mode: C; c-basic-offset: 8 -*-*/ | |
2 | ||
3 | #ifndef foomounthfoo | |
4 | #define foomounthfoo | |
5 | ||
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 | |
12 | under the terms of the GNU General Public License as published by | |
13 | the Free Software Foundation; either version 2 of the License, or | |
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 | |
19 | General Public License for more details. | |
20 | ||
21 | You should have received a copy of the GNU General Public License | |
22 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
23 | ***/ | |
24 | ||
25 | typedef struct Mount Mount; | |
26 | ||
27 | #include "unit.h" | |
28 | ||
29 | typedef enum MountState { | |
30 | MOUNT_DEAD, | |
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. */ | |
33 | MOUNT_MOUNTED, | |
34 | MOUNT_REMOUNTING, | |
35 | MOUNT_UNMOUNTING, | |
36 | MOUNT_MOUNTING_SIGTERM, | |
37 | MOUNT_MOUNTING_SIGKILL, | |
38 | MOUNT_REMOUNTING_SIGTERM, | |
39 | MOUNT_REMOUNTING_SIGKILL, | |
40 | MOUNT_UNMOUNTING_SIGTERM, | |
41 | MOUNT_UNMOUNTING_SIGKILL, | |
42 | MOUNT_MAINTAINANCE, | |
43 | _MOUNT_STATE_MAX, | |
44 | _MOUNT_STATE_INVALID = -1 | |
45 | } MountState; | |
46 | ||
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; | |
59 | } MountParameters; | |
60 | ||
61 | struct Mount { | |
62 | Meta meta; | |
63 | ||
64 | char *where; | |
65 | ||
66 | MountParameters parameters_etc_fstab; | |
67 | MountParameters parameters_proc_self_mountinfo; | |
68 | MountParameters parameters_fragment; | |
69 | ||
70 | bool from_etc_fstab:1; | |
71 | bool from_proc_self_mountinfo:1; | |
72 | bool from_fragment:1; | |
73 | ||
74 | /* Used while looking for mount points that vanished or got | |
75 | * added from/to /proc/self/mountinfo */ | |
76 | bool is_mounted:1; | |
77 | bool just_mounted:1; | |
78 | bool just_changed:1; | |
79 | ||
80 | bool failure:1; | |
81 | ||
82 | usec_t timeout_usec; | |
83 | ||
84 | ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX]; | |
85 | ExecContext exec_context; | |
86 | ||
87 | MountState state, deserialized_state; | |
88 | ||
89 | KillMode kill_mode; | |
90 | ||
91 | ExecCommand* control_command; | |
92 | MountExecCommand control_command_id; | |
93 | pid_t control_pid; | |
94 | ||
95 | Watch timer_watch; | |
96 | }; | |
97 | ||
98 | extern const UnitVTable mount_vtable; | |
99 | ||
100 | void mount_fd_event(Manager *m, int events); | |
101 | ||
102 | int mount_path_is_mounted(Manager *m, const char* path); | |
103 | int mount_add_node_links(Unit *m, const char *what); | |
104 | int mount_add_path_links(Unit *m, const char *where, bool requires); | |
105 | ||
106 | const char* mount_state_to_string(MountState i); | |
107 | MountState mount_state_from_string(const char *s); | |
108 | ||
109 | const char* mount_exec_command_to_string(MountExecCommand i); | |
110 | MountExecCommand mount_exec_command_from_string(const char *s); | |
111 | ||
112 | #endif |