chiark / gitweb /
5088dad930031f7b62a9eedd2f0bcd0857be0172
[elogind.git] / src / basic / mount-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5   This file is part of systemd.
6
7   Copyright 2010 Lennart Poettering
8
9   systemd is free software; you can redistribute it and/or modify it
10   under the terms of the GNU Lesser General Public License as published by
11   the Free Software Foundation; either version 2.1 of the License, or
12   (at your option) any later version.
13
14   systemd is distributed in the hope that it will be useful, but
15   WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17   Lesser General Public License for more details.
18
19   You should have received a copy of the GNU Lesser General Public License
20   along with systemd; If not, see <http://www.gnu.org/licenses/>.
21 ***/
22
23 #include <fcntl.h>
24 #include <mntent.h>
25 #include <stdbool.h>
26 #include <stdio.h>
27 #include <sys/stat.h>
28 #include <sys/types.h>
29
30 #include "macro.h"
31 #include "missing.h"
32
33 int name_to_handle_at_loop(int fd, const char *path, struct file_handle **ret_handle, int *ret_mnt_id, int flags);
34
35 int path_get_mnt_id(const char *path, int *ret);
36
37 int fd_is_mount_point(int fd, const char *filename, int flags);
38 int path_is_mount_point(const char *path, const char *root, int flags);
39
40 #if 0 /// UNNEEDED by elogind
41 int repeat_unmount(const char *path, int flags);
42
43 int umount_recursive(const char *target, int flags);
44 int bind_remount_recursive(const char *prefix, bool ro, char **blacklist);
45 int bind_remount_recursive_with_mountinfo(const char *prefix, bool ro, char **blacklist, FILE *proc_self_mountinfo);
46
47 int mount_move_root(const char *path);
48 #endif // 0
49
50 DEFINE_TRIVIAL_CLEANUP_FUNC(FILE*, endmntent);
51 #define _cleanup_endmntent_ _cleanup_(endmntentp)
52
53 #if 0 /// UNNEEDED by elogind
54 bool fstype_is_network(const char *fstype);
55 #endif // 0
56 bool fstype_is_api_vfs(const char *fstype);
57 bool fstype_is_ro(const char *fsype);
58 bool fstype_can_discard(const char *fstype);
59 bool fstype_can_uid_gid(const char *fstype);
60
61 const char* mode_to_inaccessible_node(mode_t mode);
62
63 #if 0 /// UNNEEDED by elogind
64 int mount_verbose(
65                 int error_log_level,
66                 const char *what,
67                 const char *where,
68                 const char *type,
69                 unsigned long flags,
70                 const char *options);
71 int umount_verbose(const char *where);
72 #endif // 0
73
74 const char *mount_propagation_flags_to_string(unsigned long flags);
75 int mount_propagation_flags_from_string(const char *name, unsigned long *ret);
76
77 int mount_option_mangle(
78                 const char *options,
79                 unsigned long mount_flags,
80                 unsigned long *ret_mount_flags,
81                 char **ret_remaining_options);