[PATCH v6 1/7] datadir: Simplify firmware directory search

Akihiko Odaki posted 7 patches 3 years, 7 months ago
Maintainers: "Alex Bennée" <alex.bennee@linaro.org>, "Philippe Mathieu-Daudé" <f4bug@amsat.org>, Thomas Huth <thuth@redhat.com>, Wainer dos Santos Moschetta <wainersm@redhat.com>, Beraldo Leal <bleal@redhat.com>, Jason Wang <jasowang@redhat.com>, Michael Roth <michael.roth@amd.com>, Alexander Bulekov <alxndr@bu.edu>, Paolo Bonzini <pbonzini@redhat.com>, Bandan Das <bsd@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>, Darren Kenny <darren.kenny@oracle.com>, Qiuhao Li <Qiuhao.Li@outlook.com>, Laurent Vivier <lvivier@redhat.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Ed Maste <emaste@freebsd.org>, Li-Wen Hsu <lwhsu@freebsd.org>, Peter Maydell <peter.maydell@linaro.org>, Akihiko Odaki <akihiko.odaki@gmail.com>, Gerd Hoffmann <kraxel@redhat.com>
There is a newer version of this series
[PATCH v6 1/7] datadir: Simplify firmware directory search
Posted by Akihiko Odaki 3 years, 7 months ago
The old implementation had some code to accept multiple firmware
directories, but it is not used.

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
---
 softmmu/datadir.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/softmmu/datadir.c b/softmmu/datadir.c
index 160cac999a6..2a206f2740a 100644
--- a/softmmu/datadir.c
+++ b/softmmu/datadir.c
@@ -105,15 +105,8 @@ static char *find_datadir(void)
 
 void qemu_add_default_firmwarepath(void)
 {
-    char **dirs;
-    size_t i;
-
-    /* add configured firmware directories */
-    dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0);
-    for (i = 0; dirs[i] != NULL; i++) {
-        qemu_add_data_dir(get_relocated_path(dirs[i]));
-    }
-    g_strfreev(dirs);
+    /* add the configured firmware directory */
+    qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_FIRMWAREPATH));
 
     /* try to find datadir relative to the executable path */
     qemu_add_data_dir(find_datadir());
-- 
2.32.1 (Apple Git-133)
Re: [PATCH v6 1/7] datadir: Simplify firmware directory search
Posted by Daniel P. Berrangé 3 years, 7 months ago
On Thu, Jun 16, 2022 at 12:56:28AM +0900, Akihiko Odaki wrote:
> The old implementation had some code to accept multiple firmware
> directories, but it is not used.

It is used by distros. In Fedora builds for example:

https://kojipkgs.fedoraproject.org/packages/qemu/7.0.0/1.fc37/data/logs/x86_64/build.log

Passes this to configure:

   --firmwarepath=/usr/share/qemu-firmware:/usr/share/ipxe/qemu:/usr/share/seavgabios:/usr/share/seabios:/usr/share/sgabios
 
> Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
> ---
>  softmmu/datadir.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/softmmu/datadir.c b/softmmu/datadir.c
> index 160cac999a6..2a206f2740a 100644
> --- a/softmmu/datadir.c
> +++ b/softmmu/datadir.c
> @@ -105,15 +105,8 @@ static char *find_datadir(void)
>  
>  void qemu_add_default_firmwarepath(void)
>  {
> -    char **dirs;
> -    size_t i;
> -
> -    /* add configured firmware directories */
> -    dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0);
> -    for (i = 0; dirs[i] != NULL; i++) {
> -        qemu_add_data_dir(get_relocated_path(dirs[i]));
> -    }
> -    g_strfreev(dirs);
> +    /* add the configured firmware directory */
> +    qemu_add_data_dir(get_relocated_path(CONFIG_QEMU_FIRMWAREPATH));
>  
>      /* try to find datadir relative to the executable path */
>      qemu_add_data_dir(find_datadir());
> -- 
> 2.32.1 (Apple Git-133)
> 

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|