#include <signal.h>
#include <dirent.h>
#include <blkid.h>
-
-#include "fsprobe.h"
#include <libmount.h>
#include "nls.h"
/* parsed fstab */
static struct libmnt_table *fstab;
+static struct libmnt_cache *mntcache;
static int count_slaves(dev_t disk);
{
const char *path;
- mnt_init_debug(0);
-
fstab = mnt_new_table();
if (!fstab)
err(FSCK_EX_ERROR, ("failed to initialize libmount table"));
mnt_table_set_parser_errcb(fstab, parser_errcb);
- mnt_table_set_cache(fstab, mnt_new_cache());
+ mnt_table_set_cache(fstab, mntcache);
errno = 0;
}
}
-/* Lookup filesys in /etc/fstab and return the corresponding entry. */
-static struct libmnt_fs *lookup(char *spec)
+/*
+ * Lookup filesys in /etc/fstab and return the corresponding entry.
+ * The @path has to be real path (no TAG) by mnt_resolve_spec().
+ */
+static struct libmnt_fs *lookup(char *path)
{
struct libmnt_fs *fs;
- if (!spec)
+ if (!path)
return NULL;
- fs = mnt_table_find_source(fstab, spec, MNT_ITER_FORWARD);
+ fs = mnt_table_find_srcpath(fstab, path, MNT_ITER_FORWARD);
if (!fs)
- fs = mnt_table_find_target(fstab, spec, MNT_ITER_FORWARD);
+ fs = mnt_table_find_target(fstab, path, MNT_ITER_FORWARD);
return fs;
}
if ((arg[0] == '/' && !opts_for_fsck) || strchr(arg, '=')) {
if (num_devices >= MAX_DEVICES)
errx(FSCK_EX_ERROR, _("too many devices"));
- dev = fsprobe_get_devname_by_spec(arg);
+
+ dev = mnt_resolve_spec(arg, mntcache);
+
if (!dev && strchr(arg, '=')) {
/*
* Check to see if we failed because
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- fsprobe_init();
+ mnt_init_debug(0); /* init libmount debug mask */
+ mntcache = mnt_new_cache(); /* no fatal error if failed */
+
PRS(argc, argv);
if (!notitle)
}
status |= wait_many(FLAG_WAIT_ALL);
free(fsck_path);
- fsprobe_exit();
- mnt_free_cache(mnt_table_get_cache(fstab));
+ mnt_free_cache(mntcache);
mnt_free_table(fstab);
return status;
}