[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH parted 1/4] linux: Use major / minor to specify device mapper dev
From: |
Hans de Goede |
Subject: |
[PATCH parted 1/4] linux: Use major / minor to specify device mapper device in dm_task |
Date: |
Fri, 6 Nov 2009 17:50:49 +0100 |
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 52d8fa8..c87a7ca 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 391859b..7036886 100644
--- a/libparted/arch/linux.h
+++ b/libparted/arch/linux.h
@@ -28,6 +28,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.2
- [PATCH parted 1/4] linux: Use major / minor to specify device mapper device in dm_task,
Hans de Goede <=