]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/fstab-util.h
Merge pull request #7388 from keszybz/doc-tweak
[thirdparty/systemd.git] / src / shared / fstab-util.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2015 Zbigniew Jędrzejewski-Szmek
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #include <stdbool.h>
23 #include <stddef.h>
24
25 #include "macro.h"
26
27 int fstab_is_mount_point(const char *mount);
28 int fstab_has_fstype(const char *fstype);
29
30 int fstab_filter_options(const char *opts, const char *names, const char **namefound, char **value, char **filtered);
31
32 int fstab_extract_values(const char *opts, const char *name, char ***values);
33
34 static inline bool fstab_test_option(const char *opts, const char *names) {
35 return !!fstab_filter_options(opts, names, NULL, NULL, NULL);
36 }
37
38 int fstab_find_pri(const char *options, int *ret);
39
40 static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no) {
41 int r;
42 const char *opt;
43
44 /* If first name given is last, return 1.
45 * If second name given is last or neither is found, return 0. */
46
47 r = fstab_filter_options(opts, yes_no, &opt, NULL, NULL);
48 assert(r >= 0);
49
50 return opt == yes_no;
51 }
52
53 char *fstab_node_to_udev_node(const char *p);