[PATCH parted 1/3] linux: Use major / minor to specify device mapper device in dm_task

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use major / minor to specify device mapper device instead of
dm_task_set_name. This is needed for upcoming lvm changes where the
/dev/mapper/foobar files are becoming symlinks, so we will end up
opening /dev/dm-#, and dm-# is not a valid dm_task name.

This is only needed in this one place, as in the other places where we
use dm_task_set_name, the name we use was returned by libdevicemapper itself
in an earlier function call.
---
 libparted/arch/linux.c |    8 +++++---
 libparted/arch/linux.h |    2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c
index 271bc8b..a564ad7 100644
--- a/libparted/arch/linux.c
+++ b/libparted/arch/linux.c
@@ -420,7 +420,8 @@ _dm_maptype (PedDevice *dev)
         if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
                 return r;
 
-        if (!dm_task_set_name(dmt, dev->path))
+        if (!dm_task_set_major_minor(dmt, arch_specific->major,
+                                     arch_specific->minor, 0))
                 goto bad;
 
         dm_task_no_open_count(dmt);
@@ -502,6 +503,7 @@ _device_probe_type (PedDevice* dev)
         struct stat             dev_stat;
         int                     dev_major;
         int                     dev_minor;
+        LinuxSpecific*          arch_specific = LINUX_SPECIFIC (dev);
 
         if (!_device_stat (dev, &dev_stat))
                 return 0;
@@ -511,8 +513,8 @@ _device_probe_type (PedDevice* dev)
                 return 1;
         }
 
-        dev_major = major (dev_stat.st_rdev);
-        dev_minor = minor (dev_stat.st_rdev);
+        arch_specific->major = dev_major = major (dev_stat.st_rdev);
+        arch_specific->minor = dev_minor = minor (dev_stat.st_rdev);
 
         if (SCSI_BLK_MAJOR (dev_major) && (dev_minor % 0x10 == 0)) {
                 dev->type = PED_DEVICE_SCSI;
diff --git a/libparted/arch/linux.h b/libparted/arch/linux.h
index 3270367..b3693e9 100644
--- a/libparted/arch/linux.h
+++ b/libparted/arch/linux.h
@@ -32,6 +32,8 @@ typedef	struct _LinuxSpecific	LinuxSpecific;
 
 struct _LinuxSpecific {
 	int	fd;
+	int	major;
+	int	minor;
 	char*	dmtype;         /**< device map target type */
 #if defined __s390__ || defined __s390x__
 	unsigned int real_sector_size;
-- 
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux