summaryrefslogtreecommitdiffstats
path: root/shlibs
diff options
context:
space:
mode:
authorKarel Zak2009-10-26 13:33:03 +0100
committerKarel Zak2009-10-26 13:33:03 +0100
commita992137b7b8720600c99917af87f0e4cddad8682 (patch)
tree58a399775862e76292e5673c75e4c89b8280bd42 /shlibs
parentlibblkid: convert GPT partition LBA to 512-byte sectors (diff)
downloadkernel-qcow2-util-linux-a992137b7b8720600c99917af87f0e4cddad8682.tar.gz
kernel-qcow2-util-linux-a992137b7b8720600c99917af87f0e4cddad8682.tar.xz
kernel-qcow2-util-linux-a992137b7b8720600c99917af87f0e4cddad8682.zip
mount: and libblkid: covert /dev/dm-N to /dev/mapper/<name>
* mount(8) uses private device-mapper names in mtab * libblkid returns private device-mapper names when evaluate udev /dev/disk-by symlinks. * on systems where DM is fully integrated with udev the /dev/mapper/<name> files are symlinks to /dev/dm-N. It means we need a special care to hide private device-mapper names. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'shlibs')
-rw-r--r--shlibs/blkid/src/devname.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/shlibs/blkid/src/devname.c b/shlibs/blkid/src/devname.c
index fe0d1b332..d048c7222 100644
--- a/shlibs/blkid/src/devname.c
+++ b/shlibs/blkid/src/devname.c
@@ -38,6 +38,7 @@
#include <time.h>
#include "blkidP.h"
+#include "canonicalize.h" /* $(top_srcdir)/include */
/*
* Find a dev struct in the cache by device name, if available.
@@ -153,30 +154,6 @@ static int is_dm_leaf(const char *devname)
}
/*
- * Since 2.6.29 (patch 784aae735d9b0bba3f8b9faef4c8b30df3bf0128) kernel sysfs
- * provides the real DM device names in /sys/block/<ptname>/dm/name
- */
-static char *get_dm_name(const char *ptname)
-{
- FILE *f;
- size_t sz;
- char path[256], name[256], *res = NULL;
-
- snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname);
- if ((f = fopen(path, "r")) == NULL)
- return NULL;
-
- /* read "<name>\n" from sysfs */
- if (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) {
- name[sz - 1] = '\0';
- snprintf(path, sizeof(path), "/dev/mapper/%s", name);
- res = blkid_strdup(path);
- }
- fclose(f);
- return res;
-}
-
-/*
* Probe a single block device to add to the device cache.
*/
static void probe_one(blkid_cache cache, const char *ptname,
@@ -207,7 +184,7 @@ static void probe_one(blkid_cache cache, const char *ptname,
* to standard /dev/mapper/<name>.
*/
if (!strncmp(ptname, "dm-", 3) && isdigit(ptname[3])) {
- devname = get_dm_name(ptname);
+ devname = canonicalize_dm_name(ptname);
if (!devname)
blkid__scan_dir("/dev/mapper", devno, 0, &devname);
if (devname)