diff mbox series

[2/2] Continue temporary support for Blacklist command with warnings

Message ID 20210503105347.979635-3-rvarghes@redhat.com (mailing list archive)
State New, archived
Headers show
Series Introduce inclusive language in kmod | expand

Commit Message

Reuben Varghese May 3, 2021, 10:53 a.m. UTC
Since refactoring blacklist to blocklist without notice will surely
result in a lot of broken systems, temporary support with a warning
that the blacklist command is being deprecated and has been refactored
to blocklist is added.

Signed-off-by: Reuben Varghese <rvarghes@redhat.com>
---
 libkmod/libkmod-config.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c
index c2ce4cc..084947d 100644
--- a/libkmod/libkmod-config.c
+++ b/libkmod/libkmod-config.c
@@ -476,7 +476,11 @@  static void kcmdline_parse_result(struct kmod_config *config, char *modname,
 
 	DBG(config->ctx, "%s %s\n", modname, param);
 
-	if (streq(modname, "modprobe") && !strncmp(param, "blocklist=", 10)) {
+	if (streq(modname, "modprobe") && (!strncmp(param, "blocklist=", 10) ||
+					   !strncmp(param, "blacklist=", 10))) {
+		if (!strncmp(param, "blacklist=", 10)) {
+			DBG(config->ctx, "Warning: Blacklist command is now deprecated and has been refactored to blocklist\n");
+		}
 		for (;;) {
 			char *t = strsep(&value, ",");
 			if (t == NULL)
@@ -662,9 +666,13 @@  static int kmod_config_parse(struct kmod_config *config, int fd,
 				goto syntax_error;
 
 			kmod_config_add_alias(config, alias, modname);
-		} else if (streq(cmd, "blocklist")) {
+		} else if (streq(cmd, "blacklist") || streq(cmd, "blocklist")) {
 			char *modname = strtok_r(NULL, "\t ", &saveptr);
 
+			if (streq(cmd, "blacklist"))
+				DBG(config->ctx,
+				    "Blacklist command is now deprecated and has been refactored to blocklist. Please edit your config file to reflect this change\n");
+
 			if (underscores(modname) < 0)
 				goto syntax_error;