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

[dm-devel] multipath-tools/libmultipath callout.c



CVSROOT:	/cvs/dm
Module name:	multipath-tools
Branch: 	RHEL5_FC6
Changes by:	bmarzins sourceware org	2011-10-24 13:39:56

Modified files:
	libmultipath   : callout.c 

Log message:
	Fix for bz #729478. Add a new callout format parameter %c, that converts the "!"
	in cciss device names to "/".

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/multipath-tools/libmultipath/callout.c.diff?cvsroot=dm&only_with_tag=RHEL5_FC6&r1=1.5.2.2&r2=1.5.2.3

--- multipath-tools/libmultipath/callout.c	2009/05/15 21:01:26	1.5.2.2
+++ multipath-tools/libmultipath/callout.c	2011/10/24 13:39:56	1.5.2.3
@@ -133,6 +133,19 @@
 	return retval;
 }
 
+void
+convert_cciss(char *dest, char *src)
+{
+	char *ptr;
+
+	strcpy(dest, src);
+	if (strncmp(src, "cciss", 5))
+		return;
+	ptr = strrchr(dest, '!');
+	if (ptr)
+		*ptr = '/';
+}
+
 extern int
 apply_format (char * string, char * cmd, struct path * pp)
 {
@@ -141,6 +154,7 @@
 	char * p;
 	int len;
 	int myfree;
+	char converted_dev[FILE_NAME_SIZE];
 
 	if (!string)
 		return 1;
@@ -179,6 +193,17 @@
 		snprintf(p, len, "%s", pp->dev);
 		p += len - 1;
 		break;
+	case 'c':
+		convert_cciss(converted_dev, pp->dev);
+		len = strlen(converted_dev) + 1;
+		myfree -= len;
+
+		if (myfree < 2)
+			return 1;
+
+		snprintf(p, len, "%s", converted_dev);
+		p += len - 1;
+		break;
 	case 'd':
 		len = strlen(pp->dev_t) + 1;
 		myfree -= len;


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