From patchwork Wed Jun 15 10:52:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= X-Patchwork-Id: 1643627 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=GB4mxW2c; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4LNMc90DwTz9tk1 for ; Wed, 15 Jun 2022 20:53:43 +1000 (AEST) Received: from localhost ([::1]:56378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1QeZ-0003Bj-Vf for incoming@patchwork.ozlabs.org; Wed, 15 Jun 2022 06:53:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58026) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1QdN-0003BG-PH for qemu-devel@nongnu.org; Wed, 15 Jun 2022 06:52:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:54822) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1QdJ-0001x2-QC for qemu-devel@nongnu.org; Wed, 15 Jun 2022 06:52:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655290340; 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=NrAwvBCYT029c5ubdiWv1r43fcVPYpoLg3lO5cQ/gIg=; b=GB4mxW2cEDwfTsjdZtB0APElkHV9FOYFKFT6beTGHYABIBOSxpZpJtXReFlgrORC9rj4jF Yir6p59tJ4zoJi61Ah+2pLvmwUnr58HudlMmLfTox2My4RLhapvtMK93PUfAbl1A0hl8ly O5Aa90ibwi4jnCTXZF5pFBLVxuhtTVA= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-459-OaKTQSHHP9KXA05eWHKqqA-1; Wed, 15 Jun 2022 06:52:17 -0400 X-MC-Unique: OaKTQSHHP9KXA05eWHKqqA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 208451C3E984; Wed, 15 Jun 2022 10:52:17 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.33.36.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1BD1F111F5; Wed, 15 Jun 2022 10:52:13 +0000 (UTC) From: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= To: qemu-devel@nongnu.org Cc: Alexander Bulekov , Bandan Das , Thomas Huth , =?utf-8?q?Volker_R=C3=BCmelin?= , Darren Kenny , Qiuhao Li , Jason Wang , Peter Maydell , Akihiko Odaki , Stefan Hajnoczi , Laurent Vivier , Paolo Bonzini , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= Subject: [PATCH v3 0/4] softmmu: make qemu_find_file more flexible wrt build dir layout Date: Wed, 15 Jun 2022 11:52:08 +0100 Message-Id: <20220615105212.780256-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" The qemu_find_file method impl is rather crude with a variety of problems (detailed in commit message of first patch). This series addresses those problems, making qemu_find_file much more flexible and able to be trivially extended to find any type of file, both in a (optionally relocated) install tree location and the local build tree. This is proposed as an alternative to https://lists.gnu.org/archive/html/qemu-devel/2022-06/msg02589.html avoiding the need to add many more meson rules to simulate results of 'make install' in the build dir. It has been tested as follows: mkdir -p build/quick cd build/quick ./configure --target-list=x86_64-softmmu --prefix=/usr make -j 8 install DESTDIR=`pwd`/../vroot Now running from build dir: $ ./build/local/qemu-system-x86_64 -vnc :1 -k fr -trace 'datadir*' -display sdl datadir_init default data dir /home/berrange/src/virt/qemu/build/local/../share/qemu icon dir /home/berrange/src/virt/qemu/build/local/../share/icons helper dir /home/berrange/src/virt/qemu/build/local/../libexec in build dir 1 datadir_load_file name bios-256k.bin location /home/berrange/src/virt/qemu/build/local/pc-bios/bios-256k.bin errno 0 datadir_load_file name bios-256k.bin location /home/berrange/src/virt/qemu/build/local/pc-bios/bios-256k.bin errno 0 datadir_load_file name kvmvapic.bin location /home/berrange/src/virt/qemu/build/local/pc-bios/kvmvapic.bin errno 0 datadir_load_file name vgabios-stdvga.bin location /home/berrange/src/virt/qemu/build/local/pc-bios/vgabios-stdvga.bin errno 0 datadir_load_file name efi-e1000.rom location /home/berrange/src/virt/qemu/build/local/pc-bios/efi-e1000.rom errno 0 datadir_load_file name 128x128/apps/qemu.png location /home/berrange/src/virt/qemu/build/local/ui/icons/128x128/apps/qemu.png errno 0 datadir_load_file name fr location /home/berrange/src/virt/qemu/build/local/ui/keymaps/fr errno 0 $ ./build/local/qemu-system-x86_64 -vnc :1 -k fr -trace 'datadir*' -display sdl -net bridge datadir_init default data dir /home/berrange/src/virt/qemu/build/local/../share/qemu icon dir /home/berrange/src/virt/qemu/build/local/../share/icons helper dir /home/berrange/src/virt/qemu/build/local/../libexec in build dir 1 datadir_load_file name qemu-bridge-helper location /home/berrange/src/virt/qemu/build/local/qemu-bridge-helper errno 0 Helper /home/berrange/src/virt/qemu/build/local/qemu-bridge-helper access denied by acl file And running from the (relocated) install dir: $ ./build/vroot/usr/bin/qemu-system-x86_64 -vnc :1 -k fr -trace 'datadir*' -display sdl datadir_init default data dir /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu icon dir /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/icons helper dir /home/berrange/src/virt/qemu/build/vroot/usr/bin/../libexec in build dir 0 datadir_load_file name bios-256k.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../qemu-firmware/bios-256k.bin errno 2 datadir_load_file name bios-256k.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu/bios-256k.bin errno 0 datadir_load_file name bios-256k.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../qemu-firmware/bios-256k.bin errno 2 datadir_load_file name bios-256k.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu/bios-256k.bin errno 0 datadir_load_file name kvmvapic.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../qemu-firmware/kvmvapic.bin errno 2 datadir_load_file name kvmvapic.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu/kvmvapic.bin errno 0 datadir_load_file name vgabios-stdvga.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../qemu-firmware/vgabios-stdvga.bin errno 2 datadir_load_file name vgabios-stdvga.bin location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu/vgabios-stdvga.bin errno 0 datadir_load_file name efi-e1000.rom location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../qemu-firmware/efi-e1000.rom errno 2 datadir_load_file name efi-e1000.rom location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu/efi-e1000.rom errno 0 datadir_load_file name 128x128/apps/qemu.png location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/icons/hicolor/128x128/apps/qemu.png errno 0 datadir_load_file name fr location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu/keymaps/fr errno 0 $ ./build/vroot/usr/bin/qemu-system-x86_64 -vnc :1 -k fr -trace 'datadir*' -display sdl -net bridge datadir_init default data dir /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/qemu icon dir /home/berrange/src/virt/qemu/build/vroot/usr/bin/../share/icons helper dir /home/berrange/src/virt/qemu/build/vroot/usr/bin/../libexec in build dir 0 datadir_load_file name qemu-bridge-helper location /home/berrange/src/virt/qemu/build/vroot/usr/bin/../libexec/qemu-bridge-helper errno 0 Helper /home/berrange/src/virt/qemu/build/vroot/usr/bin/../libexec/qemu-bridge-helper access denied by acl file These trace messages show it searching the correct paths to find the files in both installed and build root cases. NB, I've been unable to actually test the cocoa.m change since I lack macOS. Daniel P. Berrangé (4): softmmu: rewrite handling of qemu_find_file ui: move 'pc-bios/keymaps' to 'ui/keymaps' ui: find icons using qemu_find_file net: convert to use qemu_find_file to locate bridge helper configure | 1 + docs/conf.py | 4 +- include/net/net.h | 3 +- include/qemu/datadir.h | 8 +- net/tap.c | 5 +- pc-bios/meson.build | 1 - qemu-options.hx | 4 +- softmmu/datadir.c | 164 +++++++++++------- softmmu/trace-events | 5 +- softmmu/vl.c | 2 +- tests/qtest/fuzz/fuzz.c | 2 +- ui/cocoa.m | 3 +- ui/gtk.c | 3 +- .../apps/qemu.png} | Bin .../{qemu_16x16.png => 16x16/apps/qemu.png} | Bin .../{qemu_24x24.png => 24x24/apps/qemu.png} | Bin .../apps/qemu.png} | Bin .../{qemu_32x32.bmp => 32x32/apps/qemu.bmp} | Bin .../{qemu_32x32.png => 32x32/apps/qemu.png} | Bin .../{qemu_48x48.png => 48x48/apps/qemu.png} | Bin .../apps/qemu.png} | Bin .../{qemu_64x64.png => 64x64/apps/qemu.png} | Bin ui/icons/meson.build | 27 ++- ui/icons/{ => scalable/apps}/qemu.svg | 0 {pc-bios => ui}/keymaps/ar | 0 {pc-bios => ui}/keymaps/bepo | 0 {pc-bios => ui}/keymaps/cz | 0 {pc-bios => ui}/keymaps/da | 0 {pc-bios => ui}/keymaps/de | 0 {pc-bios => ui}/keymaps/de-ch | 0 {pc-bios => ui}/keymaps/en-gb | 0 {pc-bios => ui}/keymaps/en-us | 0 {pc-bios => ui}/keymaps/es | 0 {pc-bios => ui}/keymaps/et | 0 {pc-bios => ui}/keymaps/fi | 0 {pc-bios => ui}/keymaps/fo | 0 {pc-bios => ui}/keymaps/fr | 0 {pc-bios => ui}/keymaps/fr-be | 0 {pc-bios => ui}/keymaps/fr-ca | 0 {pc-bios => ui}/keymaps/fr-ch | 0 {pc-bios => ui}/keymaps/hr | 0 {pc-bios => ui}/keymaps/hu | 0 {pc-bios => ui}/keymaps/is | 0 {pc-bios => ui}/keymaps/it | 0 {pc-bios => ui}/keymaps/ja | 0 {pc-bios => ui}/keymaps/lt | 0 {pc-bios => ui}/keymaps/lv | 0 {pc-bios => ui}/keymaps/meson.build | 0 {pc-bios => ui}/keymaps/mk | 0 {pc-bios => ui}/keymaps/nl | 0 {pc-bios => ui}/keymaps/no | 0 {pc-bios => ui}/keymaps/pl | 0 {pc-bios => ui}/keymaps/pt | 0 {pc-bios => ui}/keymaps/pt-br | 0 {pc-bios => ui}/keymaps/ru | 0 {pc-bios => ui}/keymaps/sl | 0 {pc-bios => ui}/keymaps/sv | 0 {pc-bios => ui}/keymaps/th | 0 {pc-bios => ui}/keymaps/tr | 0 ui/meson.build | 1 + ui/sdl2.c | 5 +- 61 files changed, 152 insertions(+), 86 deletions(-) rename ui/icons/{qemu_128x128.png => 128x128/apps/qemu.png} (100%) rename ui/icons/{qemu_16x16.png => 16x16/apps/qemu.png} (100%) rename ui/icons/{qemu_24x24.png => 24x24/apps/qemu.png} (100%) rename ui/icons/{qemu_256x256.png => 256x256/apps/qemu.png} (100%) rename ui/icons/{qemu_32x32.bmp => 32x32/apps/qemu.bmp} (100%) rename ui/icons/{qemu_32x32.png => 32x32/apps/qemu.png} (100%) rename ui/icons/{qemu_48x48.png => 48x48/apps/qemu.png} (100%) rename ui/icons/{qemu_512x512.png => 512x512/apps/qemu.png} (100%) rename ui/icons/{qemu_64x64.png => 64x64/apps/qemu.png} (100%) rename ui/icons/{ => scalable/apps}/qemu.svg (100%) rename {pc-bios => ui}/keymaps/ar (100%) rename {pc-bios => ui}/keymaps/bepo (100%) rename {pc-bios => ui}/keymaps/cz (100%) rename {pc-bios => ui}/keymaps/da (100%) rename {pc-bios => ui}/keymaps/de (100%) rename {pc-bios => ui}/keymaps/de-ch (100%) rename {pc-bios => ui}/keymaps/en-gb (100%) rename {pc-bios => ui}/keymaps/en-us (100%) rename {pc-bios => ui}/keymaps/es (100%) rename {pc-bios => ui}/keymaps/et (100%) rename {pc-bios => ui}/keymaps/fi (100%) rename {pc-bios => ui}/keymaps/fo (100%) rename {pc-bios => ui}/keymaps/fr (100%) rename {pc-bios => ui}/keymaps/fr-be (100%) rename {pc-bios => ui}/keymaps/fr-ca (100%) rename {pc-bios => ui}/keymaps/fr-ch (100%) rename {pc-bios => ui}/keymaps/hr (100%) rename {pc-bios => ui}/keymaps/hu (100%) rename {pc-bios => ui}/keymaps/is (100%) rename {pc-bios => ui}/keymaps/it (100%) rename {pc-bios => ui}/keymaps/ja (100%) rename {pc-bios => ui}/keymaps/lt (100%) rename {pc-bios => ui}/keymaps/lv (100%) rename {pc-bios => ui}/keymaps/meson.build (100%) rename {pc-bios => ui}/keymaps/mk (100%) rename {pc-bios => ui}/keymaps/nl (100%) rename {pc-bios => ui}/keymaps/no (100%) rename {pc-bios => ui}/keymaps/pl (100%) rename {pc-bios => ui}/keymaps/pt (100%) rename {pc-bios => ui}/keymaps/pt-br (100%) rename {pc-bios => ui}/keymaps/ru (100%) rename {pc-bios => ui}/keymaps/sl (100%) rename {pc-bios => ui}/keymaps/sv (100%) rename {pc-bios => ui}/keymaps/th (100%) rename {pc-bios => ui}/keymaps/tr (100%)