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