From nobody Tue Nov 18 19:43:47 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612299545; cv=none; d=zohomail.com; s=zohoarc; b=my6CA+BF3E437lDTaaoEXCVeT7hZb7qYm+NtM5C91jQ39ilYnal7drDgWjF3j7aXPFLZXx1ZPt0wZnH/LTH5DlX/J7Q02bIOjcipOodxy1J807EhtVoJ44sOm8/orltvAaxqtd+zF9ZByLJP+ajjLGxtsxPqyFFtZKX0l1hEs4Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612299545; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=KikifyMD+kQLStcGOLcsV8rDvJsrpQTJUnw3tvpYxvk=; b=gjn5Acq8NWyK9oD+p6AfP/SPvCV4FChDgaY0CnDJCbdEAaw2EiUA+dL9Qfb7A+ZDLME5R1Jt93y9EG0NFylQYTt2jg4Z5sHba+jy1YV+sqtHdnT4YoDU92bf5scsPHQfBWkfBHTPNPCZcVzkIlp72ijokQpQs2XDyemW4lqftVY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612299545960146.5687310181312; Tue, 2 Feb 2021 12:59:05 -0800 (PST) Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-515-3gKPhDunNTykjivKRbS78w-1; Tue, 02 Feb 2021 15:59:03 -0500 Received: by mail-ej1-f70.google.com with SMTP id w16so3054889ejk.7 for ; Tue, 02 Feb 2021 12:59:03 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (7.red-83-57-171.dynamicip.rima-tde.net. [83.57.171.7]) by smtp.gmail.com with ESMTPSA id lf26sm14021ejb.4.2021.02.02.12.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 12:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612299544; 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: in-reply-to:in-reply-to:references:references; bh=KikifyMD+kQLStcGOLcsV8rDvJsrpQTJUnw3tvpYxvk=; b=IJWD98FbVVUdt7N6xg8I/xZCA+h1CnP8lWPuipPKZg2YtCHOwXzoem/gS9vVlL/dIy1PhS UoUHSVBF4l1xM6Tk2uChw0N4hcFGZOg41+iHCbL9D2wZ50POXyXO1L2fWii515GhTazbxt xfSSTytFGNJz1rfMzP2QsMNBdklJ+eA= X-MC-Unique: 3gKPhDunNTykjivKRbS78w-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KikifyMD+kQLStcGOLcsV8rDvJsrpQTJUnw3tvpYxvk=; b=CbFpHSBS9aGshHp/RRA3+SOvyRi1m7Mg3jPzvcEoxFzltdCP6OCiOUuptKMxcd5IbF oMkBwWMttL2htKzsZ7ggZrSh95BGW24adOtazarfDBPSjkI7wtxxpJyM2yuH8VFJcyU3 F2VGN7hH0Nw11jVtNLJTnNKhvPP4Xtqu3w7eDrsA8SjFge7G5rVlyALHUzdzDGbUY5zB PBT6Mr74S2qD+jkcKk1I8855YpyLPdYi2xkzKdOxkNyz2CHfmLvihrKStjLBVzPD2UFg mHUXQ1/W/veStuGa3L0NKdq6bqrbv3iGHE7ovQBnCfll2VvuSgwy6uYi7omQeQtr/kuk drVg== X-Gm-Message-State: AOAM532BTsuV4++pPwMqOFSHK1biWaltv6Uf/pTpvJuxLfq0Ady4tJ1L pd7m1GJ1nOKOQhlPcmolTiRN6e9nCgicY6JACwFc/9pU7YQu+i5Rxo5hs2e3BUlsP17+io8UMZj GQs6QbkegcldiwA== X-Received: by 2002:aa7:cdc8:: with SMTP id h8mr748993edw.244.1612299541994; Tue, 02 Feb 2021 12:59:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzIjaVmtpm/x/R+xleXJRRxdttHpz9X6lFS42uaEjDXUK/fg1Fxb7Ic8OsxZQC9bonU1hr1Lg== X-Received: by 2002:aa7:cdc8:: with SMTP id h8mr748984edw.244.1612299541828; Tue, 02 Feb 2021 12:59:01 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , "Dr. David Alan Gilbert" , Eduardo Otubo , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Gerd Hoffmann , Aurelien Jarno , qemu-block@nongnu.org, Kevin Wolf , Michael Roth , Peter Maydell , Alex Williamson , Max Reitz , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH 04/12] qga: Replace the word 'blacklist' Date: Tue, 2 Feb 2021 21:58:16 +0100 Message-Id: <20210202205824.1085853-5-philmd@redhat.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210202205824.1085853-1-philmd@redhat.com> References: <20210202205824.1085853-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Follow the inclusive terminology from the "Conscious Language in your Open Source Projects" guidelines [*] and replace the word "blacklist" appropriately. [*] https://github.com/conscious-lang/conscious-lang-docs/blob/main/faq.md Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Daniel P. Berrang=C3=A9 --- qga/guest-agent-core.h | 2 +- qga/commands-posix.c | 14 +++++------ qga/commands-win32.c | 10 ++++---- qga/main.c | 57 +++++++++++++++++++++--------------------- 4 files changed, 42 insertions(+), 41 deletions(-) diff --git a/qga/guest-agent-core.h b/qga/guest-agent-core.h index 9d01ea9c82a..90ce6a91a0a 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_denylist_init(GList *denylist); 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 8dd94a33144..a23f11d9d20 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -3071,8 +3071,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 denylist */ +GList *ga_command_denylist_init(GList *denylist) { #if !defined(__linux__) { @@ -3086,7 +3086,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++)); + denylist =3D g_list_append(denylist, g_strdup(*p++)); } } #endif @@ -3101,18 +3101,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++)); + denylist =3D g_list_append(denylist, g_strdup(*p++)); } } #endif =20 #if !defined(CONFIG_FSTRIM) - blacklist =3D g_list_append(blacklist, g_strdup("guest-fstrim")); + denylist =3D g_list_append(denylist, g_strdup("guest-fstrim")); #endif =20 - blacklist =3D g_list_append(blacklist, g_strdup("guest-get-devices")); + denylist =3D g_list_append(denylist, g_strdup("guest-get-devices")); =20 - return blacklist; + return denylist; } =20 /* register init/cleanup routines for stateful command groups */ diff --git a/qga/commands-win32.c b/qga/commands-win32.c index a00e6cb1655..f7a1644a423 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -2004,8 +2004,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 denylist */ +GList *ga_command_denylist_init(GList *denylist) { const char *list_unsupported[] =3D { "guest-suspend-hybrid", @@ -2016,7 +2016,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++)); + denylist =3D g_list_append(denylist, g_strdup(*p++)); } =20 if (!vss_init(true)) { @@ -2027,11 +2027,11 @@ GList *ga_command_blacklist_init(GList *blacklist) p =3D (char **)list; =20 while (*p) { - blacklist =3D g_list_append(blacklist, g_strdup(*p++)); + denylist =3D g_list_append(denylist, g_strdup(*p++)); } } =20 - return blacklist; + return denylist; } =20 /* register init/cleanup routines for stateful command groups */ diff --git a/qga/main.c b/qga/main.c index 66177b9e93d..4dbcc62ac9d 100644 --- a/qga/main.c +++ b/qga/main.c @@ -88,7 +88,7 @@ struct GAState { #endif bool delimit_response; bool frozen; - GList *blacklist; + GList *denylist; char *state_filepath_isfrozen; struct { const char *log_filepath; @@ -108,7 +108,7 @@ struct GAState *ga_state; QmpCommandList ga_commands; =20 /* commands that are safe to issue while filesystems are frozen */ -static const char *ga_freeze_whitelist[] =3D { +static const char *ga_freeze_allowlist[] =3D { "guest-ping", "guest-info", "guest-sync", @@ -362,31 +362,31 @@ static gint ga_strcmp(gconstpointer str1, gconstpoint= er str2) } =20 /* disable commands that aren't safe for fsfreeze */ -static void ga_disable_non_whitelisted(const QmpCommand *cmd, void *opaque) +static void ga_disable_not_allowed(const QmpCommand *cmd, void *opaque) { - bool whitelisted =3D false; + bool allowed =3D false; int i =3D 0; const char *name =3D qmp_command_name(cmd); =20 - while (ga_freeze_whitelist[i] !=3D NULL) { - if (strcmp(name, ga_freeze_whitelist[i]) =3D=3D 0) { - whitelisted =3D true; + while (ga_freeze_allowlist[i] !=3D NULL) { + if (strcmp(name, ga_freeze_allowlist[i]) =3D=3D 0) { + allowed =3D true; } i++; } - if (!whitelisted) { + if (!allowed) { g_debug("disabling command: %s", name); qmp_disable_command(&ga_commands, name); } } =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 denylisted by user */ +static void ga_enable_non_denylisted(const QmpCommand *cmd, void *opaque) { - GList *blacklist =3D opaque; + GList *denylist =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(denylist, name, ga_strcmp) =3D=3D NULL && !qmp_command_is_enabled(cmd)) { g_debug("enabling command: %s", name); qmp_enable_command(&ga_commands, name); @@ -425,8 +425,8 @@ void ga_set_frozen(GAState *s) if (ga_is_frozen(s)) { return; } - /* disable all non-whitelisted (for frozen state) commands */ - qmp_for_each_command(&ga_commands, ga_disable_non_whitelisted, NULL); + /* disable all commands not allowed (for frozen state) */ + qmp_for_each_command(&ga_commands, ga_disable_not_allowed, NULL); g_warning("disabling logging due to filesystem freeze"); ga_disable_logging(s); s->frozen =3D true; @@ -464,8 +464,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-denylisted commands */ + qmp_for_each_command(&ga_commands, ga_enable_non_denylisted, s->denyli= st); s->frozen =3D false; if (!ga_delete_file(s->state_filepath_isfrozen)) { g_warning("unable to delete %s, fsfreeze may not function properly= ", @@ -896,9 +896,10 @@ 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 - * writing to disk when we're in a frozen state. this includes opening - * new files, so we should never get here in that situation + /* + * We have commands in a denylist 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 */ g_assert(!ga_is_frozen(s)); =20 @@ -950,8 +951,8 @@ struct GAConfig { #ifdef _WIN32 const char *service; #endif - gchar *bliststr; /* blacklist may point to this string */ - GList *blacklist; + gchar *bliststr; /* denylist may point to this string */ + GList *denylist; int daemonize; GLogLevelFlags log_level; int dumpconf; @@ -1171,7 +1172,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->denylist =3D g_list_concat(config->denylist, split_list(optarg, ",")); break; } @@ -1226,7 +1227,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->denylist, g_free); g_free(config); } =20 @@ -1308,7 +1309,7 @@ static GAState *initialize_agent(GAConfig *config, in= t socket_activation) s->deferred_options.log_filepath =3D config->log_filepath; } ga_disable_logging(s); - qmp_for_each_command(&ga_commands, ga_disable_non_whitelisted, NUL= L); + qmp_for_each_command(&ga_commands, ga_disable_not_allowed, NULL); } else { if (config->daemonize) { become_daemon(config->pid_filepath); @@ -1332,10 +1333,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->denylist =3D ga_command_denylist_init(config->denylist); + if (config->denylist) { + GList *l =3D config->denylist; + s->denylist =3D config->denylist; do { g_debug("disabling command: %s", (char *)l->data); qmp_disable_command(&ga_commands, l->data); --=20 2.26.2