Re: [Qemu-devel] [PATCH 05/24] qdev: split up header so it can be used in cpu.h
Am 09.11.2012 15:56, schrieb Eduardo Habkost: From: Anthony Liguori aligu...@us.ibm.com Header file dependency is a frickin' nightmare right now. cpu.h tends to get included in our 'include everything' header files but qdev also needs to include those headers mainly for qdev-properties since it knows about CharDriverState and friends. We can solve this for now by splitting out qdev.h along the same lines that we previously split the C file. Then cpu.h just needs to include qdev-core.h hw/qdev.h is split into following new headers: hw/qdev-core.h hw/qdev-properties.h hw/qdev-monitor.h Signed-off-by: Anthony Liguori aligu...@us.ibm.com [ehabkost: re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess)] [ehabkost: kill qdev_prop_set_vlan() declaration] [ehabkost: moved get_fw_dev_path() comment to the original location (I don't know why it was moved)] [ehabkost: removed qdev_exists() declaration] [ehabkost: keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h] Signed-off-by: Eduardo Habkost ehabk...@redhat.com Yay, I made it through this patch line by line! Perfect now, Acked-by: Andreas Färber afaer...@suse.de Thanks, Andreas -- SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
[Qemu-devel] [PATCH 05/24] qdev: split up header so it can be used in cpu.h
From: Anthony Liguori aligu...@us.ibm.com Header file dependency is a frickin' nightmare right now. cpu.h tends to get included in our 'include everything' header files but qdev also needs to include those headers mainly for qdev-properties since it knows about CharDriverState and friends. We can solve this for now by splitting out qdev.h along the same lines that we previously split the C file. Then cpu.h just needs to include qdev-core.h hw/qdev.h is split into following new headers: hw/qdev-core.h hw/qdev-properties.h hw/qdev-monitor.h Signed-off-by: Anthony Liguori aligu...@us.ibm.com [ehabkost: re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess)] [ehabkost: kill qdev_prop_set_vlan() declaration] [ehabkost: moved get_fw_dev_path() comment to the original location (I don't know why it was moved)] [ehabkost: removed qdev_exists() declaration] [ehabkost: keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h] Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- Yes, there is changelog data before the --- mark, but I believe that in this case they are important to indicate authorship and the scope of the Signed-off-by lines (so they need to get into the git commit message) Detailed changelog: Changes v1 (from Anthony) - v2 (from Eduardo): - re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess) - kill qdev_prop_set_vlan() declaration Changes v2 - v3 (from Eduardo): - moved get_fw_dev_path() comment to the original location (I don't know why it was moved) - removed qdev_exists() declaration - keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h Changes v3 - v4 (from Eduardo): - Edited commit message to include additional information about the specific files being created --- hw/mc146818rtc.c | 1 + hw/qdev-addr.c | 1 + hw/qdev-core.h | 238 + hw/qdev-monitor.h| 16 +++ hw/qdev-properties.c | 1 + hw/qdev-properties.h | 130 ++ hw/qdev.c| 1 + hw/qdev.h| 370 +-- 8 files changed, 392 insertions(+), 366 deletions(-) create mode 100644 hw/qdev-core.h create mode 100644 hw/qdev-monitor.h create mode 100644 hw/qdev-properties.h diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 98839f2..7d84ce3 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -25,6 +25,7 @@ #include qemu-timer.h #include sysemu.h #include mc146818rtc.h +#include qapi/qapi-visit-core.h #ifdef TARGET_I386 #include apic.h diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c index de0ba87..ea32c31 100644 --- a/hw/qdev-addr.c +++ b/hw/qdev-addr.c @@ -1,6 +1,7 @@ #include qdev.h #include qdev-addr.h #include hwaddr.h +#include qapi/qapi-visit-core.h /* --- target physical address --- */ diff --git a/hw/qdev-core.h b/hw/qdev-core.h new file mode 100644 index 000..fce9e22 --- /dev/null +++ b/hw/qdev-core.h @@ -0,0 +1,238 @@ +#ifndef QDEV_CORE_H +#define QDEV_CORE_H + +#include qemu-queue.h +#include qemu-option.h +#include qemu/object.h +#include hw/irq.h +#include error.h + +typedef struct Property Property; + +typedef struct PropertyInfo PropertyInfo; + +typedef struct CompatProperty CompatProperty; + +typedef struct BusState BusState; + +typedef struct BusClass BusClass; + +enum DevState { +DEV_STATE_CREATED = 1, +DEV_STATE_INITIALIZED, +}; + +enum { +DEV_NVECTORS_UNSPECIFIED = -1, +}; + +#define TYPE_DEVICE device +#define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE) +#define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE) +#define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE) + +typedef int (*qdev_initfn)(DeviceState *dev); +typedef int (*qdev_event)(DeviceState *dev); +typedef void (*qdev_resetfn)(DeviceState *dev); + +struct VMStateDescription; + +typedef struct DeviceClass { +ObjectClass parent_class; + +const char *fw_name; +const char *desc; +Property *props; +int no_user; + +/* callbacks */ +void (*reset)(DeviceState *dev); + +/* device state */ +const struct VMStateDescription *vmsd; + +/* Private to qdev / bus. */ +qdev_initfn init; +qdev_event unplug; +qdev_event exit; +const char *bus_type; +} DeviceClass; + +/* This structure should not be accessed directly. We declare it here + so that it can be embedded in individual device state structures. */ +struct DeviceState { +Object parent_obj; + +const char *id; +enum DevState state; +QemuOpts *opts; +int hotplugged; +BusState *parent_bus; +int num_gpio_out; +qemu_irq *gpio_out; +int num_gpio_in; +qemu_irq *gpio_in; +QLIST_HEAD(, BusState) child_bus; +int num_child_bus; +int instance_id_alias; +int
[Qemu-devel] [PATCH 05/24] qdev: split up header so it can be used in cpu.h
From: Anthony Liguori aligu...@us.ibm.com Header file dependency is a frickin' nightmare right now. cpu.h tends to get included in our 'include everything' header files but qdev also needs to include those headers mainly for qdev-properties since it knows about CharDriverState and friends. We can solve this for now by splitting out qdev.h along the same lines that we previously split the C file. Then cpu.h just needs to include qdev-core.h hw/qdev.h is split into following new headers: hw/qdev-core.h hw/qdev-properties.h hw/qdev-monitor.h Signed-off-by: Anthony Liguori aligu...@us.ibm.com [ehabkost: re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess)] [ehabkost: kill qdev_prop_set_vlan() declaration] [ehabkost: moved get_fw_dev_path() comment to the original location (I don't know why it was moved)] [ehabkost: removed qdev_exists() declaration] [ehabkost: keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h] Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- Yes, there is changelog data before the --- mark, but I believe that in this case they are important to indicate authorship and the scope of the Signed-off-by lines (so they need to get into the git commit message) Detailed changelog: Changes v1 (from Anthony) - v2 (from Eduardo): - re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess) - kill qdev_prop_set_vlan() declaration Changes v2 - v3 (from Eduardo): - moved get_fw_dev_path() comment to the original location (I don't know why it was moved) - removed qdev_exists() declaration - keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h Changes v3 - v4 (from Eduardo): - Edited commit message to include additional information about the specific files being created --- hw/mc146818rtc.c | 1 + hw/qdev-addr.c | 1 + hw/qdev-core.h | 238 + hw/qdev-monitor.h| 16 +++ hw/qdev-properties.c | 1 + hw/qdev-properties.h | 130 ++ hw/qdev.c| 1 + hw/qdev.h| 370 +-- 8 files changed, 392 insertions(+), 366 deletions(-) create mode 100644 hw/qdev-core.h create mode 100644 hw/qdev-monitor.h create mode 100644 hw/qdev-properties.h diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 98839f2..7d84ce3 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -25,6 +25,7 @@ #include qemu-timer.h #include sysemu.h #include mc146818rtc.h +#include qapi/qapi-visit-core.h #ifdef TARGET_I386 #include apic.h diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c index de0ba87..ea32c31 100644 --- a/hw/qdev-addr.c +++ b/hw/qdev-addr.c @@ -1,6 +1,7 @@ #include qdev.h #include qdev-addr.h #include hwaddr.h +#include qapi/qapi-visit-core.h /* --- target physical address --- */ diff --git a/hw/qdev-core.h b/hw/qdev-core.h new file mode 100644 index 000..fce9e22 --- /dev/null +++ b/hw/qdev-core.h @@ -0,0 +1,238 @@ +#ifndef QDEV_CORE_H +#define QDEV_CORE_H + +#include qemu-queue.h +#include qemu-option.h +#include qemu/object.h +#include hw/irq.h +#include error.h + +typedef struct Property Property; + +typedef struct PropertyInfo PropertyInfo; + +typedef struct CompatProperty CompatProperty; + +typedef struct BusState BusState; + +typedef struct BusClass BusClass; + +enum DevState { +DEV_STATE_CREATED = 1, +DEV_STATE_INITIALIZED, +}; + +enum { +DEV_NVECTORS_UNSPECIFIED = -1, +}; + +#define TYPE_DEVICE device +#define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE) +#define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE) +#define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE) + +typedef int (*qdev_initfn)(DeviceState *dev); +typedef int (*qdev_event)(DeviceState *dev); +typedef void (*qdev_resetfn)(DeviceState *dev); + +struct VMStateDescription; + +typedef struct DeviceClass { +ObjectClass parent_class; + +const char *fw_name; +const char *desc; +Property *props; +int no_user; + +/* callbacks */ +void (*reset)(DeviceState *dev); + +/* device state */ +const struct VMStateDescription *vmsd; + +/* Private to qdev / bus. */ +qdev_initfn init; +qdev_event unplug; +qdev_event exit; +const char *bus_type; +} DeviceClass; + +/* This structure should not be accessed directly. We declare it here + so that it can be embedded in individual device state structures. */ +struct DeviceState { +Object parent_obj; + +const char *id; +enum DevState state; +QemuOpts *opts; +int hotplugged; +BusState *parent_bus; +int num_gpio_out; +qemu_irq *gpio_out; +int num_gpio_in; +qemu_irq *gpio_in; +QLIST_HEAD(, BusState) child_bus; +int num_child_bus; +int instance_id_alias; +int
[Qemu-devel] [PATCH 05/24] qdev: split up header so it can be used in cpu.h
From: Anthony Liguori aligu...@us.ibm.com Header file dependency is a frickin' nightmare right now. cpu.h tends to get included in our 'include everything' header files but qdev also needs to include those headers mainly for qdev-properties since it knows about CharDriverState and friends. We can solve this for now by splitting out qdev.h along the same lines that we previously split the C file. Then cpu.h just needs to include qdev-core.h hw/qdev.h is split into following new headers: hw/qdev-core.h hw/qdev-properties.h hw/qdev-monitor.h Signed-off-by: Anthony Liguori aligu...@us.ibm.com [ehabkost: re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess)] [ehabkost: kill qdev_prop_set_vlan() declaration] [ehabkost: moved get_fw_dev_path() comment to the original location (I don't know why it was moved)] [ehabkost: removed qdev_exists() declaration] [ehabkost: keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h] Signed-off-by: Eduardo Habkost ehabk...@redhat.com --- Yes, there is changelog data before the --- mark, but I believe that in this case they are important to indicate authorship and the scope of the Signed-off-by lines (so they need to get into the git commit message) Detailed changelog: Changes v1 (from Anthony) - v2 (from Eduardo): - re-add DEFINE_PROP_PCI_HOST_DEVADDR, that was removed on the original patch (by mistake, I guess) - kill qdev_prop_set_vlan() declaration Changes v2 - v3 (from Eduardo): - moved get_fw_dev_path() comment to the original location (I don't know why it was moved) - removed qdev_exists() declaration - keep using 'QemuOpts' instead of 'struct QemuOpts', as qdev-core.h includes qemu-option.h Changes v3 - v4 (from Eduardo): - Edited commit message to include additional information about the specific files being created --- hw/mc146818rtc.c | 1 + hw/qdev-addr.c | 1 + hw/qdev-core.h | 238 + hw/qdev-monitor.h| 16 +++ hw/qdev-properties.c | 1 + hw/qdev-properties.h | 130 ++ hw/qdev.c| 1 + hw/qdev.h| 370 +-- 8 files changed, 392 insertions(+), 366 deletions(-) create mode 100644 hw/qdev-core.h create mode 100644 hw/qdev-monitor.h create mode 100644 hw/qdev-properties.h diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c index 332a77d..4bf8808 100644 --- a/hw/mc146818rtc.c +++ b/hw/mc146818rtc.c @@ -25,6 +25,7 @@ #include qemu-timer.h #include sysemu.h #include mc146818rtc.h +#include qapi/qapi-visit-core.h #ifdef TARGET_I386 #include apic.h diff --git a/hw/qdev-addr.c b/hw/qdev-addr.c index de0ba87..ea32c31 100644 --- a/hw/qdev-addr.c +++ b/hw/qdev-addr.c @@ -1,6 +1,7 @@ #include qdev.h #include qdev-addr.h #include hwaddr.h +#include qapi/qapi-visit-core.h /* --- target physical address --- */ diff --git a/hw/qdev-core.h b/hw/qdev-core.h new file mode 100644 index 000..fce9e22 --- /dev/null +++ b/hw/qdev-core.h @@ -0,0 +1,238 @@ +#ifndef QDEV_CORE_H +#define QDEV_CORE_H + +#include qemu-queue.h +#include qemu-option.h +#include qemu/object.h +#include hw/irq.h +#include error.h + +typedef struct Property Property; + +typedef struct PropertyInfo PropertyInfo; + +typedef struct CompatProperty CompatProperty; + +typedef struct BusState BusState; + +typedef struct BusClass BusClass; + +enum DevState { +DEV_STATE_CREATED = 1, +DEV_STATE_INITIALIZED, +}; + +enum { +DEV_NVECTORS_UNSPECIFIED = -1, +}; + +#define TYPE_DEVICE device +#define DEVICE(obj) OBJECT_CHECK(DeviceState, (obj), TYPE_DEVICE) +#define DEVICE_CLASS(klass) OBJECT_CLASS_CHECK(DeviceClass, (klass), TYPE_DEVICE) +#define DEVICE_GET_CLASS(obj) OBJECT_GET_CLASS(DeviceClass, (obj), TYPE_DEVICE) + +typedef int (*qdev_initfn)(DeviceState *dev); +typedef int (*qdev_event)(DeviceState *dev); +typedef void (*qdev_resetfn)(DeviceState *dev); + +struct VMStateDescription; + +typedef struct DeviceClass { +ObjectClass parent_class; + +const char *fw_name; +const char *desc; +Property *props; +int no_user; + +/* callbacks */ +void (*reset)(DeviceState *dev); + +/* device state */ +const struct VMStateDescription *vmsd; + +/* Private to qdev / bus. */ +qdev_initfn init; +qdev_event unplug; +qdev_event exit; +const char *bus_type; +} DeviceClass; + +/* This structure should not be accessed directly. We declare it here + so that it can be embedded in individual device state structures. */ +struct DeviceState { +Object parent_obj; + +const char *id; +enum DevState state; +QemuOpts *opts; +int hotplugged; +BusState *parent_bus; +int num_gpio_out; +qemu_irq *gpio_out; +int num_gpio_in; +qemu_irq *gpio_in; +QLIST_HEAD(, BusState) child_bus; +int num_child_bus; +int instance_id_alias; +int