]> err.no Git - util-linux/commitdiff
fsck: link with generic fsprobe wrapper
authorKarel Zak <kzak@redhat.com>
Wed, 18 Feb 2009 14:25:50 +0000 (15:25 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 18 Feb 2009 14:25:50 +0000 (15:25 +0100)
This is a way how link fsck with libblkid (e2sprogs or util-linxu-ng
version) and libvolume_id.

Signed-off-by: Karel Zak <kzak@redhat.com>
fsck/Makefile.am
fsck/fsck.c

index 7f9d4ea1c5914870a3d116044d9a96a47b48ba37..abe6d5c3fdd451f0558987633efe844b41b6c176 100644 (file)
@@ -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
index c3f0d6a93b92b2bde52465096f06c802095577cd..3d4a6c791d18b6cbb2b448993a1ac9989f3b4642 100644 (file)
@@ -44,7 +44,7 @@
 #include <malloc.h>
 #include <signal.h>
 
-#include <blkid.h>
+#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;
 }