qemu-commits
[Top][All Lists]
Advanced

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

Re: [Qemu-commits] [COMMIT aca312a] qdev: kill DeviceState->name


From: Stefan Weil
Subject: Re: [Qemu-commits] [COMMIT aca312a] qdev: kill DeviceState->name
Date: Tue, 09 Jun 2009 23:23:00 +0200
User-agent: Mozilla-Thunderbird 2.0.0.19 (X11/20090103)

Anthony Liguori schrieb:
> From: Gerd Hoffmann <address@hidden>
>
> is redundant with DeviceState->type->name
>
> Signed-off-by: Gerd Hoffmann <address@hidden>
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index d945ff9..cedb772 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -84,7 +84,6 @@ DeviceState *qdev_create(BusState *bus, const char
> *name)
> }
>
> dev = qemu_mallocz(t->size);
> - dev->name = name;
> dev->type = t;
>
> if (!bus) {
> @@ -162,7 +161,7 @@ CharDriverState *qdev_init_chardev(DeviceState *dev)
> static int next_serial;
> static int next_virtconsole;
> /* FIXME: This is a nasty hack that needs to go away. */
> - if (strncmp(dev->name, "virtio", 6) == 0) {
> + if (strncmp(dev->type->name, "virtio", 6) == 0) {
> return virtcon_hds[next_virtconsole++];
> } else {
> return serial_hds[next_serial++];
> diff --git a/hw/qdev.h b/hw/qdev.h
> index 143a1f8..b3cc3ec 100644
> --- a/hw/qdev.h
> +++ b/hw/qdev.h
> @@ -13,7 +13,6 @@ typedef struct BusState BusState;
> /* This structure should not be accessed directly. We declare it here
> so that it can be embedded in individual device state structures. */
> struct DeviceState {
> - const char *name;
> DeviceType *type;
> BusState *parent_bus;
> DeviceProperty *props;

The visibility of both "name" member variables is different:
the removed one was defined in a header file (so it
was public), the remaining one is only defined locally
in qdev.c (it is private).

What about defining the full DeviceType struct in qdev.h?
I have code which reads "name" (a newer version of eepro100.c),
and it was broken by this commit...

Regards

Stefan Weil





reply via email to

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