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