From: Michael Tremer Date: Sun, 5 Nov 2023 18:37:02 +0000 (+0000) Subject: libpakfire: Drop using libmount X-Git-Tag: 0.9.30~1299 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=409b78413d4da9a5e86b5cf4c1bfaaaaabaec28a;p=pakfire.git libpakfire: Drop using libmount Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index a113ea4ff..20e7beb05 100644 --- a/Makefile.am +++ b/Makefile.am @@ -317,7 +317,6 @@ libpakfire_la_CFLAGS = \ $(JSON_C_CFLAGS) \ $(KRB5_CFLAGS) \ $(MAGIC_CFLAGS) \ - $(MOUNT_CFLAGS) \ $(NL3_CFLAGS) \ $(NL3_ROUTE_CFLAGS) \ $(OPENSSL_CFLAGS) \ @@ -351,7 +350,6 @@ libpakfire_la_LIBADD = \ $(KRB5_LIBS) \ $(LZMA_LIBS) \ $(MAGIC_LIBS) \ - $(MOUNT_LIBS) \ $(NL3_LIBS) \ $(NL3_ROUTE_LIBS) \ $(OPENSSL_LIBS) \ diff --git a/configure.ac b/configure.ac index 8bf8dc96a..204556a80 100644 --- a/configure.ac +++ b/configure.ac @@ -291,7 +291,6 @@ PKG_CHECK_MODULES([JSON_C], [json-c >= 0.15]) PKG_CHECK_MODULES([KRB5], [krb5]) PKG_CHECK_MODULES([LZMA], [liblzma]) PKG_CHECK_MODULES([MAGIC], [libmagic]) -PKG_CHECK_MODULES([MOUNT], [mount]) PKG_CHECK_MODULES([NL3], [libnl-3.0]) PKG_CHECK_MODULES([NL3_ROUTE], [libnl-route-3.0]) PKG_CHECK_MODULES([OPENSSL], [openssl >= 1.1.1]) diff --git a/src/libpakfire/mount.c b/src/libpakfire/mount.c index 1f248468b..c8397253f 100644 --- a/src/libpakfire/mount.c +++ b/src/libpakfire/mount.c @@ -26,9 +26,6 @@ #include #include -// libmount -#include - #include #include #include @@ -189,58 +186,6 @@ int pakfire_mount_make_mounpoint(struct pakfire* pakfire, const char* path) { return 0; } -/* - Easy way to iterate through all mountpoints -*/ -static int pakfire_mount_foreach(struct pakfire* pakfire, int direction, - int (*callback)(struct pakfire* pakfire, struct libmnt_fs* fs, const void* data), - const void* data) { - const char* root = pakfire_get_path(pakfire); - int r = 0; - - struct libmnt_iter* iterator = NULL; - struct libmnt_table* tab = NULL; - struct libmnt_fs* fs = NULL; - - // Create an iterator - iterator = mnt_new_iter(direction); - if (!iterator) { - ERROR(pakfire, "Could not setup iterator: %m\n"); - goto ERROR; - } - - // Read /proc/mounts - tab = mnt_new_table_from_file("/proc/mounts"); - if (!tab) { - ERROR(pakfire, "Could not open /proc/mounts: %m\n"); - goto ERROR; - } - - while (mnt_table_next_fs(tab, iterator, &fs) == 0) { - const char* target = mnt_fs_get_target(fs); - - // Ignore any mointpoints that don't belong to us - if (!pakfire_string_startswith(target, root)) - continue; - - // Call the callback for each relevant mountpoint - r = callback(pakfire, fs, data); - if (r) - break; - } - -ERROR: - // Tidy up - if (fs) - mnt_unref_fs(fs); - if (tab) - mnt_unref_table(tab); - if (iterator) - mnt_free_iter(iterator); - - return r; -} - static int pakfire_mount(struct pakfire* pakfire, const char* source, const char* target, const char* fstype, unsigned long mflags, const void* data) { const char* options = (const char*)data; @@ -262,19 +207,6 @@ static int pakfire_mount(struct pakfire* pakfire, const char* source, const char return r; } -static int __pakfire_mount_print(struct pakfire* pakfire, - struct libmnt_fs* fs, const void* data) { - DEBUG(pakfire, - " %s %s %s %s\n", - mnt_fs_get_source(fs), - mnt_fs_get_target(fs), - mnt_fs_get_fstype(fs), - mnt_fs_get_fs_options(fs) - ); - - return 0; -} - static int __pakfire_mount_list(char* line, size_t length, void* data) { struct pakfire_ctx* ctx = data;