]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/mount.h
dhcp6: reduce whitespace a bit
[thirdparty/systemd.git] / src / core / mount.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 typedef struct Mount Mount;
5
6 #include "kill.h"
7 #include "dynamic-user.h"
8 #include "unit.h"
9
10 typedef enum MountExecCommand {
11 MOUNT_EXEC_MOUNT,
12 MOUNT_EXEC_UNMOUNT,
13 MOUNT_EXEC_REMOUNT,
14 _MOUNT_EXEC_COMMAND_MAX,
15 _MOUNT_EXEC_COMMAND_INVALID = -1
16 } MountExecCommand;
17
18 typedef enum MountResult {
19 MOUNT_SUCCESS,
20 MOUNT_FAILURE_RESOURCES, /* a bit of a misnomer, just our catch-all error for errnos we didn't expect */
21 MOUNT_FAILURE_TIMEOUT,
22 MOUNT_FAILURE_EXIT_CODE,
23 MOUNT_FAILURE_SIGNAL,
24 MOUNT_FAILURE_CORE_DUMP,
25 MOUNT_FAILURE_START_LIMIT_HIT,
26 MOUNT_FAILURE_PROTOCOL,
27 _MOUNT_RESULT_MAX,
28 _MOUNT_RESULT_INVALID = -1
29 } MountResult;
30
31 typedef struct MountParameters {
32 char *what;
33 char *options;
34 char *fstype;
35 } MountParameters;
36
37 struct Mount {
38 Unit meta;
39
40 char *where;
41
42 MountParameters parameters_proc_self_mountinfo;
43 MountParameters parameters_fragment;
44
45 bool from_proc_self_mountinfo:1;
46 bool from_fragment:1;
47
48 /* Used while looking for mount points that vanished or got
49 * added from/to /proc/self/mountinfo */
50 bool is_mounted:1;
51 bool just_mounted:1;
52 bool just_changed:1;
53
54 bool sloppy_options;
55
56 bool lazy_unmount;
57 bool force_unmount;
58
59 MountResult result;
60 MountResult reload_result;
61
62 mode_t directory_mode;
63
64 usec_t timeout_usec;
65
66 ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
67
68 ExecContext exec_context;
69 KillContext kill_context;
70 CGroupContext cgroup_context;
71
72 ExecRuntime *exec_runtime;
73 DynamicCreds dynamic_creds;
74
75 MountState state, deserialized_state;
76
77 ExecCommand* control_command;
78 MountExecCommand control_command_id;
79 pid_t control_pid;
80
81 sd_event_source *timer_event_source;
82
83 unsigned n_retry_umount;
84 };
85
86 extern const UnitVTable mount_vtable;
87
88 void mount_fd_event(Manager *m, int events);
89
90 const char* mount_exec_command_to_string(MountExecCommand i) _const_;
91 MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
92
93 const char* mount_result_to_string(MountResult i) _const_;
94 MountResult mount_result_from_string(const char *s) _pure_;
95
96 DEFINE_CAST(MOUNT, Mount);