Index: util-linux-ng-2.12r+git20070330/mount/fstab.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/fstab.c
+++ util-linux-ng-2.12r+git20070330/mount/fstab.c
@@ -305,6 +305,7 @@ has_uuid(const char *device, const char 
 struct mntentchn *
 getfsspecfile (const char *spec, const char *file) {
 	struct mntentchn *mc, *mc0;
+	char *nspec;
 
 	mc0 = fstab_head();
 
@@ -315,11 +316,12 @@ getfsspecfile (const char *spec, const c
 			return mc;
 
 	/* second attempt: names found after symlink resolution */
+	nspec = canonicalize(spec);
 	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
 		if ((streq(mc->m.mnt_dir, file) ||
 		     streq(canonicalize(mc->m.mnt_dir), file))
 		    && (streq(mc->m.mnt_fsname, spec) ||
-			streq(canonicalize(mc->m.mnt_fsname), spec)))
+			streq(canonicalize(mc->m.mnt_fsname), nspec)))
 			return mc;
 
 	/* third attempt: names found after LABEL= or UUID= resolution */
@@ -356,11 +358,21 @@ getfsfile (const char *file) {
 struct mntentchn *
 getfsspec (const char *spec) {
 	struct mntentchn *mc, *mc0;
+	const char *nspec, *fsname;
 
 	mc0 = fstab_head();
-	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt)
-		if (streq(mc->m.mnt_fsname, spec))
+	for (mc = mc0->nxt; mc && mc != mc0; mc = mc->nxt) {
+		if (!strncmp (mc->m.mnt_fsname, "LABEL=", 6)) {
+			fsname = mount_get_devname_by_label(mc->m.mnt_fsname + 6);
+		} else if (!strncmp(mc->m.mnt_fsname, "UUID=", 5)) {
+			fsname = mount_get_devname_by_uuid(mc->m.mnt_fsname + 5);
+		} else {
+			fsname = mc->m.mnt_fsname;
+		}
+		nspec = canonicalize(fsname);
+		if (streq(nspec, spec))
 			return mc;
+	}
 	return NULL;
 }
 
@@ -723,6 +735,8 @@ char *progname;
 
 const char *mount_get_volume_label_by_spec(const char *spec) { return NULL; }
 const char *mount_get_devname_by_uuid(const char *uuid) { return NULL; }
+const char *mount_get_devname_by_label(const char *label) { return NULL; }
+const char *mount_get_volume_uuid_by_spec(const char *spec) { return NULL; }
 struct my_mntent *my_getmntent (mntFILE *mfp) { return NULL; }
 mntFILE *my_setmntent (const char *file, char *mode) { return NULL; }
 void my_endmntent (mntFILE *mfp) { }
Index: util-linux-ng-2.12r+git20070330/mount/mount.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/mount.c
+++ util-linux-ng-2.12r+git20070330/mount/mount.c
@@ -1746,6 +1746,8 @@ main(int argc, char *argv[]) {
 			if (mc == NULL)
 				mc = getfsspec (spec);
 			if (mc == NULL)
+				mc = getfsspec (canonicalize(spec));
+			if (mc == NULL)
 				die (EX_USAGE,
 				     _("mount: cannot find %s in %s"),
 				     spec, _PATH_FSTAB);
Index: util-linux-ng-2.12r+git20070330/mount/mount_blkid.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/mount_blkid.c
+++ util-linux-ng-2.12r+git20070330/mount/mount_blkid.c
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include "mount_blkid.h"
 
+#ifndef HAVE_LIBVOLUME_ID
 #ifdef HAVE_LIBBLKID
 
 blkid_cache blkid;
@@ -118,4 +119,5 @@ mount_get_devname_for_mounting(const cha
 }
 
 
-#endif
+#endif /* HAVE_LIBBLKID */
+#endif /* HAVE_LIBVOLUME_ID */
Index: util-linux-ng-2.12r+git20070330/mount/mount_blkid.h
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/mount_blkid.h
+++ util-linux-ng-2.12r+git20070330/mount/mount_blkid.h
@@ -11,3 +11,5 @@ extern const char *mount_get_volume_uuid
 extern const char *mount_get_volume_label_by_spec(const char *spec);
 extern const char *mount_get_devname(const char *spec);
 extern const char *mount_get_devname_for_mounting(const char *spec);
+
+extern const char *volume_id_get_tag(const char *spec, const char *token);
Index: util-linux-ng-2.12r+git20070330/mount/mount_by_label.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/mount_by_label.c
+++ util-linux-ng-2.12r+git20070330/mount/mount_by_label.c
@@ -1,4 +1,4 @@
-#ifndef HAVE_LIBBLKID
+#if (!defined HAVE_BLKID) && (!defined HAVE_LIBVOLUME_ID)
 /*
  * mount_by_label.c - aeb
  *
Index: util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.c
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/mount_guess_fstype.c
+++ util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.c
@@ -46,15 +46,29 @@
 #define ETC_FILESYSTEMS		"/etc/filesystems"
 #define PROC_FILESYSTEMS	"/proc/filesystems"
 
+#ifdef HAVE_LIBVOLUME_ID
+
+static int
+known_fstype(const char *fstype) {
+	return 0;
+}
+
+const char *
+do_guess_fstype(const char *spec)
+{
+	return volume_id_get_tag(spec, "TYPE");
+}
+
+#else
 #ifdef HAVE_LIBBLKID
 
-char *
+const char *
 do_guess_fstype(const char *device) 
 {
 	return blkid_get_tag_value(blkid, "TYPE", device);
 }
 
-static int
+const static int
 known_fstype(const char *fstype) 
 {
 	return blkid_known_fstype(fstype);
@@ -492,6 +506,7 @@ io_error:
 }
 
 #endif
+#endif
 
 static struct tried {
 	struct tried *next;
@@ -534,9 +549,9 @@ free_tested(void) {
 	tried = NULL;
 }
 
-char *
+const char *
 guess_fstype(const char *spec) {
-	char *type = do_guess_fstype(spec);
+	const char *type = do_guess_fstype(spec);
 	if (verbose) {
 	    printf (_("mount: you didn't specify a filesystem type for %s\n"),
 		    spec);
Index: util-linux-ng-2.12r+git20070330/mount/mount_udev.c
===================================================================
--- /dev/null
+++ util-linux-ng-2.12r+git20070330/mount/mount_udev.c
@@ -0,0 +1,237 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/mount.h>
+#include <sys/ioctl.h>
+#include <nls.h>
+#include <stddef.h>
+#include <libvolume_id.h>
+
+#include "mount_blkid.h"
+
+#ifdef HAVE_LIBVOLUME_ID
+
+extern int verbose;
+
+struct volume_id_types_t {
+	int id;
+	char *token;
+	char *env;
+};
+
+enum {
+	VOLUME_ID_NONE=0,
+	VOLUME_ID_TYPE,
+	VOLUME_ID_LABEL,
+	VOLUME_ID_UUID
+};
+
+#define volume_id_offset(member) (unsigned long)offsetof(struct volume_id,member)
+
+struct volume_id_types_t volume_id_types[] = {
+	{ VOLUME_ID_TYPE, "TYPE", "ID_FS_TYPE" },
+	{ VOLUME_ID_LABEL, "LABEL", "ID_FS_LABEL" },
+	{ VOLUME_ID_UUID, "UUID",  "ID_FS_UUID" },
+	{ VOLUME_ID_NONE, NULL, NULL },
+};
+
+const char *
+volume_id_get_tag(const char *spec, const char *token)
+{
+	struct volume_id *vid;
+	uint64_t size;
+	struct volume_id_types_t *volume_id_ptr = volume_id_types;
+	char *var, *value;
+
+	value = calloc(1, VOLUME_ID_LABEL_SIZE);
+	if (!value)
+		return NULL;
+
+	if (!spec)
+		return NULL;
+
+	while (volume_id_ptr->token && strcmp(volume_id_ptr->token,token))
+		volume_id_ptr++;
+
+	if (!volume_id_ptr->token) {
+		free(value);
+		value = NULL;
+		goto out;
+	}
+
+	/* Quick exit if ID_FS_* variables are set */
+	if ((var = getenv(volume_id_ptr->env))) {
+		strncpy(value,var,VOLUME_ID_LABEL_SIZE - 1);
+		goto out;
+	}
+
+	vid = volume_id_open_node(spec);
+	if (!vid) {
+		free(value);
+		value = NULL;
+		goto out;
+	}
+
+	if (ioctl(vid->fd, BLKGETSIZE64, &size) != 0)
+		size = 0;
+
+	if (volume_id_probe_all(vid, 0, size) == 0) {
+		switch(volume_id_ptr->id) {
+		case VOLUME_ID_TYPE:
+			strcpy(value, vid->type);
+			break;
+		case VOLUME_ID_LABEL:
+			strcpy(value, vid->label);
+			break;
+		case VOLUME_ID_UUID:
+			strcpy(value, vid->uuid);
+			break;
+		default:
+			free(value);
+			value = NULL;
+			break;
+		}
+	} else
+		value = NULL;
+
+	volume_id_close(vid);
+
+ out:
+	return value;
+}
+
+void
+mount_blkid_get_cache(void) {}
+
+void
+mount_blkid_put_cache(void) {}
+
+const char *
+mount_get_volume_uuid_by_spec(const char *spec)
+{
+	return volume_id_get_tag(spec, "UUID");
+}
+
+const char *
+mount_get_volume_label_by_spec(const char *spec)
+{
+	return volume_id_get_tag(spec, "LABEL");
+}
+
+const char *
+mount_get_devname_by_uuid(const char *uuid) {
+	char *dev = NULL;
+
+	if (!uuid)
+		return NULL;
+
+	dev = malloc(19 + strlen(uuid));
+	if (dev) {
+		strcpy(dev,"/dev/disk/by-uuid/");
+		strcat(dev,uuid);
+	}
+
+	return dev;
+}
+
+const char *
+mount_get_devname_by_label(const char *label) {
+	char *dev = NULL;
+
+	if (!label)
+		return NULL;
+
+	dev = malloc(20 + strlen(label));
+	if (dev) {
+		strcpy(dev,"/dev/disk/by-label/");
+		strcat(dev,label);
+	}
+
+	return dev;
+}
+
+const char *
+mount_get_devname(const char *spec)
+{
+	char *token, *cp, *value;
+	const char *nspec = NULL;
+
+	if (!spec)
+		return NULL;
+
+	token = strdup(spec);
+	if (!token)
+		return NULL;
+
+	/* We have to return an allocated string */
+	if (!(cp = strchr(token, '=')))
+		return token;
+
+	value = token + (cp - token);
+	*value++ = '\0';
+
+	if (*value == '"' || *value == '\'') {
+		char c = *value++;
+		if (!(cp = strrchr(value, c)))
+			goto errout; /* missing closing quote */
+		*cp = '\0';
+	}
+
+	if (!strcmp(token,"LABEL")) {
+		nspec = mount_get_devname_by_label(value);
+	} else if (!strcmp(token,"UUID")) {
+		nspec = mount_get_devname_by_uuid(value);
+	}
+
+	free(token);
+
+ errout:
+	return nspec;
+}
+
+/* Also when no UUID= or LABEL= occur? No verbose? No warnings? */
+const char *
+mount_get_devname_for_mounting(const char *spec)
+{
+	char *token, *cp, *value;
+	const char *nspec = NULL;
+
+	if (!spec)
+		return NULL;
+
+	token = strdup(spec);
+	if (!token)
+		return NULL;
+
+	/* We have to return an allocated string */
+	if (!(cp = strchr(token, '=')))
+		return token;
+
+	value = token + (cp - token);
+	*value++ = '\0';
+
+	if (*value == '"' || *value == '\'') {
+		char c = *value++;
+		if (!(cp = strrchr(value, c)))
+			goto errout; /* missing closing quote */
+		*cp = '\0';
+	}
+
+	if (!strcmp(token,"LABEL")) {
+		nspec = mount_get_devname_by_label(value);
+		if (nspec && verbose > 1)
+			printf(_("mount: going to mount %s by LABEL\n"), spec);
+	} else if (!strcmp(token,"UUID")) {
+		nspec = mount_get_devname_by_uuid(value);
+		if (nspec && verbose > 1)
+			printf(_("mount: going to mount %s by UUID\n"), spec);
+	}
+
+	free(token);
+
+ errout:
+	return nspec;
+}
+
+#endif
Index: util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.h
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/mount_guess_fstype.h
+++ util-linux-ng-2.12r+git20070330/mount/mount_guess_fstype.h
@@ -8,8 +8,8 @@ struct mountargs {
 
 extern int verbose;
 
-char *guess_fstype(const char *device);
-char *do_guess_fstype(const char *device);
+const char *guess_fstype(const char *device);
+const char *do_guess_fstype(const char *device);
 int procfsloop(int (*mount_fn)(struct mountargs *), struct mountargs *args,
 	       const char **type);
 int is_in_procfs(const char *fstype);
Index: util-linux-ng-2.12r+git20070330/configure.ac
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/configure.ac
+++ util-linux-ng-2.12r+git20070330/configure.ac
@@ -57,8 +57,10 @@ AC_CHECK_LIB(termcap, tgetnum)
 AM_CONDITIONAL(HAVE_TERMCAP, test x$ac_cv_lib_termcap_tgetnum = xyes)
 
 AC_CHECK_LIB(blkid, blkid_known_fstype)
-AM_CONDITIONAL(HAVE_BLKID, test x$ac_cv_lib_blkid_blkid_known_fstype = xyes)
+AC_CHECK_LIB(volume_id, volume_id_open_node)
 
+AM_CONDITIONAL(HAVE_BLKID, test x$ac_cv_lib_blkid_blkid_known_fstype = xyes)
+AM_CONDITIONAL(HAVE_VOLUME_ID, test x$ac_cv_lib_volume_id_volume_id_open_node = xyes)
 
 AM_GNU_GETTEXT_VERSION([0.14.1])
 AM_GNU_GETTEXT([external])
Index: util-linux-ng-2.12r+git20070330/mount/Makefile.am
===================================================================
--- util-linux-ng-2.12r+git20070330.orig/mount/Makefile.am
+++ util-linux-ng-2.12r+git20070330/mount/Makefile.am
@@ -16,7 +16,7 @@ MNTHDRS = fstab.h linux_fs.h mount_mnten
 
 mount_SOURCES = mount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \
 	get_label_uuid.c mount_by_label.c mount_blkid.c mount_guess_fstype.c \
-	getusername.c \
+	mount_udev.c getusername.c \
 	nfsmount.c nfsmount_clnt.c nfs4mount.c \
 	lomount.c \
 	$(MNTHDRS)
@@ -24,14 +24,14 @@ mount_SOURCES = mount.c fstab.c sundries
 mount_LDADD = $(top_srcdir)/lib/libenv.a $(top_srcdir)/lib/libsetproctitle.a libnfsmount_xdr.a
 
 umount_SOURCES = umount.c fstab.c sundries.c xmalloc.c realpath.c mount_mntent.c \
-	getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c \
+	getusername.c get_label_uuid.c mount_by_label.c mount_blkid.c mount_udev.c \
 	lomount.c \
 	$(MNTHDRS)
 	
 umount_LDADD = $(top_srcdir)/lib/libenv.a
 
 swapon_SOURCES = swapon.c xmalloc.c \
-	get_label_uuid.c mount_by_label.c mount_blkid.c \
+	get_label_uuid.c mount_by_label.c mount_blkid.c mount_udev.c \
 	swap_constants.h realpath.c
 
 losetup_SOURCES = lomount.c loop.h lomount.h
@@ -43,6 +43,12 @@ umount_LDADD += -lblkid -luuid
 swapon_LDADD = -lblkid -luuid
 endif
 
+if HAVE_VOLUME_ID
+mount_LDADD += -lvolume_id
+umount_LDADD += -lvolume_id
+swapon_LDADD = -lvolume_id
+endif
+
 if HAVE_PIVOT_ROOT
 sbin_PROGRAMS += pivot_root
 man_MANS += pivot_root.8