25 #include <libmount/libmount.h>
29 static struct libmnt_context *
cxt = NULL;
30 static struct libmnt_table *
tb = NULL;
31 static struct libmnt_iter *
itr = NULL;
41 cxt = mnt_new_context();
43 fprintf(stderr,
"Cannot retrieve context.\n");
46 if (mnt_context_get_mtab(
cxt, &
tb) ||
tb == NULL) {
47 fprintf(stderr,
"Cannot parse mtab.\n");
50 itr = mnt_new_iter(MNT_ITER_FORWARD);
66 if (0 == mnt_table_next_fs(
tb,
itr, &fs)) {
67 *dir = mnt_fs_get_target(fs);
68 *type = mnt_fs_get_fstype(fs);
83 mnt_free_context(
cxt);
static struct libmnt_iter * itr
static struct libmnt_context * cxt
static struct libmnt_table * tb
int listmountnext(const char **dir, const char **type)