]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
d15d0333 ZJS |
2 | #pragma once |
3 | ||
d15d0333 ZJS |
4 | #include <stdbool.h> |
5 | #include <stddef.h> | |
6550203e | 6 | |
b9f111b9 | 7 | #include "macro.h" |
d15d0333 | 8 | |
1177373b YW |
9 | bool fstab_enabled_full(int enabled); |
10 | static inline bool fstab_enabled(void) { | |
11 | return fstab_enabled_full(-1); | |
12 | } | |
13 | static inline bool fstab_set_enabled(bool enabled) { | |
14 | return fstab_enabled_full(enabled); | |
15 | } | |
16 | ||
bc9e5a4c | 17 | bool fstab_is_extrinsic(const char *mount, const char *opts); |
6c1921e9 | 18 | int fstab_has_fstype(const char *fstype); |
6550203e | 19 | |
99299d0d MY |
20 | int fstab_is_mount_point_full(const char *where, const char *path); |
21 | static inline int fstab_is_mount_point(const char *where) { | |
22 | return fstab_is_mount_point_full(where, NULL); | |
23 | } | |
24c0078a MY |
24 | static inline int fstab_has_node(const char *path) { |
25 | return fstab_is_mount_point_full(NULL, path); | |
26 | } | |
99299d0d | 27 | |
ff0c31bc ZJS |
28 | int fstab_filter_options( |
29 | const char *opts, | |
30 | const char *names, | |
31 | const char **ret_namefound, | |
32 | char **ret_value, | |
33 | char ***ret_values, | |
34 | char **ret_filtered); | |
d15d0333 | 35 | static inline bool fstab_test_option(const char *opts, const char *names) { |
5d193883 | 36 | return fstab_filter_options(opts, names, NULL, NULL, NULL, NULL); |
d15d0333 | 37 | } |
b9f111b9 | 38 | static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no) { |
5d193883 | 39 | const char *opt_found; |
b9f111b9 ZJS |
40 | |
41 | /* If first name given is last, return 1. | |
42 | * If second name given is last or neither is found, return 0. */ | |
43 | ||
5d193883 | 44 | assert_se(fstab_filter_options(opts, yes_no, &opt_found, NULL, NULL, NULL) >= 0); |
b9f111b9 | 45 | |
5d193883 | 46 | return opt_found == yes_no; |
b9f111b9 | 47 | } |
5d193883 | 48 | int fstab_find_pri(const char *opts, int *ret); |
6550203e LP |
49 | |
50 | char *fstab_node_to_udev_node(const char *p); | |
ed4ad488 ZJS |
51 | |
52 | static inline const char* fstab_path(void) { | |
53 | return secure_getenv("SYSTEMD_FSTAB") ?: "/etc/fstab"; | |
54 | } | |
35df78cd MY |
55 | |
56 | bool fstab_is_bind(const char *options, const char *fstype); |