lsblk: init/deinit libmount stuff

Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2018-09-14 15:45:53 +02:00
parent cfb715ed1d
commit e0c016f11b
3 changed files with 18 additions and 0 deletions

View File

@ -109,3 +109,15 @@ char *get_device_mountpoint(struct blkdev_cxt *cxt)
cxt->is_mounted = 1; cxt->is_mounted = 1;
return cxt->mountpoint; return cxt->mountpoint;
} }
void lsblk_mnt_init(void)
{
mnt_init_debug(0);
}
void lsblk_mnt_deinit(void)
{
mnt_unref_table(mtab);
mnt_unref_table(swaps);
mnt_unref_cache(mntcache);
}

View File

@ -1867,6 +1867,7 @@ int main(int argc, char *argv[])
lsblk->sort_hidden = 1; lsblk->sort_hidden = 1;
} }
lsblk_mnt_init();
scols_init_debug(0); scols_init_debug(0);
ul_path_init_debug(); ul_path_init_debug();
@ -1958,5 +1959,6 @@ leave:
#ifdef HAVE_LIBUDEV #ifdef HAVE_LIBUDEV
udev_unref(udev); udev_unref(udev);
#endif #endif
lsblk_mnt_deinit();
return status; return status;
} }

View File

@ -92,6 +92,10 @@ struct blkdev_cxt {
unsigned int is_mounted : 1; unsigned int is_mounted : 1;
}; };
extern void lsblk_mnt_init(void);
extern void lsblk_mnt_deinit(void);
extern char *get_device_mountpoint(struct blkdev_cxt *cxt); extern char *get_device_mountpoint(struct blkdev_cxt *cxt);
#endif /* UTIL_LINUX_LSBLK_H */ #endif /* UTIL_LINUX_LSBLK_H */