/* SPDX-License-Identifier: LGPL-2.1-or-later */
-#include "libmount-util.h"
-
-#if HAVE_LIBMOUNT
#include <stdio.h>
#include "fstab-util.h"
+#include "libmount-util.h"
#include "log.h"
static void *libmount_dl = NULL;
DLSYM_PROTOTYPE(mnt_table_parse_stream) = NULL;
DLSYM_PROTOTYPE(mnt_table_parse_swaps) = NULL;
DLSYM_PROTOTYPE(mnt_unref_monitor) = NULL;
-#endif
int dlopen_libmount(void) {
-#if HAVE_LIBMOUNT
ELF_NOTE_DLOPEN("mount",
"Support for mount enumeration",
ELF_NOTE_DLOPEN_PRIORITY_RECOMMENDED,
DLSYM_ARG(mnt_table_parse_stream),
DLSYM_ARG(mnt_table_parse_swaps),
DLSYM_ARG(mnt_unref_monitor));
-#else
- return -EOPNOTSUPP;
-#endif
}
-#if HAVE_LIBMOUNT
int libmount_parse_full(
const char *path,
FILE *source,
return r == 1;
}
-#endif
extern DLSYM_PROTOTYPE(mnt_table_parse_swaps);
extern DLSYM_PROTOTYPE(mnt_unref_monitor);
+int dlopen_libmount(void);
+
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct libmnt_table*, sym_mnt_free_table, mnt_free_tablep, NULL);
DEFINE_TRIVIAL_CLEANUP_FUNC_FULL_RENAME(struct libmnt_iter*, sym_mnt_free_iter, mnt_free_iterp, NULL);
FILE *source,
struct libmnt_table **ret_table,
struct libmnt_iter **ret_iter) {
+
return libmount_parse_full("/proc/self/mountinfo", source, MNT_ITER_FORWARD, ret_table, ret_iter);
}
static inline int libmount_parse_with_utab(
struct libmnt_table **ret_table,
struct libmnt_iter **ret_iter) {
+
return libmount_parse_full(NULL, NULL, MNT_ITER_FORWARD, ret_table, ret_iter);
}
int libmount_is_leaf(
struct libmnt_table *table,
struct libmnt_fs *fs);
+
#else
struct libmnt_monitor;
-static inline void *sym_mnt_unref_monitor(struct libmnt_monitor *p) {
+static inline int dlopen_libmount(void) {
+ return -EOPNOTSUPP;
+}
+
+static inline void* sym_mnt_unref_monitor(struct libmnt_monitor *p) {
assert(p == NULL);
return NULL;
}
#endif
-
-int dlopen_libmount(void);
'libaudit-util.c',
'libcrypt-util.c',
'libfido2-util.c',
- 'libmount-util.c',
'local-addresses.c',
'locale-setup.c',
'log-assert-critical.c',
'xml.c',
)
-if conf.get('ENABLE_NSS') == 1
- shared_sources += files('nss-util.c')
-endif
-
if get_option('tests') != 'false'
shared_sources += files('tests.c')
endif
generated_sources += syscall_list_inc
shared_sources += syscall_list_inc
+if conf.get('ENABLE_NSS') == 1
+ shared_sources += files('nss-util.c')
+endif
+
if conf.get('ENABLE_UTMP') == 1
shared_sources += files('utmp-wtmp.c')
endif
shared_sources += files('pam-util.c')
endif
+if conf.get('HAVE_LIBMOUNT') == 1
+ shared_sources += files('libmount-util.c')
+endif
+
generate_ip_protocol_list = files('generate-ip-protocol-list.sh')
ip_protocol_list_txt = custom_target(
input : [generate_ip_protocol_list, ipproto_sources],