]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: Drop using libmount
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 5 Nov 2023 18:37:02 +0000 (18:37 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 5 Nov 2023 18:37:02 +0000 (18:37 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
configure.ac
src/libpakfire/mount.c

index a113ea4ff76532fc309ab6a80b2d0dcaaac7cd09..20e7beb056bbd8146c955e7bc411c0722e5cc80f 100644 (file)
@@ -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) \
index 8bf8dc96a00ef60ef99a9980d07d32dd77860a62..204556a801e815dcf18fa4ffc6ab3b6f0fe57d35 100644 (file)
@@ -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])
index 1f248468bc21732ea0a9086cdbd543fc1a1a884c..c8397253fb2ffb22ff05fb68465c281e0c725b43 100644 (file)
@@ -26,9 +26,6 @@
 #include <sys/sysmacros.h>
 #include <sys/types.h>
 
-// libmount
-#include <libmount/libmount.h>
-
 #include <pakfire/arch.h>
 #include <pakfire/logging.h>
 #include <pakfire/pakfire.h>
@@ -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;