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