qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v4 01/23] qdev: Rework qtree path abbreviations


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v4 01/23] qdev: Rework qtree path abbreviations
Date: Wed, 23 Jun 2010 10:44:47 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

[cc: kraxel]

Jan Kiszka <address@hidden> writes:

> From: Jan Kiszka <address@hidden>
>
> Path abbreviations suffer from the inconsistency that bus names can only
> be omitted at the end of a path. Drop this special rule, and also remove
> the now obsolete QERR_DEVICE_MULTIPLE_BUSSES.
>
> Signed-off-by: Jan Kiszka <address@hidden>

Affects only -device and device_add option bus.  I support this.

> ---
>  hw/qdev.c |   22 ++++------------------
>  qerror.c  |    4 ----
>  qerror.h  |    3 ---
>  3 files changed, 4 insertions(+), 25 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index 61f999c..7c4f039 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -608,32 +608,18 @@ static BusState *qbus_find(const char *path)
>              }
>              return NULL;
>          }
> +        if (dev->num_child_bus == 0) {
> +            qerror_report(QERR_DEVICE_NO_BUS, elem);
> +            return NULL;
> +        }

I'd kill this check as well.  The QERR_BUS_NOT_FOUND further down
suffices.

>  
>          assert(path[pos] == '/' || !path[pos]);
>          while (path[pos] == '/') {
>              pos++;
>          }
> -        if (path[pos] == '\0') {
> -            /* last specified element is a device.  If it has exactly
> -             * one child bus accept it nevertheless */
> -            switch (dev->num_child_bus) {
> -            case 0:
> -                qerror_report(QERR_DEVICE_NO_BUS, elem);
> -                return NULL;
> -            case 1:
> -                return QLIST_FIRST(&dev->child_bus);
> -            default:
> -                qerror_report(QERR_DEVICE_MULTIPLE_BUSSES, elem);
> -                if (!monitor_cur_is_qmp()) {
> -                    qbus_list_bus(dev);
> -                }
> -                return NULL;
> -            }
> -        }
>  
>          /* find bus */
>          if (sscanf(path+pos, "%127[^/]%n", elem, &len) != 1) {
> -            assert(0);
>              elem[0] = len = 0;
>          }
>          pos += len;
[...]



reply via email to

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