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

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