]> git.proxmox.com Git - systemd.git/blame - src/shared/fstab-util.h
Merge tag 'upstream/229'
[systemd.git] / src / shared / fstab-util.h
CommitLineData
e735f4d4
MP
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>
db2df898 24
e735f4d4
MP
25#include "macro.h"
26
6300502b 27bool fstab_is_mount_point(const char *mount);
db2df898
MP
28
29int fstab_filter_options(const char *opts, const char *names, const char **namefound, char **value, char **filtered);
e735f4d4 30
e3bff60a
MP
31int fstab_extract_values(const char *opts, const char *name, char ***values);
32
e735f4d4
MP
33static inline bool fstab_test_option(const char *opts, const char *names) {
34 return !!fstab_filter_options(opts, names, NULL, NULL, NULL);
35}
36
37int fstab_find_pri(const char *options, int *ret);
38
39static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no) {
40 int r;
41 const char *opt;
42
43 /* If first name given is last, return 1.
44 * If second name given is last or neither is found, return 0. */
45
46 r = fstab_filter_options(opts, yes_no, &opt, NULL, NULL);
47 assert(r >= 0);
48
49 return opt == yes_no;
50}
db2df898
MP
51
52char *fstab_node_to_udev_node(const char *p);