Skip to contentSkip to conversation

multipath-tools: remove pointless ".*" from devnode blacklists

PATCH In review Xose Vazquez Perez 2 participants 2 messages Oct 3, 2016 Device mapper

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 multipath-tools: remove pointless ".*" from devnode blacklists

".*" is useless at the end of a regex, and just "*" is a bug. And document them.

Cc Christophe Varoqui <[email protected]>
Cc device-mapper development <[email protected]>
---
 libmultipath/blacklist.c   | 8 ++++----
 multipath/multipath.conf.5 | 6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)
libmultipath/blacklist.c +4 -4
index 9687399..aa8d975 100644
@@ -172,7 +172,7 @@ setup_default_blist (struct config * conf)
 	char * str;
 	int i;
 
-	str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*");
+	str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]");
 	if (!str)
 		return 1;
 	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
@@ -184,19 +184,19 @@ setup_default_blist (struct config * conf)
 	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 
-	str = STRDUP("^dcssblk[0-9]*");
+	str = STRDUP("^dcssblk[0-9]");
 	if (!str)
 		return 1;
 	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 
-	str = STRDUP("^nvme.*");
+	str = STRDUP("^nvme");
 	if (!str)
 		return 1;
 	if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
 		return 1;
 
-	str = STRDUP("(SCSI_IDENT_.*|ID_WWN)");
+	str = STRDUP("(SCSI_IDENT_|ID_WWN)");
 	if (!str)
 		return 1;
 	if (store_ble(conf->elist_property, str, ORIGIN_DEFAULT))
multipath/multipath.conf.5 +5 -1
index 7dd997a..7bb847a 100644
@@ -849,6 +849,10 @@ The following keywords are recognized:
 .TP 17
 .B devnode
 Regular expression of the device nodes to be excluded.
+.RS
+.TP
+Default value is: \fB^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]\fR, \fB^(td|hd|vd)[a-z]\fR, \fB^dcssblk[0-9]\fR and \fB^nvme\fR
+.RE
 .TP
 .B wwid
 The \fIWorld Wide Identification\fR of a device.
@@ -888,7 +892,7 @@ The \fIWorld Wide Identification\fR of a device.
 Regular expression of the udev property to be whitelisted.
 .RS
 .TP
-Default value is: \fB(ID_WWN|SCSI_IDENT_.*)\fR
+Default value is: \fB(SCSI_IDENT_|ID_WWN)\fR
 .RE
 .TP
 .B device
Signature · 1 line
2.10.0
#1 lore raw

Merged.
Thanks.

Quoted 76 lines · Xose Vazquez Perez

".*" is useless at the end of a regex, and just "*" is a bug. And document them.

Cc Christophe Varoqui <[email protected]>
Cc device-mapper development <[email protected]>
---
 libmultipath/blacklist.c   | 8 ++++----
 multipath/multipath.conf.5 | 6 +++++-
 2 files changed, 9 insertions(+), 5 deletions(-)
libmultipath/blacklist.c +4 -4
index 9687399..aa8d975 100644
@@ -172,7 +172,7 @@ setup_default_blist (struct config * conf)
        char * str;
        int i;
 
-       str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*");
+       str = STRDUP("^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]");
        if (!str)
                return 1;
        if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
@@ -184,19 +184,19 @@ setup_default_blist (struct config * conf)
        if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
                return 1;
 
-       str = STRDUP("^dcssblk[0-9]*");
+       str = STRDUP("^dcssblk[0-9]");
        if (!str)
                return 1;
        if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
                return 1;
 
-       str = STRDUP("^nvme.*");
+       str = STRDUP("^nvme");
        if (!str)
                return 1;
        if (store_ble(conf->blist_devnode, str, ORIGIN_DEFAULT))
                return 1;
 
-       str = STRDUP("(SCSI_IDENT_.*|ID_WWN)");
+       str = STRDUP("(SCSI_IDENT_|ID_WWN)");
        if (!str)
                return 1;
        if (store_ble(conf->elist_property, str, ORIGIN_DEFAULT))
multipath/multipath.conf.5 +3 -0
index 7dd997a..7bb847a 100644
@@ -849,6 +849,10 @@ The following keywords are recognized:
 .TP 17
 .B devnode
 Regular expression of the device nodes to be excluded.
+.RS
+.TP
+Default value is: \fB^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]\fR,

\fB^(td|hd|vd)[a-z]\fR, \fB^dcssblk[0-9]\fR and \fB^nvme\fR +.RE
.TP
.B wwid
The \fIWorld Wide Identification\fR of a device.

multipath/multipath.conf.5 +1 -2
@@ -888,7 +892,7 @@ The \fIWorld Wide Identification\fR of a device.
 Regular expression of the udev property to be whitelisted.
 .RS
 .TP
-Default value is: \fB(ID_WWN|SCSI_IDENT_.*)\fR
+Default value is: \fB(SCSI_IDENT_|ID_WWN)\fR
 .RE
 .TP
 .B device
--

2.10.0