]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/fstab-util.h
59d909d44f6112fab83813728c8a720815247cf4
[thirdparty/systemd.git] / src / shared / fstab-util.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "forward.h"
5
6 bool fstab_enabled_full(int enabled);
7 static inline bool fstab_enabled(void) {
8 return fstab_enabled_full(-1);
9 }
10 static inline bool fstab_set_enabled(bool enabled) {
11 return fstab_enabled_full(enabled);
12 }
13
14 bool fstab_is_extrinsic(const char *mount, const char *opts);
15 int fstab_has_fstype(const char *fstype);
16
17 int fstab_is_mount_point_full(const char *where, const char *path);
18 static inline int fstab_is_mount_point(const char *where) {
19 return fstab_is_mount_point_full(where, NULL);
20 }
21 static inline int fstab_has_node(const char *path) {
22 return fstab_is_mount_point_full(NULL, path);
23 }
24
25 int fstab_has_mount_point_prefix_strv(char * const *prefixes);
26
27 int fstab_filter_options(
28 const char *opts,
29 const char *names,
30 const char **ret_namefound,
31 char **ret_value,
32 char ***ret_values,
33 char **ret_filtered);
34 static inline bool fstab_test_option(const char *opts, const char *names) {
35 return fstab_filter_options(opts, names, NULL, NULL, NULL, NULL);
36 }
37 static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no) {
38 const char *opt_found;
39
40 /* If first name given is last, return 1.
41 * If second name given is last or neither is found, return 0. */
42
43 assert_se(fstab_filter_options(opts, yes_no, &opt_found, NULL, NULL, NULL) >= 0);
44
45 return opt_found == yes_no;
46 }
47 int fstab_find_pri(const char *opts, int *ret);
48
49 char* fstab_node_to_udev_node(const char *p);
50
51 const char* fstab_path(void);
52
53 bool fstab_is_bind(const char *options, const char *fstype);