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