1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
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
13 (at your option) any later version.
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
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 typedef struct Mount Mount;
31 typedef enum MountState {
33 MOUNT_MOUNTING, /* /bin/mount is running, but the mount is not done yet. */
34 MOUNT_MOUNTING_DONE, /* /bin/mount is running, and the mount is done. */
38 MOUNT_MOUNTING_SIGTERM,
39 MOUNT_MOUNTING_SIGKILL,
40 MOUNT_REMOUNTING_SIGTERM,
41 MOUNT_REMOUNTING_SIGKILL,
42 MOUNT_UNMOUNTING_SIGTERM,
43 MOUNT_UNMOUNTING_SIGKILL,
46 _MOUNT_STATE_INVALID = -1
49 typedef enum MountExecCommand {
53 _MOUNT_EXEC_COMMAND_MAX,
54 _MOUNT_EXEC_COMMAND_INVALID = -1
57 typedef enum MountResult {
59 MOUNT_FAILURE_RESOURCES,
60 MOUNT_FAILURE_TIMEOUT,
61 MOUNT_FAILURE_EXIT_CODE,
63 MOUNT_FAILURE_CORE_DUMP,
65 _MOUNT_RESULT_INVALID = -1
68 typedef struct MountParameters {
79 MountParameters parameters_proc_self_mountinfo;
80 MountParameters parameters_fragment;
82 bool from_proc_self_mountinfo:1;
85 /* Used while looking for mount points that vanished or got
86 * added from/to /proc/self/mountinfo */
94 MountResult reload_result;
96 mode_t directory_mode;
100 ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
102 ExecContext exec_context;
103 KillContext kill_context;
104 CGroupContext cgroup_context;
106 ExecRuntime *exec_runtime;
108 MountState state, deserialized_state;
110 ExecCommand* control_command;
111 MountExecCommand control_command_id;
114 sd_event_source *timer_event_source;
117 extern const UnitVTable mount_vtable;
119 void mount_fd_event(Manager *m, int events);
121 const char* mount_state_to_string(MountState i) _const_;
122 MountState mount_state_from_string(const char *s) _pure_;
124 const char* mount_exec_command_to_string(MountExecCommand i) _const_;
125 MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
127 const char* mount_result_to_string(MountResult i) _const_;
128 MountResult mount_result_from_string(const char *s) _pure_;
130 void warn_if_dir_nonempty(const char *unit, const char* where);