diff mbox series

[v10,1/7] eal: replace usage of blacklist/whitelist in enum

Message ID 20201110225544.1876-2-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series replace blacklist/whitelist with allow/block | expand

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Stephen Hemminger Nov. 10, 2020, 10:55 p.m. UTC
This patch renames the enum values in the EAL include files.
As a backward compatible temporary migration tool, define
a replacement mapping for old values.

The old names relating to blacklist and whitelist are replaced
by block list and allow list, but applications may be using the
older compatibility macros.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Gaetan Rivet <grive@u256.net>
---
 lib/librte_eal/common/eal_common_devargs.c | 14 +++++++-------
 lib/librte_eal/include/rte_bus.h           |  8 ++++++--
 lib/librte_eal/include/rte_dev.h           |  8 ++++++--
 lib/librte_eal/include/rte_devargs.h       |  8 ++++++--
 4 files changed, 25 insertions(+), 13 deletions(-)

Comments

Luca Boccassi Nov. 11, 2020, 10:43 a.m. UTC | #1
On Tue, 2020-11-10 at 14:55 -0800, Stephen Hemminger wrote:
> This patch renames the enum values in the EAL include files.
> As a backward compatible temporary migration tool, define
> a replacement mapping for old values.
> 
> The old names relating to blacklist and whitelist are replaced
> by block list and allow list, but applications may be using the
> older compatibility macros.
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> Acked-by: Luca Boccassi <bluca@debian.org>
> Acked-by: Gaetan Rivet <grive@u256.net>
> ---
>  lib/librte_eal/common/eal_common_devargs.c | 14 +++++++-------
>  lib/librte_eal/include/rte_bus.h           |  8 ++++++--
>  lib/librte_eal/include/rte_dev.h           |  8 ++++++--
>  lib/librte_eal/include/rte_devargs.h       |  8 ++++++--
>  4 files changed, 25 insertions(+), 13 deletions(-)

Reviewed-by: Luca Boccassi <bluca@debian.org>
diff mbox series

Patch

diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c
index 2123773ef840..fcf3d9a3ccb2 100644
--- a/lib/librte_eal/common/eal_common_devargs.c
+++ b/lib/librte_eal/common/eal_common_devargs.c
@@ -296,7 +296,7 @@  rte_devargs_insert(struct rte_devargs **da)
 	return 0;
 }
 
-/* store a whitelist parameter for later parsing */
+/* store in allowed list parameter for later parsing */
 int
 rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 {
@@ -313,13 +313,13 @@  rte_devargs_add(enum rte_devtype devtype, const char *devargs_str)
 		goto fail;
 	devargs->type = devtype;
 	bus = devargs->bus;
-	if (devargs->type == RTE_DEVTYPE_BLACKLISTED_PCI)
-		devargs->policy = RTE_DEV_BLACKLISTED;
+	if (devargs->type == RTE_DEVTYPE_BLOCKED)
+		devargs->policy = RTE_DEV_BLOCKED;
 	if (bus->conf.scan_mode == RTE_BUS_SCAN_UNDEFINED) {
-		if (devargs->policy == RTE_DEV_WHITELISTED)
-			bus->conf.scan_mode = RTE_BUS_SCAN_WHITELIST;
-		else if (devargs->policy == RTE_DEV_BLACKLISTED)
-			bus->conf.scan_mode = RTE_BUS_SCAN_BLACKLIST;
+		if (devargs->policy == RTE_DEV_ALLOWED)
+			bus->conf.scan_mode = RTE_BUS_SCAN_ALLOWLIST;
+		else if (devargs->policy == RTE_DEV_BLOCKED)
+			bus->conf.scan_mode = RTE_BUS_SCAN_BLOCKLIST;
 	}
 	TAILQ_INSERT_TAIL(&devargs_list, devargs, next);
 	return 0;
diff --git a/lib/librte_eal/include/rte_bus.h b/lib/librte_eal/include/rte_bus.h
index d3034d0edf77..004c36eafc97 100644
--- a/lib/librte_eal/include/rte_bus.h
+++ b/lib/librte_eal/include/rte_bus.h
@@ -215,10 +215,14 @@  typedef int (*rte_bus_sigbus_handler_t)(const void *failure_addr);
  */
 enum rte_bus_scan_mode {
 	RTE_BUS_SCAN_UNDEFINED,
-	RTE_BUS_SCAN_WHITELIST,
-	RTE_BUS_SCAN_BLACKLIST,
+	RTE_BUS_SCAN_ALLOWLIST,
+	RTE_BUS_SCAN_BLOCKLIST,
 };
 
+/* Backwards compatibility will be removed */
+#define RTE_BUS_SCAN_WHITELIST RTE_BUS_SCAN_ALLOWLIST
+#define RTE_BUS_SCAN_BLACKLIST RTE_BUS_SCAN_BLOCKLIST
+
 /**
  * A structure used to configure bus operations.
  */
diff --git a/lib/librte_eal/include/rte_dev.h b/lib/librte_eal/include/rte_dev.h
index 81905b3ae35f..96aa19f6d1b1 100644
--- a/lib/librte_eal/include/rte_dev.h
+++ b/lib/librte_eal/include/rte_dev.h
@@ -52,10 +52,14 @@  typedef void (*rte_dev_event_cb_fn)(const char *device_name,
  * Device policies.
  */
 enum rte_dev_policy {
-	RTE_DEV_WHITELISTED,
-	RTE_DEV_BLACKLISTED,
+	RTE_DEV_ALLOWED,
+	RTE_DEV_BLOCKED,
 };
 
+/* Backwards compatibility will be removed */
+#define RTE_DEV_WHITELISTED RTE_DEV_ALLOWED
+#define RTE_DEV_BLACKLISTED RTE_DEV_BLOCKED
+
 /**
  * A generic memory resource representation.
  */
diff --git a/lib/librte_eal/include/rte_devargs.h b/lib/librte_eal/include/rte_devargs.h
index 898efa0d667b..407816343ef0 100644
--- a/lib/librte_eal/include/rte_devargs.h
+++ b/lib/librte_eal/include/rte_devargs.h
@@ -29,11 +29,15 @@  extern "C" {
  * Type of generic device
  */
 enum rte_devtype {
-	RTE_DEVTYPE_WHITELISTED_PCI,
-	RTE_DEVTYPE_BLACKLISTED_PCI,
+	RTE_DEVTYPE_ALLOWED,
+	RTE_DEVTYPE_BLOCKED,
 	RTE_DEVTYPE_VIRTUAL,
 };
 
+/* Backwards compatibility will be removed later */
+#define RTE_DEVTYPE_WHITELISTED_PCI RTE_DEVTYPE_ALLOWED
+#define RTE_DEVTYPE_BLACKLISTED_PCI RTE_DEVTYPE_BLOCKED
+
 /**
  * Structure that stores a device given by the user with its arguments
  *