Blame SOURCES/0021-libmultipath-remove-_blacklist_exceptions-functions.patch

49190a
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
49190a
From: Benjamin Marzinski <bmarzins@redhat.com>
49190a
Date: Mon, 8 Jun 2020 14:27:51 -0500
49190a
Subject: [PATCH] libmultipath: remove _blacklist_exceptions functions
49190a
49190a
_blacklist_exceptions() and _blacklist_exceptions_device() are exactly
49190a
the same as _blacklist() and _blacklist_device(), so remove them, and
49190a
give the remaining functions to a more general name.
49190a
49190a
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
49190a
---
49190a
 libmultipath/blacklist.c | 62 ++++++++++------------------------------
49190a
 1 file changed, 15 insertions(+), 47 deletions(-)
49190a
49190a
diff --git a/libmultipath/blacklist.c b/libmultipath/blacklist.c
49190a
index d9691b17..04d3adb9 100644
49190a
--- a/libmultipath/blacklist.c
49190a
+++ b/libmultipath/blacklist.c
49190a
@@ -101,21 +101,8 @@ int set_ble_device(vector blist, char * vendor, char * product, int origin)
49190a
 	return 0;
49190a
 }
49190a
 
49190a
-int
49190a
-_blacklist_exceptions (vector elist, const char * str)
49190a
-{
49190a
-	int i;
49190a
-	struct blentry * ele;
49190a
-
49190a
-	vector_foreach_slot (elist, ele, i) {
49190a
-		if (!regexec(&ele->regex, str, 0, NULL, 0))
49190a
-			return 1;
49190a
-	}
49190a
-	return 0;
49190a
-}
49190a
-
49190a
-int
49190a
-_blacklist (vector blist, const char * str)
49190a
+static int
49190a
+match_reglist (vector blist, const char * str)
49190a
 {
49190a
 	int i;
49190a
 	struct blentry * ble;
49190a
@@ -127,28 +114,9 @@ _blacklist (vector blist, const char * str)
49190a
 	return 0;
49190a
 }
49190a
 
49190a
-int
49190a
-_blacklist_exceptions_device(const struct _vector *elist, const char * vendor,
49190a
-			     const char * product)
49190a
-{
49190a
-	int i;
49190a
-	struct blentry_device * ble;
49190a
-
49190a
-	vector_foreach_slot (elist, ble, i) {
49190a
-		if (!ble->vendor && !ble->product)
49190a
-			continue;
49190a
-		if ((!ble->vendor ||
49190a
-		     !regexec(&ble->vendor_reg, vendor, 0, NULL, 0)) &&
49190a
-		    (!ble->product ||
49190a
-		     !regexec(&ble->product_reg, product, 0, NULL, 0)))
49190a
-			return 1;
49190a
-	}
49190a
-	return 0;
49190a
-}
49190a
-
49190a
-int
49190a
-_blacklist_device (const struct _vector *blist, const char * vendor,
49190a
-		   const char * product)
49190a
+static int
49190a
+match_reglist_device (const struct _vector *blist, const char * vendor,
49190a
+		    const char * product)
49190a
 {
49190a
 	int i;
49190a
 	struct blentry_device * ble;
49190a
@@ -294,9 +262,9 @@ filter_device (vector blist, vector elist, char * vendor, char * product,
49190a
 	int r = MATCH_NOTHING;
49190a
 
49190a
 	if (vendor && product) {
49190a
-		if (_blacklist_exceptions_device(elist, vendor, product))
49190a
+		if (match_reglist_device(elist, vendor, product))
49190a
 			r = MATCH_DEVICE_BLIST_EXCEPT;
49190a
-		else if (_blacklist_device(blist, vendor, product))
49190a
+		else if (match_reglist_device(blist, vendor, product))
49190a
 			r = MATCH_DEVICE_BLIST;
49190a
 	}
49190a
 
49190a
@@ -310,9 +278,9 @@ filter_devnode (vector blist, vector elist, char * dev)
49190a
 	int r = MATCH_NOTHING;
49190a
 
49190a
 	if (dev) {
49190a
-		if (_blacklist_exceptions(elist, dev))
49190a
+		if (match_reglist(elist, dev))
49190a
 			r = MATCH_DEVNODE_BLIST_EXCEPT;
49190a
-		else if (_blacklist(blist, dev))
49190a
+		else if (match_reglist(blist, dev))
49190a
 			r = MATCH_DEVNODE_BLIST;
49190a
 	}
49190a
 
49190a
@@ -326,9 +294,9 @@ filter_wwid (vector blist, vector elist, char * wwid, char * dev)
49190a
 	int r = MATCH_NOTHING;
49190a
 
49190a
 	if (wwid) {
49190a
-		if (_blacklist_exceptions(elist, wwid))
49190a
+		if (match_reglist(elist, wwid))
49190a
 			r = MATCH_WWID_BLIST_EXCEPT;
49190a
-		else if (_blacklist(blist, wwid))
49190a
+		else if (match_reglist(blist, wwid))
49190a
 			r = MATCH_WWID_BLIST;
49190a
 	}
49190a
 
49190a
@@ -345,9 +313,9 @@ filter_protocol(vector blist, vector elist, struct path * pp)
49190a
 	if (pp) {
49190a
 		snprint_path_protocol(buf, sizeof(buf), pp);
49190a
 
49190a
-		if (_blacklist_exceptions(elist, buf))
49190a
+		if (match_reglist(elist, buf))
49190a
 			r = MATCH_PROTOCOL_BLIST_EXCEPT;
49190a
-		else if (_blacklist(blist, buf))
49190a
+		else if (match_reglist(blist, buf))
49190a
 			r = MATCH_PROTOCOL_BLIST;
49190a
 	}
49190a
 
49190a
@@ -417,11 +385,11 @@ filter_property(struct config *conf, struct udev_device *udev, int lvl,
49190a
 			if (check_missing_prop && !strcmp(env, uid_attribute))
49190a
 				uid_attr_seen = true;
49190a
 
49190a
-			if (_blacklist_exceptions(conf->elist_property, env)) {
49190a
+			if (match_reglist(conf->elist_property, env)) {
49190a
 				r = MATCH_PROPERTY_BLIST_EXCEPT;
49190a
 				break;
49190a
 			}
49190a
-			if (_blacklist(conf->blist_property, env)) {
49190a
+			if (match_reglist(conf->blist_property, env)) {
49190a
 				r = MATCH_PROPERTY_BLIST;
49190a
 				break;
49190a
 			}
49190a
-- 
49190a
2.17.2
49190a