qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 24/25] Add a fallback bios file search, if -L fa


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH 24/25] Add a fallback bios file search, if -L fails.
Date: Fri, 14 Sep 2012 11:54:22 +0100

On 13 September 2012 21:12, Jason Baron <address@hidden> wrote:
> If -L <dir> is specified, and qemu does not find the bios file in <dir>, then
> the search fails. Add infrastructure such that the search will continue in
> the default paths, if not found in the -L path.

> @@ -1872,12 +1873,15 @@ static int balloon_parse(const char *arg)
>      return -1;
>  }
>
> -char *qemu_find_file(int type, const char *name)
> +static char *__qemu_find_file(int type, const char *name, const char *dir)
>  {
>      int len;
>      const char *subdir;
>      char *buf;
>
> +    if (!dir)
> +        return NULL;
> +
>      /* Try the name as a straight path first */
>      if (access(name, R_OK) == 0) {
>          return g_strdup(name);

This means that every try with a different directory will
check the name as a straight path again, which is a bit
pointless. The "just try the name" code shouldn't be in
this function (which as Paolo suggests should be named
qemu_find_file_in_dir()), it should be pulled out into
your new qemu_find_file(), which will then look like:
 * try as plain pathname
 * try in directory 1
 * try in directory 2

-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]