]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/core/mount.h
Merge pull request #1428 from franciozzy/tagenhance
[thirdparty/systemd.git] / src / core / mount.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 typedef struct Mount Mount;
25
26 #include "kill.h"
27 #include "execute.h"
28
29 typedef enum MountExecCommand {
30 MOUNT_EXEC_MOUNT,
31 MOUNT_EXEC_UNMOUNT,
32 MOUNT_EXEC_REMOUNT,
33 _MOUNT_EXEC_COMMAND_MAX,
34 _MOUNT_EXEC_COMMAND_INVALID = -1
35 } MountExecCommand;
36
37 typedef enum MountResult {
38 MOUNT_SUCCESS,
39 MOUNT_FAILURE_RESOURCES,
40 MOUNT_FAILURE_TIMEOUT,
41 MOUNT_FAILURE_EXIT_CODE,
42 MOUNT_FAILURE_SIGNAL,
43 MOUNT_FAILURE_CORE_DUMP,
44 _MOUNT_RESULT_MAX,
45 _MOUNT_RESULT_INVALID = -1
46 } MountResult;
47
48 typedef struct MountParameters {
49 char *what;
50 char *options;
51 char *fstype;
52 } MountParameters;
53
54 struct Mount {
55 Unit meta;
56
57 char *where;
58
59 MountParameters parameters_proc_self_mountinfo;
60 MountParameters parameters_fragment;
61
62 bool from_proc_self_mountinfo:1;
63 bool from_fragment:1;
64
65 /* Used while looking for mount points that vanished or got
66 * added from/to /proc/self/mountinfo */
67 bool is_mounted:1;
68 bool just_mounted:1;
69 bool just_changed:1;
70
71 bool reset_cpu_usage:1;
72
73 bool sloppy_options;
74
75 MountResult result;
76 MountResult reload_result;
77
78 mode_t directory_mode;
79
80 usec_t timeout_usec;
81
82 ExecCommand exec_command[_MOUNT_EXEC_COMMAND_MAX];
83
84 ExecContext exec_context;
85 KillContext kill_context;
86 CGroupContext cgroup_context;
87
88 ExecRuntime *exec_runtime;
89
90 MountState state, deserialized_state;
91
92 ExecCommand* control_command;
93 MountExecCommand control_command_id;
94 pid_t control_pid;
95
96 sd_event_source *timer_event_source;
97
98 unsigned n_retry_umount;
99 };
100
101 extern const UnitVTable mount_vtable;
102
103 void mount_fd_event(Manager *m, int events);
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_;