libmount-util: build .c only if libmount feature is enabled

Follow-up for 7336f2c748

This alignes with some other optional modules in shraed/,
and it allows dlopen_libmount() to be optimized out entirely.
Let's avoid emitting pointless symbols.
This commit is contained in:
Mike Yuan
2025-11-26 02:40:28 +01:00
parent 46b4b33c25
commit 38b59a83d2
3 changed files with 19 additions and 18 deletions
+1 -10
View File
@@ -1,11 +1,9 @@
/* 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;
@@ -41,10 +39,8 @@ DLSYM_PROTOTYPE(mnt_table_parse_mtab) = 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,
@@ -85,12 +81,8 @@ int dlopen_libmount(void) {
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,
@@ -159,4 +151,3 @@ int libmount_is_leaf(
return r == 1;
}
#endif