]> git.proxmox.com Git - systemd.git/blame - src/core/mount.h
New upstream version 240
[systemd.git] / src / core / mount.h
CommitLineData
52ad194e 1/* SPDX-License-Identifier: LGPL-2.1+ */
663996b3
MS
2#pragma once
3
663996b3
MS
4typedef struct Mount Mount;
5
4c89c718 6#include "kill.h"
8a584da2 7#include "dynamic-user.h"
b012e921 8#include "unit.h"
663996b3 9
663996b3
MS
10typedef 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
663996b3
MS
18typedef enum MountResult {
19 MOUNT_SUCCESS,
1d42b86d 20 MOUNT_FAILURE_RESOURCES, /* a bit of a misnomer, just our catch-all error for errnos we didn't expect */
663996b3
MS
21 MOUNT_FAILURE_TIMEOUT,
22 MOUNT_FAILURE_EXIT_CODE,
23 MOUNT_FAILURE_SIGNAL,
24 MOUNT_FAILURE_CORE_DUMP,
aa27b158 25 MOUNT_FAILURE_START_LIMIT_HIT,
1d42b86d 26 MOUNT_FAILURE_PROTOCOL,
663996b3
MS
27 _MOUNT_RESULT_MAX,
28 _MOUNT_RESULT_INVALID = -1
29} MountResult;
30
60f067b4
JS
31typedef struct MountParameters {
32 char *what;
33 char *options;
34 char *fstype;
35} MountParameters;
36
6e866b33
MB
37/* Used while looking for mount points that vanished or got added from/to /proc/self/mountinfo */
38typedef enum MountProcFlags {
39 MOUNT_PROC_IS_MOUNTED = 1 << 0,
40 MOUNT_PROC_JUST_MOUNTED = 1 << 1,
41 MOUNT_PROC_JUST_CHANGED = 1 << 2,
42} MountProcFlags;
43
663996b3
MS
44struct Mount {
45 Unit meta;
46
47 char *where;
48
49 MountParameters parameters_proc_self_mountinfo;
50 MountParameters parameters_fragment;
51
52 bool from_proc_self_mountinfo:1;
53 bool from_fragment:1;
54
6e866b33 55 MountProcFlags proc_flags;
663996b3 56
e842803a
MB
57 bool sloppy_options;
58
8a584da2
MP
59 bool lazy_unmount;
60 bool force_unmount;
61
663996b3
MS
62 MountResult result;
63 MountResult reload_result;
64
65 mode_t directory_mode;
66
67 usec_t timeout_usec;
68
69 ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
14228c0d 70
663996b3
MS
71 ExecContext exec_context;
72 KillContext kill_context;
14228c0d 73 CGroupContext cgroup_context;
663996b3 74
60f067b4 75 ExecRuntime *exec_runtime;
8a584da2 76 DynamicCreds dynamic_creds;
60f067b4 77
663996b3
MS
78 MountState state, deserialized_state;
79
80 ExecCommand* control_command;
81 MountExecCommand control_command_id;
82 pid_t control_pid;
83
60f067b4 84 sd_event_source *timer_event_source;
e735f4d4
MP
85
86 unsigned n_retry_umount;
663996b3
MS
87};
88
89extern const UnitVTable mount_vtable;
90
91void mount_fd_event(Manager *m, int events);
92
663996b3
MS
93const char* mount_exec_command_to_string(MountExecCommand i) _const_;
94MountExecCommand mount_exec_command_from_string(const char *s) _pure_;
95
96const char* mount_result_to_string(MountResult i) _const_;
97MountResult mount_result_from_string(const char *s) _pure_;
b012e921
MB
98
99DEFINE_CAST(MOUNT, Mount);