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