From nobody Mon Feb 9 07:32:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646009933983432.11191739129583; Sun, 27 Feb 2022 16:58:53 -0800 (PST) Received: from localhost ([::1]:47518 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOUNI-0006v2-Ah for importer@patchew.org; Sun, 27 Feb 2022 19:58:52 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOUM0-00051C-1r for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:32 -0500 Received: from [2607:f8b0:4864:20::52f] (port=34561 helo=mail-pg1-x52f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOULy-0004cb-LT for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:31 -0500 Received: by mail-pg1-x52f.google.com with SMTP id 139so10066729pge.1 for ; Sun, 27 Feb 2022 16:57:30 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:6839:3c6:46aa:5d85]) by smtp.gmail.com with ESMTPSA id j1-20020a056a00130100b004df82ad0498sm10634610pfu.82.2022.02.27.16.57.27 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 27 Feb 2022 16:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E4JpDBscu6i2X5FGSRsHLHRQJcgwmq4SRaqL2cxC2ak=; b=Az1y9P3PeUKe1Sr1Ue7uu2BucYPN3bCOTIsFxs/trep6RI8bRjAquxxH1xSwgLmXX7 xyv4XYlx6o4gULNbo9Vkg72L1aWPBwulIMsqTGlnrAy4NDbWA4sSNb/PaK2oxW2fn7/r 2dO7sRIa8cmiF3L5eBqYisV2THD/sss4UzogfHE+EBmTapQI9RzDkfl7WFHJM8YceyBD 92BWabtI7Pj272MjesdfxjImNQFId3A+/PdePabmkLCzLZJf9RVz3fwINzqkDSIHaRnv WShRzACNEMFQ3Zou6r7Uu5tuz2DltBcVDGNw1FPqHtrElyJrP07DNjoaPrCp7hoEvVVG ggKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E4JpDBscu6i2X5FGSRsHLHRQJcgwmq4SRaqL2cxC2ak=; b=MKS8rfsOYoniWZ9ob5jkHlw6Gqu+MAaSrgk+s5UxLY3TH3Q+Hi4DtjpH5dhjbAjfL2 ENzUtqTHBst4x9gDm+hKgDQo6kNo+8HxL5kL/aWJhu18n++5ET0ykjmAFdLp3eJ30ZQU hjN2B7ZKmLW6nH96FUgD2/vZaxPTL7aTh3NOm5N94K8jqwJkyn52Dh9qrAwfiJPDyPXo XXwrRgxPnQoeYAkzqlhPWY5jPzVITh4vGDKEjY+YLAo6NswJdOWw5FBo4iWgNge4Ip1l U2tze5XdKkjr6dvmxZzJYo9tC4orGdD+cXGCvyBU90uGwSToj2+LMDkA9hUHT1/Geppl Yw9Q== X-Gm-Message-State: AOAM5302cfhVNnDCCXrb0hfQjt5gDoM+tkyW63k9104TgBPWw45whcLA 8qOKhszWhqHvPg9ui7SXfZBVMC/TCGk= X-Google-Smtp-Source: ABdhPJwsD/yScuz17u8KlZ3Xc2ada+5XekYNbNmUVrBYIwptDUCEBz5jOXFlbrT+gnJyM81hX9pn0A== X-Received: by 2002:a65:6a08:0:b0:374:4256:9ed8 with SMTP id m8-20020a656a08000000b0037442569ed8mr15331998pgu.79.1646009849260; Sun, 27 Feb 2022 16:57:29 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v3 1/4] cutils: Introduce bundle mechanism Date: Mon, 28 Feb 2022 09:57:06 +0900 Message-Id: <20220228005710.10442-2-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228005710.10442-1-akihiko.odaki@gmail.com> References: <20220228005710.10442-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::52f (failed) 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=2607:f8b0:4864:20::52f; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646009936304100001 Content-Type: text/plain; charset="utf-8" Developers often run QEMU without installing. The bundle mechanism allows to look up files which should be present in installation even in such a situation. It is a general mechanism and can find any files located relative to the installation tree. The build tree must have a new directory, qemu-bundle, to represent what files the installation tree would have for reference by the executables. Signed-off-by: Akihiko Odaki --- include/qemu/cutils.h | 19 +++++++++++++++++++ util/cutils.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/include/qemu/cutils.h b/include/qemu/cutils.h index 320543950c4..98ff59e38e3 100644 --- a/include/qemu/cutils.h +++ b/include/qemu/cutils.h @@ -209,6 +209,25 @@ int qemu_pstrcmp0(const char **str1, const char **str2= ); */ char *get_relocated_path(const char *dir); =20 +/** + * find_bundle: + * @path: Relative path + * + * Returns a path for the specified directory or file bundled in QEMU. It = uses + * the directory of the running executable as the prefix first. See + * get_relocated_path() for the details. The next candidate is "qemu-bundl= e" + * directory in the directory of the running executable. "qemu-bundle" + * directory is typically present in the build tree. + * + * The returned string should be freed by the caller. + * + * Returns: a path that can access the bundle, or NULL if no matching bund= le + * exists. + */ +char *find_bundle(const char *path); + +void list_bundle_candidates(const char *path); + static inline const char *yes_no(bool b) { return b ? "yes" : "no"; diff --git a/util/cutils.c b/util/cutils.c index c9b91e7535a..b4e4cda71c8 100644 --- a/util/cutils.c +++ b/util/cutils.c @@ -1057,3 +1057,36 @@ char *get_relocated_path(const char *dir) } return g_string_free(result, false); } + +static const char * const bundle_formats[] =3D { + "%s" G_DIR_SEPARATOR_S ".." G_DIR_SEPARATOR_S "%s", + "%s" G_DIR_SEPARATOR_S "qemu-bundle" G_DIR_SEPARATOR_S "%s" +}; + +char *find_bundle(const char *path) +{ + const char *dir =3D qemu_get_exec_dir(); + char *candidate; + int i; + + for (i =3D 0; i < ARRAY_SIZE(bundle_formats); i++) { + candidate =3D g_strdup_printf(bundle_formats[i], dir, path); + if (access(candidate, R_OK) =3D=3D 0) { + return candidate; + } + g_free(candidate); + } + + return NULL; +} + +void list_bundle_candidates(const char *path) +{ + const char *dir =3D qemu_get_exec_dir(); + int i; + + for (i =3D 0; i < ARRAY_SIZE(bundle_formats); i++) { + printf(bundle_formats[i], dir, path); + putc('\n', stdout); + } +} --=20 2.32.0 (Apple Git-132) From nobody Mon Feb 9 07:32:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 16460099451315.769882056442043; Sun, 27 Feb 2022 16:59:05 -0800 (PST) Received: from localhost ([::1]:48530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOUNU-0007bs-2z for importer@patchew.org; Sun, 27 Feb 2022 19:59:04 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44584) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOUMD-0005Rf-4j for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:45 -0500 Received: from [2607:f8b0:4864:20::433] (port=36833 helo=mail-pf1-x433.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOUM3-0004eQ-Pi for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:44 -0500 Received: by mail-pf1-x433.google.com with SMTP id z16so9600864pfh.3 for ; Sun, 27 Feb 2022 16:57:35 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:6839:3c6:46aa:5d85]) by smtp.gmail.com with ESMTPSA id j1-20020a056a00130100b004df82ad0498sm10634610pfu.82.2022.02.27.16.57.31 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 27 Feb 2022 16:57:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jqOyJs8JXB+RFi0kH0Q1rdJYocA7grqj4zcYRIDA1W8=; b=iEqJ4YZ3sQS8RVCz/iRFKtfCH1RV/FS0igCxyZcm6uRRGHixnlqFaO2ZYdFBy1SAdY nl5VGmb2pRYLhpNZMSQhLk5w3PSIo+i73S+FkR0R7zH6QpJDAVT6yQ4rrbNrGG9JsTws N6SW5FCPClPYoEEl6o2D/EOHi+togHO/ZjoX/MFWk8JCc5LHBBJ/nnk3qX+oloUiegsB 4PyWCzpP+e/J6VBcjpjMF0XHdNch2JNpM2nekb6+Rb/O/NLEoRydntg0WO+ay9qbE7zf eXyfUQ+LDqeg0iYKkw45Y5kdxEiJLxuzXDoRTvNbLOLHENgpMX/sozdBgih4vSBX0rNr QAvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jqOyJs8JXB+RFi0kH0Q1rdJYocA7grqj4zcYRIDA1W8=; b=6QLR11UfTLri7Z1nSQ2PMFDY8hxORVFsbtF4jUNNsL68Cdhv10GWYqnSYCLb1RSkjN yYEdUhDptee4m5tF/3QJEfbqrwfWrYde+qdJNk0AAq2NuqeeJEBgmuilA+fFHb31d+pO WhMocMlH3PUPoizZxg/tjOuOIkNvNbXLLnVtzJnzKSoUe1o6/RqIucwKftFfuoqsTExY u3kvYcMQ5ZkDdHKQgZ0nZ3lW1CNtlDy/gy4iYIs5Y5u25OAUxLMHB9BNs/HHYfXlRD8k IZHpU83lQTaZ7QMFnqgjSEGAex0sLwJ+eW19ntPcWU1ZRZT2Cpn5cB+YhkU92dsbfKq2 jCuQ== X-Gm-Message-State: AOAM530GJhp4HnhCKiHlPZ6AdFwUTDnPOt3a8Y0X45WlupYw9Y0dGNN9 SfHWWcwTWFeSUv+x1uYeoaN44ZvGrQ4= X-Google-Smtp-Source: ABdhPJww7vaIKDYP5jUveR012AX7qrrQgnlIN9mT1xn2quDN7Hjtfq8lJL1VL5W65gBE7Ec+N/UyVw== X-Received: by 2002:a05:6a00:1251:b0:4f1:2a1:3073 with SMTP id u17-20020a056a00125100b004f102a13073mr18671168pfi.72.1646009854132; Sun, 27 Feb 2022 16:57:34 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v3 2/4] datadir: Use bundle mechanism Date: Mon, 28 Feb 2022 09:57:08 +0900 Message-Id: <20220228005710.10442-4-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228005710.10442-1-akihiko.odaki@gmail.com> References: <20220228005710.10442-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::433 (failed) 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=2607:f8b0:4864:20::433; envelope-from=akihiko.odaki@gmail.com; helo=mail-pf1-x433.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646009946291100003 Content-Type: text/plain; charset="utf-8" softmmu/datadir.c had its own implementation to find files in the build tree, but now bundle mechanism provides the unified implementation which works for datadir and the other files. Signed-off-by: Akihiko Odaki --- configure | 2 ++ meson.build | 2 +- softmmu/datadir.c | 35 ++++++++++++----------------------- 3 files changed, 15 insertions(+), 24 deletions(-) diff --git a/configure b/configure index c56ed53ee36..fda1a35cbc0 100755 --- a/configure +++ b/configure @@ -3089,6 +3089,8 @@ for f in $LINKS ; do fi done =20 +symlink ../../pc-bios qemu-bundle/share/qemu + (for i in $cross_cc_vars; do export $i done diff --git a/meson.build b/meson.build index 8df40bfac4d..a2c987b41d6 100644 --- a/meson.build +++ b/meson.build @@ -1469,7 +1469,7 @@ endif config_host_data.set_quoted('CONFIG_BINDIR', get_option('prefix') / get_op= tion('bindir')) config_host_data.set_quoted('CONFIG_PREFIX', get_option('prefix')) config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', get_option('prefix') / = qemu_confdir) -config_host_data.set_quoted('CONFIG_QEMU_DATADIR', get_option('prefix') / = qemu_datadir) +config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_DATADIR', qemu_datadir) config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR', get_option('prefix')= / qemu_desktopdir) config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('qemu_f= irmwarepath')) config_host_data.set_quoted('CONFIG_QEMU_HELPERDIR', get_option('prefix') = / get_option('libexecdir')) diff --git a/softmmu/datadir.c b/softmmu/datadir.c index 504c4665bed..2d8366039d9 100644 --- a/softmmu/datadir.c +++ b/softmmu/datadir.c @@ -36,6 +36,7 @@ char *qemu_find_file(int type, const char *name) int i; const char *subdir; char *buf; + char *bundle; =20 /* Try the name as a straight path first */ if (access(name, R_OK) =3D=3D 0) { @@ -62,6 +63,16 @@ char *qemu_find_file(int type, const char *name) } g_free(buf); } + + bundle =3D g_strdup_printf("%s/%s%s", + CONFIG_QEMU_BUNDLE_DATADIR, subdir, name); + buf =3D find_bundle(bundle); + g_free(bundle); + if (buf) { + trace_load_file(name, buf); + return buf; + } + return NULL; } =20 @@ -84,26 +95,6 @@ void qemu_add_data_dir(char *path) data_dir[data_dir_idx++] =3D path; } =20 -/* - * Find a likely location for support files using the location of the bina= ry. - * When running from the build tree this will be "$bindir/pc-bios". - * Otherwise, this is CONFIG_QEMU_DATADIR (possibly relocated). - * - * The caller must use g_free() to free the returned data when it is - * no longer required. - */ -static char *find_datadir(void) -{ - g_autofree char *dir =3D NULL; - - dir =3D g_build_filename(qemu_get_exec_dir(), "pc-bios", NULL); - if (g_file_test(dir, G_FILE_TEST_IS_DIR)) { - return g_steal_pointer(&dir); - } - - return get_relocated_path(CONFIG_QEMU_DATADIR); -} - void qemu_add_default_firmwarepath(void) { char **dirs; @@ -115,9 +106,6 @@ void qemu_add_default_firmwarepath(void) qemu_add_data_dir(get_relocated_path(dirs[i])); } g_strfreev(dirs); - - /* try to find datadir relative to the executable path */ - qemu_add_data_dir(find_datadir()); } =20 void qemu_list_data_dirs(void) @@ -126,4 +114,5 @@ void qemu_list_data_dirs(void) for (i =3D 0; i < data_dir_idx; i++) { printf("%s\n", data_dir[i]); } + list_bundle_candidates(CONFIG_QEMU_BUNDLE_DATADIR); } --=20 2.32.0 (Apple Git-132) From nobody Mon Feb 9 07:32:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646010106178930.2139717756113; Sun, 27 Feb 2022 17:01:46 -0800 (PST) Received: from localhost ([::1]:53074 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOUQ4-0002Mh-0V for importer@patchew.org; Sun, 27 Feb 2022 20:01:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOUM7-0005En-NW for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:39 -0500 Received: from [2607:f8b0:4864:20::429] (port=45743 helo=mail-pf1-x429.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOUM5-0004eY-MO for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:39 -0500 Received: by mail-pf1-x429.google.com with SMTP id u16so9556605pfg.12 for ; Sun, 27 Feb 2022 16:57:37 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:6839:3c6:46aa:5d85]) by smtp.gmail.com with ESMTPSA id j1-20020a056a00130100b004df82ad0498sm10634610pfu.82.2022.02.27.16.57.34 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 27 Feb 2022 16:57:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dPuzGEBcEqdlsA6JeaKEgUYjkg87ycyuZGvU6x1HEk4=; b=a9fay6rFs2atTUwR28jt/JypWaOEuZKbbEO59GmIhtaUwJIdk57j6XoaIXyvUMLfib AXjCzTaiDeZmd2sjwx5hcgHFcwFY7KhtzjwmT7kaQa7grHDvzZ0cVwqnJB8b+ATN9Hse lCgVSAyyMKUduG4sWcwJCILzp/YveIDTyok59MyKA8Q/GlPzRaBIc2jV3jXmsKBt0UIS DQyNGceyGFhuDT/Z5Jada8Cx0ybey0LtQWhqwalROQPq1LxBiZ4IayEIPC+OBdDRKcP0 J0LUNEBSVxeiIo3G9nAQQ4vyh8+WAA7fBhZ/ZsbtWcGzpR8AT/mWAeP8XemQqmoGVwzc 1B0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dPuzGEBcEqdlsA6JeaKEgUYjkg87ycyuZGvU6x1HEk4=; b=dwqHJZkBfIMSh+6aTXLXyOe+nIo51EVJRSxBoT8sp4ydXsMBTUnktCO+4497h82AI1 oA11ko1DuJNH/HspRsl21FmYsuDY1Lhdv7i5EfsL/YyZJUHlocF/RqXEtRNmmHzEzm+4 AatAovApPAam7Ze803FjFVSuW43GK730UcJgI7YH0+pxUwyw0kOKtmKwwLVFO724Qk/j CYkD704Q7m9v9EyNcFb2aDxqP2ah2G7BoG8SgF3/Sy4AyB/gZPfAx17bb0M+zHuYCVN3 wGDUryPJgZt5oeXizSr42GHfKHgrXR0DcUBFQk08ZOs8NOEudxkqcylDBWs48MzHkRhX K3eg== X-Gm-Message-State: AOAM530lV/wEsmySKqa2BcUCaiVrxsk1nxo7truHUYXiMkiYrhglxLdN MB3ztS0lG9KH+rwhfXlEAaC6LTn2FQc= X-Google-Smtp-Source: ABdhPJwGLyn3PI9cVDqcnDWNLdbeOo1enxJRFix4OdzIedKfk37Q/jrzkdG1TDEbjN86Efk8fwe+Cw== X-Received: by 2002:a63:2c91:0:b0:373:7200:d079 with SMTP id s139-20020a632c91000000b003737200d079mr15328518pgs.65.1646009856334; Sun, 27 Feb 2022 16:57:36 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v3 3/4] ui/icons: Use bundle mechanism Date: Mon, 28 Feb 2022 09:57:09 +0900 Message-Id: <20220228005710.10442-5-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228005710.10442-1-akihiko.odaki@gmail.com> References: <20220228005710.10442-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::429 (failed) 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=2607:f8b0:4864:20::429; envelope-from=akihiko.odaki@gmail.com; helo=mail-pf1-x429.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646010107485100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Akihiko Odaki --- configure | 10 ++++++++++ meson.build | 3 +-- ui/cocoa.m | 20 +++++++++++--------- ui/gtk.c | 8 +++++--- ui/sdl2.c | 18 +++++++++++------- 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/configure b/configure index fda1a35cbc0..80d36a85bc5 100755 --- a/configure +++ b/configure @@ -3089,6 +3089,16 @@ for f in $LINKS ; do fi done =20 +for icon_extension in bmp png ; do + for icon_file in $source_path/ui/icons/qemu_*.$icon_extension ; do + icon_basename=3D${icon_file%.$icon_extension} + icon_name=3D${icon_basename#$source_path/ui/icons/qemu_} + icon_dir=3Dqemu-bundle/share/icons/hicolor/$icon_name/apps + symlink $icon_file $icon_dir/qemu.$icon_extension + done +done + +symlink $source_path/ui/icons/qemu.svg qemu-bundle/share/icons/hicolor/sca= lable/apps/qemu.svg symlink ../../pc-bios qemu-bundle/share/qemu =20 (for i in $cross_cc_vars; do diff --git a/meson.build b/meson.build index a2c987b41d6..f7e64a74545 100644 --- a/meson.build +++ b/meson.build @@ -1472,8 +1472,7 @@ config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', ge= t_option('prefix') / qemu_c config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_DATADIR', qemu_datadir) config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR', get_option('prefix')= / qemu_desktopdir) config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('qemu_f= irmwarepath')) -config_host_data.set_quoted('CONFIG_QEMU_HELPERDIR', get_option('prefix') = / get_option('libexecdir')) -config_host_data.set_quoted('CONFIG_QEMU_ICONDIR', get_option('prefix') / = qemu_icondir) +config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_ICONDIR', qemu_icondir) config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix') = / get_option('localedir')) config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefi= x') / get_option('localstatedir')) config_host_data.set_quoted('CONFIG_QEMU_MODDIR', get_option('prefix') / q= emu_moddir) diff --git a/ui/cocoa.m b/ui/cocoa.m index a8f1cdaf926..e5e49c50fbb 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -1477,15 +1477,17 @@ - (void)make_about_window NSRect picture_rect =3D NSMakeRect(x, y, picture_width, picture_height= ); =20 /* Make the picture of QEMU */ - NSImageView *picture_view =3D [[NSImageView alloc] initWithFrame: - picture_rect]; - char *qemu_image_path_c =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/h= icolor/512x512/apps/qemu.png"); - NSString *qemu_image_path =3D [NSString stringWithUTF8String:qemu_imag= e_path_c]; - g_free(qemu_image_path_c); - NSImage *qemu_image =3D [[NSImage alloc] initWithContentsOfFile:qemu_i= mage_path]; - [picture_view setImage: qemu_image]; - [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown]; - [superView addSubview: picture_view]; + char *qemu_image_path_c =3D find_bundle(CONFIG_QEMU_BUNDLE_ICONDIR "/h= icolor/512x512/apps/qemu.png"); + if (qemu_image_path_c) { + NSString *qemu_image_path =3D [NSString stringWithUTF8String:qemu_= image_path_c]; + g_free(qemu_image_path_c); + NSImageView *picture_view =3D [[NSImageView alloc] initWithFrame: + picture_rect]; + NSImage *qemu_image =3D [[NSImage alloc] initWithContentsOfFile:qe= mu_image_path]; + [picture_view setImage: qemu_image]; + [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown]; + [superView addSubview: picture_view]; + } =20 /* Make the name label */ NSBundle *bundle =3D [NSBundle mainBundle]; diff --git a/ui/gtk.c b/ui/gtk.c index a8567b9ddc8..a86d1c126f0 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -2296,9 +2296,11 @@ static void gtk_display_init(DisplayState *ds, Displ= ayOptions *opts) s->opts =3D opts; =20 theme =3D gtk_icon_theme_get_default(); - dir =3D get_relocated_path(CONFIG_QEMU_ICONDIR); - gtk_icon_theme_prepend_search_path(theme, dir); - g_free(dir); + dir =3D find_bundle(CONFIG_QEMU_BUNDLE_ICONDIR); + if (dir) { + gtk_icon_theme_prepend_search_path(theme, dir); + g_free(dir); + } g_set_prgname("qemu"); =20 s->window =3D gtk_window_new(GTK_WINDOW_TOPLEVEL); diff --git a/ui/sdl2.c b/ui/sdl2.c index 46a252d7d9d..9d1f6e74cb5 100644 --- a/ui/sdl2.c +++ b/ui/sdl2.c @@ -893,15 +893,19 @@ static void sdl2_display_init(DisplayState *ds, Displ= ayOptions *o) } =20 #ifdef CONFIG_SDL_IMAGE - dir =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/128x128/apps/= qemu.png"); - icon =3D IMG_Load(dir); + dir =3D find_bundle(CONFIG_QEMU_BUNDLE_ICONDIR "/hicolor/128x128/apps/= qemu.png"); + if (dir) { + icon =3D IMG_Load(dir); + } #else /* Load a 32x32x4 image. White pixels are transparent. */ - dir =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor/32x32/apps/qe= mu.bmp"); - icon =3D SDL_LoadBMP(dir); - if (icon) { - uint32_t colorkey =3D SDL_MapRGB(icon->format, 255, 255, 255); - SDL_SetColorKey(icon, SDL_TRUE, colorkey); + dir =3D find_bundle(CONFIG_QEMU_BUNDLE_ICONDIR "/hicolor/32x32/apps/qe= mu.bmp"); + if (dir) { + icon =3D SDL_LoadBMP(dir); + if (icon) { + uint32_t colorkey =3D SDL_MapRGB(icon->format, 255, 255, 255); + SDL_SetColorKey(icon, SDL_TRUE, colorkey); + } } #endif g_free(dir); --=20 2.32.0 (Apple Git-132) From nobody Mon Feb 9 07:32:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646010226370840.8486546400368; Sun, 27 Feb 2022 17:03:46 -0800 (PST) Received: from localhost ([::1]:59132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOUS1-0006cR-ES for importer@patchew.org; Sun, 27 Feb 2022 20:03:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44582) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOUMA-0005Li-Ap for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:42 -0500 Received: from [2607:f8b0:4864:20::102b] (port=56084 helo=mail-pj1-x102b.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOUM7-0004ev-VN for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:41 -0500 Received: by mail-pj1-x102b.google.com with SMTP id gb21so9679674pjb.5 for ; Sun, 27 Feb 2022 16:57:39 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:6839:3c6:46aa:5d85]) by smtp.gmail.com with ESMTPSA id j1-20020a056a00130100b004df82ad0498sm10634610pfu.82.2022.02.27.16.57.36 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 27 Feb 2022 16:57:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=o3yYCKAK4PyDr13xPU5WQLsZEQoxfNSDnsUZjZq2iaU=; b=Ya52YTASGIjYLFKIAsiAIZpBbfpLxJhaqumJfuvOsgNQMBEviQZ9wVeaskv6rW8M4G 5VVB2aZZVb4wVO7IWkcpED3kpKPw1vXEkX/8QStJVrGVqS0IpSYkPDotqEK+d+MAfavp +SmdNfV6qp52jFI1yeK5F8wSrv8P2mJMNHV9SdVi76HnN/hR/b0L8eYdXOGKvJ3cn9km +2qQbf7PU0QgDtSpPGKDawNZDCptN6Ss6z8pU6LH+m/8VxEIz75O5VH2ISDT12Czb514 xBm9+ukSOaac5c/T3EhAwIJo9Jeczy8Ew/LXQzWYV2s4V+0QRZNvY2RNH7g1QD7jp2qV z2sA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=o3yYCKAK4PyDr13xPU5WQLsZEQoxfNSDnsUZjZq2iaU=; b=3Mr3Lq1ytZeWaUvy7pc5f2JJp1tmH0JcsWFBe3va++yYGV7Y70R1haGS/0gM+pTPng 1mNRXlAu7psdwVGEYdn3gqVwD+3+tuiGWLQ00pciFIjjyqWkRhwCyKXX3QeVNBqd7U0T u3B/m5mpRHyPjX82eRNNx3gwYIDBi49T5cSvdfWUvEbPPSbITrlvwXeVgHcbtNMDfEcm Xs2uFVTIBjdHdOH116Q3yvl6m6F6ta0YuuQQkbde3+rFELzJlQe6ZXZ0mN0HojaHfR7d UU5g6T5ZhuLVt37ncbnwIa45NF7cjpV7enbQUrf888Kt+ilJMiF6zzdjO3ot+2ldu9pd PjKQ== X-Gm-Message-State: AOAM5337M+z5iqsdNOzU/rVXmJG1kVG8JLra93/V/TYDB7T3WycPsQSQ Mc5EDNGXbHn8NJ+ndgh01jwsNwrCCd4= X-Google-Smtp-Source: ABdhPJwAHkMgy/bxldgAJFLOZkzVRvqL3m7Uf/QexVVgkLt+229SOh+MFrw+E8zMskAxbOXrW+SjdA== X-Received: by 2002:a17:90a:ab93:b0:1b8:831d:2ee4 with SMTP id n19-20020a17090aab9300b001b8831d2ee4mr14052734pjq.123.1646009858504; Sun, 27 Feb 2022 16:57:38 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH v3 4/4] net: Use bundle mechanism Date: Mon, 28 Feb 2022 09:57:10 +0900 Message-Id: <20220228005710.10442-6-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228005710.10442-1-akihiko.odaki@gmail.com> References: <20220228005710.10442-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102b (failed) 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=2607:f8b0:4864:20::102b; envelope-from=akihiko.odaki@gmail.com; helo=mail-pj1-x102b.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646010229232100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Akihiko Odaki --- configure | 1 + include/net/net.h | 2 +- meson.build | 1 + net/tap.c | 6 +++++- qemu-options.hx | 4 ++-- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 80d36a85bc5..63df8f5886e 100755 --- a/configure +++ b/configure @@ -3100,6 +3100,7 @@ done =20 symlink $source_path/ui/icons/qemu.svg qemu-bundle/share/icons/hicolor/sca= lable/apps/qemu.svg symlink ../../pc-bios qemu-bundle/share/qemu +symlink ../../qemu-bridge-helper qemu-bundle/libexec/qemu-bridge-helper =20 (for i in $cross_cc_vars; do export $i diff --git a/include/net/net.h b/include/net/net.h index 523136c7acb..4a5ed27a4b7 100644 --- a/include/net/net.h +++ b/include/net/net.h @@ -228,7 +228,7 @@ NetClientState *net_hub_port_find(int hub_id); =20 #define DEFAULT_NETWORK_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifup" #define DEFAULT_NETWORK_DOWN_SCRIPT CONFIG_SYSCONFDIR "/qemu-ifdown" -#define DEFAULT_BRIDGE_HELPER CONFIG_QEMU_HELPERDIR "/qemu-bridge-helper" +#define DEFAULT_BUNDLE_BRIDGE_HELPER CONFIG_QEMU_BUNDLE_HELPERDIR "/qemu-b= ridge-helper" #define DEFAULT_BRIDGE_INTERFACE "br0" =20 void qdev_set_nic_properties(DeviceState *dev, NICInfo *nd); diff --git a/meson.build b/meson.build index f7e64a74545..95ee0a7c14e 100644 --- a/meson.build +++ b/meson.build @@ -1472,6 +1472,7 @@ config_host_data.set_quoted('CONFIG_QEMU_CONFDIR', ge= t_option('prefix') / qemu_c config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_DATADIR', qemu_datadir) config_host_data.set_quoted('CONFIG_QEMU_DESKTOPDIR', get_option('prefix')= / qemu_desktopdir) config_host_data.set_quoted('CONFIG_QEMU_FIRMWAREPATH', get_option('qemu_f= irmwarepath')) +config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_HELPERDIR', get_option('li= bexecdir')) config_host_data.set_quoted('CONFIG_QEMU_BUNDLE_ICONDIR', qemu_icondir) config_host_data.set_quoted('CONFIG_QEMU_LOCALEDIR', get_option('prefix') = / get_option('localedir')) config_host_data.set_quoted('CONFIG_QEMU_LOCALSTATEDIR', get_option('prefi= x') / get_option('localstatedir')) diff --git a/net/tap.c b/net/tap.c index c5cbeaa7a2b..91415cd376c 100644 --- a/net/tap.c +++ b/net/tap.c @@ -508,7 +508,11 @@ static int net_bridge_run_helper(const char *helper, c= onst char *bridge, sigprocmask(SIG_BLOCK, &mask, &oldmask); =20 if (!helper) { - helper =3D default_helper =3D get_relocated_path(DEFAULT_BRIDGE_HE= LPER); + helper =3D default_helper =3D find_bundle(DEFAULT_BUNDLE_BRIDGE_HE= LPER); + if (!helper) { + error_setg(errp, "bridge helper not found"); + return -1; + } } =20 if (socketpair(PF_UNIX, SOCK_STREAM, 0, sv) =3D=3D -1) { diff --git a/qemu-options.hx b/qemu-options.hx index 094a6c1d7c2..a5c03e2caf3 100644 --- a/qemu-options.hx +++ b/qemu-options.hx @@ -2665,7 +2665,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, " to configure it and 'dfile' (default=3D" DEFAULT_NETW= ORK_DOWN_SCRIPT ")\n" " to deconfigure it\n" " use '[down]script=3Dno' to disable script execution\n" - " use network helper 'helper' (default=3D" DEFAULT_BRID= GE_HELPER ") to\n" + " use network helper 'helper' (default=3D" DEFAULT_BUND= LE_BRIDGE_HELPER ") to\n" " configure it\n" " use 'fd=3Dh' to connect to an already opened TAP inte= rface\n" " use 'fds=3Dx:y:...:z' to connect to already opened mu= ltiqueue capable TAP interfaces\n" @@ -2684,7 +2684,7 @@ DEF("netdev", HAS_ARG, QEMU_OPTION_netdev, "-netdev bridge,id=3Dstr[,br=3Dbridge][,helper=3Dhelper]\n" " configure a host TAP network backend with ID 'str' th= at is\n" " connected to a bridge (default=3D" DEFAULT_BRIDGE_INT= ERFACE ")\n" - " using the program 'helper (default=3D" DEFAULT_BRIDGE= _HELPER ")\n" + " using the program 'helper (default=3D" DEFAULT_BUNDLE= _BRIDGE_HELPER ")\n" #endif #ifdef __linux__ "-netdev l2tpv3,id=3Dstr,src=3Dsrcaddr,dst=3Ddstaddr[,srcport=3Dsrcpor= t][,dstport=3Ddstport]\n" --=20 2.32.0 (Apple Git-132) From nobody Mon Feb 9 07:32:11 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1646010115323951.7735932292703; Sun, 27 Feb 2022 17:01:55 -0800 (PST) Received: from localhost ([::1]:53412 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nOUQE-0002bO-3t for importer@patchew.org; Sun, 27 Feb 2022 20:01:54 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44542) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nOUM2-00055p-KT for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:34 -0500 Received: from [2607:f8b0:4864:20::536] (port=46952 helo=mail-pg1-x536.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nOUM0-0004cs-TA for qemu-devel@nongnu.org; Sun, 27 Feb 2022 19:57:34 -0500 Received: by mail-pg1-x536.google.com with SMTP id o23so10017514pgk.13 for ; Sun, 27 Feb 2022 16:57:32 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c360:8200:6839:3c6:46aa:5d85]) by smtp.gmail.com with ESMTPSA id j1-20020a056a00130100b004df82ad0498sm10634610pfu.82.2022.02.27.16.57.29 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 27 Feb 2022 16:57:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IM6VwbNeSlgOErfo82BYeQWh1KPCm7vngBaTl/7ROWk=; b=fGXkQ0O7AE16WlSe2voh4qSbluwwuyT8+1dGKUpUDsISq2lX9tvrd97W8HvXiA4Pb+ vCMWmYyTYLRuhVrwGe8EWKuTtRiFpKxq9OcVzn8fCTRfa9dSIOy6RHQtmwYPxkrHImc6 Q4HXmc3ftc7eXd5c+F3jvai4kzcxFZpnX9vEcjGnAl1iRp/16wnA4ujM375BHO/xBTbQ 3ZvNcAj9FP3lR56csIO3cYiHhAb5/UmsndWm+ecID3vyA0HlWyrNC8uYjMCmuaxB01HB C0TDN1a+C1zgYKyonbDdRzKsTqAFMzC+IsaFZQQWkAnjEDUxY6BqwN4+Iz5AMabmvxbB zmnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IM6VwbNeSlgOErfo82BYeQWh1KPCm7vngBaTl/7ROWk=; b=BSA+HkBoCyFe9+G/g/J3QgqJXYtILItSMzqLxaEu6NesL6GKgLLMAdA91xiq4rDT8H u3jjdUxPz10lzo8JvZSNW8lOogotX4wQUxCZ3u1yw7Huas+V4ANeukP6eyRP9UiWAO9a 3iVQy83mVc+QINxKBpVm7Lji3RV18uTZZU9bbpRdPPDa2/26vO118fKCMMzFjn3nvJhQ Tw0p3Fe0APcZXlsHgBDojWpyFjMubgjogYEeXeOjBReQ93SwAIh/R0y5n+pI7jtbJ9tR SxmrKcRC0cVggsDTBFgXblcYWL0rlYUspTw7yU6PkT4y8ysmNWjG6BoZx3vHGT9U8ysh 6iEQ== X-Gm-Message-State: AOAM5316f+e9nKEiAtUYJuZFg7/xsaSfvww5lh+7opZWDt6IU2DyBpQz ppjYT5yt6Vxk2SkZVn3Smv+Eql/xJQo= X-Google-Smtp-Source: ABdhPJwgUFyHZlHgN72HahYm1ktZQ4BG1F76cUJtypBpc9ou55NkRhKE+/RZfq0CwBywSYVN+WHjtw== X-Received: by 2002:a63:ef4f:0:b0:375:6898:f6b8 with SMTP id c15-20020a63ef4f000000b003756898f6b8mr15236768pgk.59.1646009851491; Sun, 27 Feb 2022 16:57:31 -0800 (PST) From: Akihiko Odaki To: Subject: [PATCH] ui/cocoa: Use the standard about panel Date: Mon, 28 Feb 2022 09:57:07 +0900 Message-Id: <20220228005710.10442-3-akihiko.odaki@gmail.com> X-Mailer: git-send-email 2.32.0 (Apple Git-132) In-Reply-To: <20220228005710.10442-1-akihiko.odaki@gmail.com> References: <20220228005710.10442-1-akihiko.odaki@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::536 (failed) 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=2607:f8b0:4864:20::536; envelope-from=akihiko.odaki@gmail.com; helo=mail-pg1-x536.google.com X-Spam_score_int: -6 X-Spam_score: -0.7 X-Spam_bar: / X-Spam_report: (-0.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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: Peter Maydell , Jason Wang , qemu-devel@nongnu.org, Programmingkid , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Akihiko Odaki Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1646010117521100001 Content-Type: text/plain; charset="utf-8" This provides standard look and feel for the about panel and reduces code. Signed-off-by: Akihiko Odaki --- ui/cocoa.m | 112 +++++++++++------------------------------------------ 1 file changed, 23 insertions(+), 89 deletions(-) diff --git a/ui/cocoa.m b/ui/cocoa.m index a8f1cdaf926..59672fee775 100644 --- a/ui/cocoa.m +++ b/ui/cocoa.m @@ -83,7 +83,7 @@ static void cocoa_switch(DisplayChangeListener *dcl, =20 static void cocoa_refresh(DisplayChangeListener *dcl); =20 -static NSWindow *normalWindow, *about_window; +static NSWindow *normalWindow; static const DisplayChangeListenerOps dcl_ops =3D { .dpy_name =3D "cocoa", .dpy_gfx_update =3D cocoa_update, @@ -1120,7 +1120,6 @@ - (void)changeDeviceMedia:(id)sender; - (BOOL)verifyQuit; - (void)openDocumentation:(NSString *)filename; - (IBAction) do_about_menu_item: (id) sender; -- (void)make_about_window; - (void)adjustSpeed:(id)sender; @end =20 @@ -1166,8 +1165,6 @@ - (id) init [pauseLabel setFont: [NSFont fontWithName: @"Helvetica" size: 90]]; [pauseLabel setTextColor: [NSColor blackColor]]; [pauseLabel sizeToFit]; - - [self make_about_window]; } return self; } @@ -1451,92 +1448,29 @@ - (BOOL)verifyQuit /* The action method for the About menu item */ - (IBAction) do_about_menu_item: (id) sender { - [about_window makeKeyAndOrderFront: nil]; -} - -/* Create and display the about dialog */ -- (void)make_about_window -{ - /* Make the window */ - int x =3D 0, y =3D 0, about_width =3D 400, about_height =3D 200; - NSRect window_rect =3D NSMakeRect(x, y, about_width, about_height); - about_window =3D [[NSWindow alloc] initWithContentRect:window_rect - styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskC= losable | - NSWindowStyleMaskMiniaturizable - backing:NSBackingStoreBuffered - defer:NO]; - [about_window setTitle: @"About"]; - [about_window setReleasedWhenClosed: NO]; - [about_window center]; - NSView *superView =3D [about_window contentView]; - - /* Create the dimensions of the picture */ - int picture_width =3D 80, picture_height =3D 80; - x =3D (about_width - picture_width)/2; - y =3D about_height - picture_height - 10; - NSRect picture_rect =3D NSMakeRect(x, y, picture_width, picture_height= ); - - /* Make the picture of QEMU */ - NSImageView *picture_view =3D [[NSImageView alloc] initWithFrame: - picture_rect]; - char *qemu_image_path_c =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/h= icolor/512x512/apps/qemu.png"); - NSString *qemu_image_path =3D [NSString stringWithUTF8String:qemu_imag= e_path_c]; - g_free(qemu_image_path_c); - NSImage *qemu_image =3D [[NSImage alloc] initWithContentsOfFile:qemu_i= mage_path]; - [picture_view setImage: qemu_image]; - [picture_view setImageScaling: NSImageScaleProportionallyUpOrDown]; - [superView addSubview: picture_view]; - - /* Make the name label */ - NSBundle *bundle =3D [NSBundle mainBundle]; - if (bundle) { - x =3D 0; - y =3D y - 25; - int name_width =3D about_width, name_height =3D 20; - NSRect name_rect =3D NSMakeRect(x, y, name_width, name_height); - NSTextField *name_label =3D [[NSTextField alloc] initWithFrame: na= me_rect]; - [name_label setEditable: NO]; - [name_label setBezeled: NO]; - [name_label setDrawsBackground: NO]; - [name_label setAlignment: NSTextAlignmentCenter]; - NSString *qemu_name =3D [[bundle executablePath] lastPathComponent= ]; - [name_label setStringValue: qemu_name]; - [superView addSubview: name_label]; + NSAutoreleasePool *pool =3D [[NSAutoreleasePool alloc] init]; + char *icon_path_c =3D get_relocated_path(CONFIG_QEMU_ICONDIR "/hicolor= /512x512/apps/qemu.png"); + NSString *icon_path =3D [NSString stringWithUTF8String:icon_path_c]; + g_free(icon_path_c); + NSImage *icon =3D [[NSImage alloc] initWithContentsOfFile:icon_path]; + NSString *version =3D @"QEMU emulator version " QEMU_FULL_VERSION; + NSString *copyright =3D @QEMU_COPYRIGHT; + NSDictionary *options; + if (icon) { + options =3D @{ + NSAboutPanelOptionApplicationIcon : icon, + NSAboutPanelOptionApplicationVersion : version, + @"Copyright" : copyright, + }; + [icon release]; + } else { + options =3D @{ + NSAboutPanelOptionApplicationVersion : version, + @"Copyright" : copyright, + }; } - - /* Set the version label's attributes */ - x =3D 0; - y =3D 50; - int version_width =3D about_width, version_height =3D 20; - NSRect version_rect =3D NSMakeRect(x, y, version_width, version_height= ); - NSTextField *version_label =3D [[NSTextField alloc] initWithFrame: - version_rect]; - [version_label setEditable: NO]; - [version_label setBezeled: NO]; - [version_label setAlignment: NSTextAlignmentCenter]; - [version_label setDrawsBackground: NO]; - - /* Create the version string*/ - NSString *version_string; - version_string =3D [[NSString alloc] initWithFormat: - @"QEMU emulator version %s", QEMU_FULL_VERSION]; - [version_label setStringValue: version_string]; - [superView addSubview: version_label]; - - /* Make copyright label */ - x =3D 0; - y =3D 35; - int copyright_width =3D about_width, copyright_height =3D 20; - NSRect copyright_rect =3D NSMakeRect(x, y, copyright_width, copyright_= height); - NSTextField *copyright_label =3D [[NSTextField alloc] initWithFrame: - copyright_rect]; - [copyright_label setEditable: NO]; - [copyright_label setBezeled: NO]; - [copyright_label setDrawsBackground: NO]; - [copyright_label setAlignment: NSTextAlignmentCenter]; - [copyright_label setStringValue: [NSString stringWithFormat: @"%s", - QEMU_COPYRIGHT]]; - [superView addSubview: copyright_label]; + [NSApp orderFrontStandardAboutPanelWithOptions:options]; + [pool release]; } =20 /* Used by the Speed menu items */ --=20 2.32.0 (Apple Git-132)