]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/fstab-util.h
Merge pull request #8575 from keszybz/non-absolute-paths
[thirdparty/systemd.git] / src / shared / fstab-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2015 Zbigniew Jędrzejewski-Szmek
8 ***/
9
10 #include <stdbool.h>
11 #include <stddef.h>
12
13 #include "macro.h"
14
15 int fstab_is_mount_point(const char *mount);
16 int fstab_has_fstype(const char *fstype);
17
18 int fstab_filter_options(const char *opts, const char *names, const char **namefound, char **value, char **filtered);
19
20 int fstab_extract_values(const char *opts, const char *name, char ***values);
21
22 static inline bool fstab_test_option(const char *opts, const char *names) {
23 return !!fstab_filter_options(opts, names, NULL, NULL, NULL);
24 }
25
26 int fstab_find_pri(const char *options, int *ret);
27
28 static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no) {
29 int r;
30 const char *opt;
31
32 /* If first name given is last, return 1.
33 * If second name given is last or neither is found, return 0. */
34
35 r = fstab_filter_options(opts, yes_no, &opt, NULL, NULL);
36 assert(r >= 0);
37
38 return opt == yes_no;
39 }
40
41 char *fstab_node_to_udev_node(const char *p);