1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
4 typedef struct Mount Mount
;
6 #include "dynamic-user.h"
11 typedef enum MountExecCommand
{
15 _MOUNT_EXEC_COMMAND_MAX
,
16 _MOUNT_EXEC_COMMAND_INVALID
= -EINVAL
,
19 typedef enum MountResult
{
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
,
25 MOUNT_FAILURE_CORE_DUMP
,
26 MOUNT_FAILURE_START_LIMIT_HIT
,
27 MOUNT_FAILURE_PROTOCOL
,
29 _MOUNT_RESULT_INVALID
= -EINVAL
,
32 typedef struct MountParameters
{
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,
50 MountParameters parameters_proc_self_mountinfo
;
51 MountParameters parameters_fragment
;
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;
58 MountProcFlags proc_flags
;
68 MountResult reload_result
;
69 MountResult clean_result
;
71 mode_t directory_mode
;
75 ExecCommand exec_command
[_MOUNT_EXEC_COMMAND_MAX
];
77 ExecContext exec_context
;
78 KillContext kill_context
;
79 CGroupContext cgroup_context
;
81 ExecRuntime
*exec_runtime
;
82 CGroupRuntime
*cgroup_runtime
;
84 MountState state
, deserialized_state
;
86 ExecCommand
* control_command
;
87 MountExecCommand control_command_id
;
90 sd_event_source
*timer_event_source
;
92 unsigned n_retry_umount
;
95 extern const UnitVTable mount_vtable
;
97 void mount_fd_event(Manager
*m
, int events
);
99 int mount_invalidate_state_by_path(Manager
*manager
, const char *path
);
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
);
105 const char* mount_exec_command_to_string(MountExecCommand i
) _const_
;
106 MountExecCommand
mount_exec_command_from_string(const char *s
) _pure_
;
108 const char* mount_result_to_string(MountResult i
) _const_
;
109 MountResult
mount_result_from_string(const char *s
) _pure_
;
111 DEFINE_CAST(MOUNT
, Mount
);