From 06cb26d93cd80392808569cd1e82bbc8d07c6470 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Wed, 18 Feb 2009 15:25:50 +0100 Subject: fsck: link with generic fsprobe wrapper This is a way how link fsck with libblkid (e2sprogs or util-linxu-ng version) and libvolume_id. Signed-off-by: Karel Zak --- fsck/Makefile.am | 13 ++++++++++++- fsck/fsck.c | 13 ++++++------- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'fsck') diff --git a/fsck/Makefile.am b/fsck/Makefile.am index 7f9d4ea1..abe6d5c3 100644 --- a/fsck/Makefile.am +++ b/fsck/Makefile.am @@ -3,11 +3,22 @@ include $(top_srcdir)/config/include-Makefile.am sbin_PROGRAMS = fsck dist_man_MANS = fsck.8 -fsck_SOURCES = base_device.c fsck.c fsck.h ../lib/ismounted.c +fsck_SOURCES = base_device.c fsck.c fsck.h ../lib/ismounted.c \ + ../lib/fsprobe.c ../lib/canonicalize.c fsck_LDADD = fsck_CFLAGS = if HAVE_BLKID +if BUILD_LIBBLKID +fsck_LDADD += $(ul_libblkid_la) +fsck_CFLAGS += -I$(ul_libblkid_srcdir) +else fsck_LDADD += $(BLKID_LIBS) fsck_CFLAGS += $(BLKID_CFLAGS) endif +endif + +if HAVE_VOLUME_ID +fsck_LDADD += $(VOLUME_ID_LIBS) +fsck_CFLAGS += $(VOLUME_ID_CFLAGS) +endif diff --git a/fsck/fsck.c b/fsck/fsck.c index c3f0d6a9..3d4a6c79 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -44,7 +44,7 @@ #include #include -#include +#include "fsprobe.h" #include "nls.h" #include "pathnames.h" @@ -107,7 +107,6 @@ struct fs_info *filesys_info = NULL, *filesys_last = NULL; struct fsck_instance *instance_list; const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc"; char *fsck_path = 0; -blkid_cache cache = NULL; static char *string_copy(const char *s) { @@ -285,7 +284,7 @@ static int parse_fstab_line(char *line, struct fs_info **ret_fs) parse_escape(freq); parse_escape(passno); - dev = blkid_get_devname(cache, device, NULL); + dev = fsprobe_get_devname_by_spec(device); if (dev) device = dev; @@ -310,7 +309,7 @@ static void interpret_type(struct fs_info *fs) if (strcmp(fs->type, "auto") != 0) return; - t = blkid_get_tag_value(cache, "TYPE", fs->device); + t = fsprobe_get_fstype_by_devname(fs->device); if (t) { free(fs->type); fs->type = t; @@ -1105,7 +1104,7 @@ static void PRS(int argc, char *argv[]) progname); exit(EXIT_ERROR); } - dev = blkid_get_devname(cache, arg, NULL); + dev = fsprobe_get_devname_by_spec(arg); if (!dev && strchr(arg, '=')) { /* * Check to see if we failed because @@ -1250,7 +1249,7 @@ int main(int argc, char *argv[]) bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - blkid_get_cache(&cache, NULL); + fsprobe_init(); PRS(argc, argv); if (!notitle) @@ -1321,6 +1320,6 @@ int main(int argc, char *argv[]) } status |= wait_many(FLAG_WAIT_ALL); free(fsck_path); - blkid_put_cache(cache); + fsprobe_exit(); return status; } -- cgit v1.2.3