Skip to contentSkip to conversation

multipath: fix cciss device names

PATCH RESEND Applied Benjamin Marzinski 2 participants 2 messages Jul 27, 2012 – Aug 17, 2012 Device mapper

lore
Share & tools
lore

Benjamin Marzinski

author maintainer
#0 lore raw

PATCH RESEND 1/1 multipath: fix cciss device names

When we're looking for cciss devices in sysfs, they have a "!" not a "/". If users run multipath on a cciss device using it's devnode name, /dev/cciss/cXdY, multipath should convert that to the sysfs name.

---
 multipath/main.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
multipath/main.c +12 -0
Index: multipath-tools-120518/multipath/main.c
===================================================================
@@ -409,6 +409,16 @@ get_dev_type(char *dev) {
 		return DEV_DEVMAP;
 }
 
+static void
+convert_dev(char *dev)
+{
+	char *ptr = strstr(dev, "cciss/");
+	if (ptr) {
+		ptr += 5;
+		*ptr = '!';
+	}
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -514,6 +524,8 @@ main (int argc, char *argv[])
 
 		strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
 		conf->dev_type = get_dev_type(conf->dev);
+		if (conf->dev_type == DEV_DEVNODE)
+			convert_dev(conf->dev);
 	}
 	conf->daemon = 0;
 
#1 lore raw
Quoted 4 lines · Benjamin Marzinski

When we're looking for cciss devices in sysfs, they have a "!" not a "/". If users run multipath on a cciss device using it's devnode name, /dev/cciss/cXdY, multipath should convert that to the sysfs name.

Applied.

Thanks.

Quoted 35 lines
---
 multipath/main.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

Index: multipath-tools-120518/multipath/main.c
===================================================================

multipath/main.c +12 -0
@@ -409,6 +409,16 @@ get_dev_type(char *dev) {
 		return DEV_DEVMAP;
 }
 
+static void
+convert_dev(char *dev)
+{
+	char *ptr = strstr(dev, "cciss/");
+	if (ptr) {
+		ptr += 5;
+		*ptr = '!';
+	}
+}
+
 int
 main (int argc, char *argv[])
 {
@@ -514,6 +524,8 @@ main (int argc, char *argv[])
 
 		strncpy(conf->dev, argv[optind], FILE_NAME_SIZE);
 		conf->dev_type = get_dev_type(conf->dev);
+		if (conf->dev_type == DEV_DEVNODE)
+			convert_dev(conf->dev);
 	}
 	conf->daemon = 0;