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])
#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>
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;
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;