From nobody Sat Apr 20 07:51:24 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637745124; cv=none; d=zohomail.com; s=zohoarc; b=hN8dnF/nqYv/aSw8h/dhN5mhtoH9H+mq1DKWD86pLq6yxh0eurFqQvUnTV82mXSNAZdNQKQx6EUC182cz0MNcwwD9DXL67SfwNk/tRSzKYQmjdUw5mSfQBfVqWEfsLz+fCfwpM98JCKgzlfOcAsYY/JwNYYc/yedcjNZeaYvpdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637745124; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=b8yRU/yadvZ/c1gpSOXmEAidGFVd8i1yMAhBQkTPK6k=; b=ZpAHUXDfEp3VbdMFGJEP5FsrIrVOyij5PSJhONNF0YMBu0PYu/wD2J/Eh4R4dDPWg904YIMgDVJ3r4NBf1Z1jvmOqPt8ylLv9AQYAViONXzfVitMN9b8wq5hQm5vi5V6/n7P4TF+8y2vzWSwEVK8PQ6NsMeL8xdfOZv02n69h24= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1637745124731120.32055881197334; Wed, 24 Nov 2021 01:12:04 -0800 (PST) Received: from localhost ([::1]:53828 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpoJu-0000oH-7d for importer@patchew.org; Wed, 24 Nov 2021 04:12:02 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47620) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpoHs-0007vp-PR for qemu-devel@nongnu.org; Wed, 24 Nov 2021 04:09:57 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58129) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpoHp-0006ox-DI for qemu-devel@nongnu.org; Wed, 24 Nov 2021 04:09:55 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-102-4S98foY4MR695rI6DXN9bg-1; Wed, 24 Nov 2021 04:09:50 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AF48685B664; Wed, 24 Nov 2021 09:09:49 +0000 (UTC) Received: from localhost (unknown [10.2.14.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 58F2260C05; Wed, 24 Nov 2021 09:09:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637744992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=b8yRU/yadvZ/c1gpSOXmEAidGFVd8i1yMAhBQkTPK6k=; b=TtuWnANjRTN+1hoSIzSe3O+/eJUau/yfdP8kC/cZnHIpEYTJpBN3nHxKBUiatiiHt8ffga c3k79FtWEqRQXUpAELQ66mSQh2ufYBawVq6ZKtEXvHf0f8QVYItTP5rb0VolPkI6pCiCm0 8Y9hZGJtpAwArTojeYR2+4ZLLzYM2dA= X-MC-Unique: 4S98foY4MR695rI6DXN9bg-1 From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Subject: [PATCH] qga: replace "blacklist" with "blocklist" Date: Wed, 24 Nov 2021 13:09:37 +0400 Message-Id: <20211124090937.293966-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=marcandre.lureau@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=marcandre.lureau@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -34 X-Spam_score: -3.5 X-Spam_bar: --- X-Spam_report: (-3.5 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.7, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: michael.roth@amd.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637745126887100001 From: Marc-Andr=C3=A9 Lureau Let's use a more neutral language for that option. "blacklist" is still silently accepted for compatibility reasons. Signed-off-by: Marc-Andr=C3=A9 Lureau --- docs/interop/qemu-ga.rst | 4 ++-- qga/guest-agent-core.h | 2 +- qga/commands-posix.c | 14 ++++++------ qga/commands-win32.c | 10 ++++---- qga/main.c | 47 ++++++++++++++++++++++---------------- tests/unit/test-qga.c | 8 +++---- tests/data/test-qga-config | 2 +- 7 files changed, 47 insertions(+), 40 deletions(-) diff --git a/docs/interop/qemu-ga.rst b/docs/interop/qemu-ga.rst index 3063357bb5d6..706c7b189b0e 100644 --- a/docs/interop/qemu-ga.rst +++ b/docs/interop/qemu-ga.rst @@ -79,7 +79,7 @@ Options =20 Daemonize after startup (detach from terminal). =20 -.. option:: -b, --blacklist=3DLIST +.. option:: -b, --blocklist=3DLIST =20 Comma-separated list of RPCs to disable (no spaces, ``?`` to list available RPCs). @@ -125,7 +125,7 @@ pidfile string fsfreeze-hook string statedir string verbose boolean -blacklist string list +blocklist string list =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 See also diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h index 9d01ea9c82ab..e3bef90b17db 100644 --- a/qga/guest-agent-core.h +++ b/qga/guest-agent-core.h @@ -24,7 +24,7 @@ typedef struct GACommandState GACommandState; extern GAState *ga_state; extern QmpCommandList ga_commands; =20 -GList *ga_command_blacklist_init(GList *blacklist); +GList *ga_command_blocklist_init(GList *blocklist); void ga_command_state_init(GAState *s, GACommandState *cs); void ga_command_state_add(GACommandState *cs, void (*init)(void), diff --git a/qga/commands-posix.c b/qga/commands-posix.c index 75dbaab68ea9..046b07a6cf4e 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -3042,8 +3042,8 @@ qmp_guest_fstrim(bool has_minimum, int64_t minimum, E= rror **errp) } #endif =20 -/* add unsupported commands to the blacklist */ -GList *ga_command_blacklist_init(GList *blacklist) +/* add unsupported commands to the blocklist */ +GList *ga_command_blocklist_init(GList *blocklist) { #if !defined(__linux__) { @@ -3057,7 +3057,7 @@ GList *ga_command_blacklist_init(GList *blacklist) char **p =3D (char **)list; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blocklist =3D g_list_append(blocklist, g_strdup(*p++)); } } #endif @@ -3072,18 +3072,18 @@ GList *ga_command_blacklist_init(GList *blacklist) char **p =3D (char **)list; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blocklist =3D g_list_append(blocklist, g_strdup(*p++)); } } #endif =20 #if !defined(CONFIG_FSTRIM) - blacklist =3D g_list_append(blacklist, g_strdup("guest-fstrim")); + blocklist =3D g_list_append(blocklist, g_strdup("guest-fstrim")); #endif =20 - blacklist =3D g_list_append(blacklist, g_strdup("guest-get-devices")); + blocklist =3D g_list_append(blocklist, g_strdup("guest-get-devices")); =20 - return blacklist; + return blocklist; } =20 /* register init/cleanup routines for stateful command groups */ diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 4e84afd83bee..785867a30a4a 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -2005,8 +2005,8 @@ GuestMemoryBlockInfo *qmp_guest_get_memory_block_info= (Error **errp) return NULL; } =20 -/* add unsupported commands to the blacklist */ -GList *ga_command_blacklist_init(GList *blacklist) +/* add unsupported commands to the blocklist */ +GList *ga_command_blocklist_init(GList *blocklist) { const char *list_unsupported[] =3D { "guest-suspend-hybrid", @@ -2017,7 +2017,7 @@ GList *ga_command_blacklist_init(GList *blacklist) char **p =3D (char **)list_unsupported; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blocklist =3D g_list_append(blocklist, g_strdup(*p++)); } =20 if (!vss_init(true)) { @@ -2028,11 +2028,11 @@ GList *ga_command_blacklist_init(GList *blacklist) p =3D (char **)list; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + blocklist =3D g_list_append(blocklist, g_strdup(*p++)); } } =20 - return blacklist; + return blocklist; } =20 /* register init/cleanup routines for stateful command groups */ diff --git a/qga/main.c b/qga/main.c index 15fd3a4149f4..016e3f160570 100644 --- a/qga/main.c +++ b/qga/main.c @@ -88,7 +88,7 @@ struct GAState { #endif bool delimit_response; bool frozen; - GList *blacklist; + GList *blocklist; char *state_filepath_isfrozen; struct { const char *log_filepath; @@ -257,7 +257,7 @@ QEMU_COPYRIGHT "\n" #ifdef _WIN32 " -s, --service service commands: install, uninstall, vss-install, vs= s-uninstall\n" #endif -" -b, --blacklist comma-separated list of RPCs to disable (no spaces, \= "?\"\n" +" -b, --blocklist comma-separated list of RPCs to disable (no spaces, \= "?\"\n" " to list available RPCs)\n" " -D, --dump-conf dump a qemu-ga config file based on current config\n" " options / command-line parameters to stdout\n" @@ -379,13 +379,13 @@ static void ga_disable_non_whitelisted(const QmpComma= nd *cmd, void *opaque) } } =20 -/* [re-]enable all commands, except those explicitly blacklisted by user */ -static void ga_enable_non_blacklisted(const QmpCommand *cmd, void *opaque) +/* [re-]enable all commands, except those explicitly blocklisted by user */ +static void ga_enable_non_blocklisted(const QmpCommand *cmd, void *opaque) { - GList *blacklist =3D opaque; + GList *blocklist =3D opaque; const char *name =3D qmp_command_name(cmd); =20 - if (g_list_find_custom(blacklist, name, ga_strcmp) =3D=3D NULL && + if (g_list_find_custom(blocklist, name, ga_strcmp) =3D=3D NULL && !qmp_command_is_enabled(cmd)) { g_debug("enabling command: %s", name); qmp_enable_command(&ga_commands, name); @@ -463,8 +463,8 @@ void ga_unset_frozen(GAState *s) s->deferred_options.pid_filepath =3D NULL; } =20 - /* enable all disabled, non-blacklisted commands */ - qmp_for_each_command(&ga_commands, ga_enable_non_blacklisted, s->black= list); + /* enable all disabled, non-blocklisted commands */ + qmp_for_each_command(&ga_commands, ga_enable_non_blocklisted, s->block= list); s->frozen =3D false; if (!ga_delete_file(s->state_filepath_isfrozen)) { g_warning("unable to delete %s, fsfreeze may not function properly= ", @@ -894,7 +894,7 @@ int64_t ga_get_fd_handle(GAState *s, Error **errp) int64_t handle; =20 g_assert(s->pstate_filepath); - /* we blacklist commands and avoid operations that potentially require + /* we blocklist commands and avoid operations that potentially require * writing to disk when we're in a frozen state. this includes opening * new files, so we should never get here in that situation */ @@ -948,8 +948,8 @@ struct GAConfig { #ifdef _WIN32 const char *service; #endif - gchar *bliststr; /* blacklist may point to this string */ - GList *blacklist; + gchar *bliststr; /* blocklist may point to this string */ + GList *blocklist; int daemonize; GLogLevelFlags log_level; int dumpconf; @@ -1007,10 +1007,16 @@ static void config_load(GAConfig *config) config->retry_path =3D g_key_file_get_boolean(keyfile, "general", "retry-path", &gerr= ); } + if (g_key_file_has_key(keyfile, "general", "blocklist", NULL)) { + config->bliststr =3D + g_key_file_get_string(keyfile, "general", "blocklist", &gerr); + config->blocklist =3D g_list_concat(config->blocklist, + split_list(config->bliststr, ","= )); + } if (g_key_file_has_key(keyfile, "general", "blacklist", NULL)) { config->bliststr =3D g_key_file_get_string(keyfile, "general", "blacklist", &gerr); - config->blacklist =3D g_list_concat(config->blacklist, + config->blocklist =3D g_list_concat(config->blocklist, split_list(config->bliststr, ","= )); } =20 @@ -1070,8 +1076,8 @@ static void config_dump(GAConfig *config) config->log_level =3D=3D G_LOG_LEVEL_MASK); g_key_file_set_boolean(keyfile, "general", "retry-path", config->retry_path); - tmp =3D list_join(config->blacklist, ','); - g_key_file_set_string(keyfile, "general", "blacklist", tmp); + tmp =3D list_join(config->blocklist, ','); + g_key_file_set_string(keyfile, "general", "blocklist", tmp); g_free(tmp); =20 tmp =3D g_key_file_to_data(keyfile, NULL, &error); @@ -1103,6 +1109,7 @@ static void config_parse(GAConfig *config, int argc, = char **argv) { "method", 1, NULL, 'm' }, { "path", 1, NULL, 'p' }, { "daemonize", 0, NULL, 'd' }, + { "blocklist", 1, NULL, 'b' }, { "blacklist", 1, NULL, 'b' }, #ifdef _WIN32 { "service", 1, NULL, 's' }, @@ -1161,7 +1168,7 @@ static void config_parse(GAConfig *config, int argc, = char **argv) qmp_for_each_command(&ga_commands, ga_print_cmd, NULL); exit(EXIT_SUCCESS); } - config->blacklist =3D g_list_concat(config->blacklist, + config->blocklist =3D g_list_concat(config->blocklist, split_list(optarg, ",")); break; } @@ -1216,7 +1223,7 @@ static void config_free(GAConfig *config) #ifdef CONFIG_FSFREEZE g_free(config->fsfreeze_hook); #endif - g_list_free_full(config->blacklist, g_free); + g_list_free_full(config->blocklist, g_free); g_free(config); } =20 @@ -1322,10 +1329,10 @@ static GAState *initialize_agent(GAConfig *config, = int socket_activation) return NULL; } =20 - config->blacklist =3D ga_command_blacklist_init(config->blacklist); - if (config->blacklist) { - GList *l =3D config->blacklist; - s->blacklist =3D config->blacklist; + config->blocklist =3D ga_command_blocklist_init(config->blocklist); + if (config->blocklist) { + GList *l =3D config->blocklist; + s->blocklist =3D config->blocklist; do { g_debug("disabling command: %s", (char *)l->data); qmp_disable_command(&ga_commands, l->data, NULL); diff --git a/tests/unit/test-qga.c b/tests/unit/test-qga.c index 5cb140d1b53d..228a457a68dc 100644 --- a/tests/unit/test-qga.c +++ b/tests/unit/test-qga.c @@ -655,7 +655,7 @@ static void test_qga_get_time(gconstpointer fix) qobject_unref(ret); } =20 -static void test_qga_blacklist(gconstpointer data) +static void test_qga_blocklist(gconstpointer data) { TestFixture fix; QDict *ret, *error; @@ -663,7 +663,7 @@ static void test_qga_blacklist(gconstpointer data) =20 fixture_setup(&fix, "-b guest-ping,guest-get-time", NULL); =20 - /* check blacklist */ + /* check blocklist */ ret =3D qmp_fd(fix.fd, "{'execute': 'guest-ping'}"); g_assert_nonnull(ret); error =3D qdict_get_qdict(ret, "error"); @@ -752,7 +752,7 @@ static void test_qga_config(gconstpointer data) g_assert_true(g_key_file_get_boolean(kf, "general", "verbose", &error)= ); g_assert_no_error(error); =20 - strv =3D g_key_file_get_string_list(kf, "general", "blacklist", &n, &e= rror); + strv =3D g_key_file_get_string_list(kf, "general", "blocklist", &n, &e= rror); g_assert_cmpint(n, =3D=3D, 2); g_assert_true(g_strv_contains((const char * const *)strv, "guest-ping")); @@ -997,7 +997,7 @@ int main(int argc, char **argv) g_test_add_data_func("/qga/fsfreeze-status", &fix, test_qga_fsfreeze_status); =20 - g_test_add_data_func("/qga/blacklist", NULL, test_qga_blacklist); + g_test_add_data_func("/qga/blocklist", NULL, test_qga_blocklist); g_test_add_data_func("/qga/config", NULL, test_qga_config); g_test_add_data_func("/qga/guest-exec", &fix, test_qga_guest_exec); g_test_add_data_func("/qga/guest-exec-invalid", &fix, diff --git a/tests/data/test-qga-config b/tests/data/test-qga-config index 4bb721a4a187..50bbb2caf7d4 100644 --- a/tests/data/test-qga-config +++ b/tests/data/test-qga-config @@ -5,4 +5,4 @@ path=3D/path/to/org.qemu.guest_agent.0 pidfile=3D/var/foo/qemu-ga.pid statedir=3D/var/state verbose=3Dtrue -blacklist=3Dguest-ping;guest-get-time +blocklist=3Dguest-ping;guest-get-time --=20 2.33.0.721.g106298f7f9