2020-11-09 05:23:58 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
2015-01-09 22:58:29 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stddef.h>
|
2015-10-26 18:43:29 +01:00
|
|
|
|
2015-01-11 06:04:00 +01:00
|
|
|
#include "macro.h"
|
2015-01-09 22:58:29 +01:00
|
|
|
|
2020-03-30 10:39:21 +02:00
|
|
|
bool fstab_is_extrinsic(const char *mount, const char *opts);
|
2017-06-27 09:52:12 +02:00
|
|
|
int fstab_is_mount_point(const char *mount);
|
2017-06-26 15:22:10 +02:00
|
|
|
int fstab_has_fstype(const char *fstype);
|
2015-10-26 18:43:29 +01:00
|
|
|
|
|
|
|
int fstab_filter_options(const char *opts, const char *names, const char **namefound, char **value, char **filtered);
|
2015-01-09 22:58:29 +01:00
|
|
|
|
2015-05-18 12:30:37 +02:00
|
|
|
int fstab_extract_values(const char *opts, const char *name, char ***values);
|
|
|
|
|
2015-01-09 22:58:29 +01:00
|
|
|
static inline bool fstab_test_option(const char *opts, const char *names) {
|
|
|
|
return !!fstab_filter_options(opts, names, NULL, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
int fstab_find_pri(const char *options, int *ret);
|
2015-01-11 06:04:00 +01:00
|
|
|
|
|
|
|
static inline bool fstab_test_yes_no_option(const char *opts, const char *yes_no) {
|
|
|
|
const char *opt;
|
|
|
|
|
|
|
|
/* If first name given is last, return 1.
|
|
|
|
* If second name given is last or neither is found, return 0. */
|
|
|
|
|
2019-03-27 14:28:24 +01:00
|
|
|
assert_se(fstab_filter_options(opts, yes_no, &opt, NULL, NULL) >= 0);
|
2015-01-11 06:04:00 +01:00
|
|
|
|
|
|
|
return opt == yes_no;
|
|
|
|
}
|
2015-10-26 18:43:29 +01:00
|
|
|
|
|
|
|
char *fstab_node_to_udev_node(const char *p);
|
2019-11-13 17:36:46 +01:00
|
|
|
|
|
|
|
static inline const char* fstab_path(void) {
|
|
|
|
return secure_getenv("SYSTEMD_FSTAB") ?: "/etc/fstab";
|
|
|
|
}
|