Move QOM typedefs and add missing includes

Some typedefs and macros are defined after the type check macros.
This makes it difficult to automatically replace their
definitions with OBJECT_DECLARE_TYPE.

Patch generated using:

 $ ./scripts/codeconverter/converter.py -i \
   --pattern=QOMStructTypedefSplit $(git grep -l '' -- '*.[ch]')

which will split "typdef struct { ... } TypedefName"
declarations.

Followed by:

 $ ./scripts/codeconverter/converter.py -i --pattern=MoveSymbols \
    $(git grep -l '' -- '*.[ch]')

which will:
- move the typedefs and #defines above the type check macros
- add missing #include "qom/object.h" lines if necessary

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-9-ehabkost@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Message-Id: <20200831210740.126168-10-ehabkost@redhat.com>
Message-Id: <20200831210740.126168-11-ehabkost@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Eduardo Habkost 2020-09-03 16:43:22 -04:00
parent 1c8eef0227
commit db1015e92e
796 changed files with 3378 additions and 1823 deletions

View file

@ -16,6 +16,7 @@
#include "hw/sysbus.h"
#include "hw/s390x/css.h"
#include "hw/s390x/ccw-device.h"
#include "qom/object.h"
#define EMULATED_CCW_3270_CU_TYPE 0x3270
#define EMULATED_CCW_3270_CHPID_TYPE 0x1a
@ -30,6 +31,8 @@
#define TC_EWRITEA 0x0d /* Erase write alternate */
#define TC_WRITESF 0x11 /* Write structured field */
typedef struct EmulatedCcw3270Class EmulatedCcw3270Class;
typedef struct EmulatedCcw3270Device EmulatedCcw3270Device;
#define EMULATED_CCW_3270(obj) \
OBJECT_CHECK(EmulatedCcw3270Device, (obj), TYPE_EMULATED_CCW_3270)
#define EMULATED_CCW_3270_CLASS(klass) \
@ -37,16 +40,16 @@
#define EMULATED_CCW_3270_GET_CLASS(obj) \
OBJECT_GET_CLASS(EmulatedCcw3270Class, (obj), TYPE_EMULATED_CCW_3270)
typedef struct EmulatedCcw3270Device {
struct EmulatedCcw3270Device {
CcwDevice parent_obj;
} EmulatedCcw3270Device;
};
typedef struct EmulatedCcw3270Class {
struct EmulatedCcw3270Class {
CCWDeviceClass parent_class;
void (*init)(EmulatedCcw3270Device *, Error **);
int (*read_payload_3270)(EmulatedCcw3270Device *);
int (*write_payload_3270)(EmulatedCcw3270Device *, uint8_t);
} EmulatedCcw3270Class;
};
#endif

View file

@ -12,12 +12,14 @@
#define HW_S390X_AP_DEVICE_H
#include "hw/qdev-core.h"
#include "qom/object.h"
#define AP_DEVICE_TYPE "ap-device"
typedef struct APDevice {
struct APDevice {
DeviceState parent_obj;
} APDevice;
};
typedef struct APDevice APDevice;
#define AP_DEVICE(obj) \
OBJECT_CHECK(APDevice, (obj), AP_DEVICE_TYPE)

View file

@ -17,19 +17,21 @@
#include "hw/sysbus.h"
/* virtual css bridge */
typedef struct VirtualCssBridge {
struct VirtualCssBridge {
SysBusDevice sysbus_dev;
bool css_dev_path;
} VirtualCssBridge;
};
typedef struct VirtualCssBridge VirtualCssBridge;
#define TYPE_VIRTUAL_CSS_BRIDGE "virtual-css-bridge"
#define VIRTUAL_CSS_BRIDGE(obj) \
OBJECT_CHECK(VirtualCssBridge, (obj), TYPE_VIRTUAL_CSS_BRIDGE)
/* virtual css bus type */
typedef struct VirtualCssBus {
struct VirtualCssBus {
BusState parent_obj;
} VirtualCssBus;
};
typedef struct VirtualCssBus VirtualCssBus;
#define TYPE_VIRTUAL_CSS_BUS "virtual-css-bus"
#define VIRTUAL_CSS_BUS(obj) \

View file

@ -18,6 +18,7 @@
#include "qemu/thread.h"
#include "hw/qdev-core.h"
#include "hw/s390x/sclp.h"
#include "qom/object.h"
/* SCLP event types */
#define SCLP_EVENT_OPRTNS_COMMAND 0x01
@ -41,6 +42,8 @@
#define SCLP_SELECTIVE_READ 0x01
#define TYPE_SCLP_EVENT "s390-sclp-event-type"
typedef struct SCLPEvent SCLPEvent;
typedef struct SCLPEventClass SCLPEventClass;
#define SCLP_EVENT(obj) \
OBJECT_CHECK(SCLPEvent, (obj), TYPE_SCLP_EVENT)
#define SCLP_EVENT_CLASS(klass) \
@ -169,13 +172,13 @@ typedef struct ReadEventData {
};
} QEMU_PACKED ReadEventData;
typedef struct SCLPEvent {
struct SCLPEvent {
DeviceState qdev;
bool event_pending;
char *name;
} SCLPEvent;
};
typedef struct SCLPEventClass {
struct SCLPEventClass {
DeviceClass parent_class;
int (*init)(SCLPEvent *event);
@ -192,10 +195,11 @@ typedef struct SCLPEventClass {
/* can we handle this event type? */
bool (*can_handle_event)(uint8_t type);
} SCLPEventClass;
};
#define TYPE_SCLP_EVENT_FACILITY "s390-sclp-event-facility"
typedef struct SCLPEventFacility SCLPEventFacility;
typedef struct SCLPEventFacilityClass SCLPEventFacilityClass;
#define EVENT_FACILITY(obj) \
OBJECT_CHECK(SCLPEventFacility, (obj), TYPE_SCLP_EVENT_FACILITY)
#define EVENT_FACILITY_CLASS(klass) \
@ -205,11 +209,11 @@ typedef struct SCLPEventFacility SCLPEventFacility;
OBJECT_GET_CLASS(SCLPEventFacilityClass, (obj), \
TYPE_SCLP_EVENT_FACILITY)
typedef struct SCLPEventFacilityClass {
struct SCLPEventFacilityClass {
SysBusDeviceClass parent_class;
void (*command_handler)(SCLPEventFacility *ef, SCCB *sccb, uint64_t code);
bool (*event_pending)(SCLPEventFacility *ef);
} SCLPEventFacilityClass;
};
BusState *sclp_get_event_facility_bus(void);

View file

@ -14,8 +14,11 @@
#define HW_S390_CCW_H
#include "hw/s390x/ccw-device.h"
#include "qom/object.h"
#define TYPE_S390_CCW "s390-ccw"
typedef struct S390CCWDevice S390CCWDevice;
typedef struct S390CCWDeviceClass S390CCWDeviceClass;
#define S390_CCW_DEVICE(obj) \
OBJECT_CHECK(S390CCWDevice, (obj), TYPE_S390_CCW)
#define S390_CCW_DEVICE_CLASS(klass) \
@ -23,14 +26,14 @@
#define S390_CCW_DEVICE_GET_CLASS(obj) \
OBJECT_GET_CLASS(S390CCWDeviceClass, (obj), TYPE_S390_CCW)
typedef struct S390CCWDevice {
struct S390CCWDevice {
CcwDevice parent_obj;
CssDevId hostid;
char *mdevid;
int32_t bootindex;
} S390CCWDevice;
};
typedef struct S390CCWDeviceClass {
struct S390CCWDeviceClass {
CCWDeviceClass parent_class;
void (*realize)(S390CCWDevice *dev, char *sysfsdev, Error **errp);
void (*unrealize)(S390CCWDevice *dev);
@ -38,6 +41,6 @@ typedef struct S390CCWDeviceClass {
int (*handle_halt) (SubchDev *sch);
int (*handle_clear) (SubchDev *sch);
IOInstEnding (*handle_store) (SubchDev *sch);
} S390CCWDeviceClass;
};
#endif

View file

@ -12,16 +12,19 @@
#define HW_S390X_S390_VIRTIO_CCW_H
#include "hw/boards.h"
#include "qom/object.h"
#define TYPE_S390_CCW_MACHINE "s390-ccw-machine"
typedef struct S390CcwMachineClass S390CcwMachineClass;
typedef struct S390CcwMachineState S390CcwMachineState;
#define S390_CCW_MACHINE(obj) \
OBJECT_CHECK(S390CcwMachineState, (obj), TYPE_S390_CCW_MACHINE)
#define S390_CCW_MACHINE_CLASS(klass) \
OBJECT_CLASS_CHECK(S390CcwMachineClass, (klass), TYPE_S390_CCW_MACHINE)
typedef struct S390CcwMachineState {
struct S390CcwMachineState {
/*< private >*/
MachineState parent_obj;
@ -30,9 +33,9 @@ typedef struct S390CcwMachineState {
bool dea_key_wrap;
bool pv;
uint8_t loadparm[8];
} S390CcwMachineState;
};
typedef struct S390CcwMachineClass {
struct S390CcwMachineClass {
/*< private >*/
MachineClass parent_class;
@ -41,7 +44,7 @@ typedef struct S390CcwMachineClass {
bool cpu_model_allowed;
bool css_migration_enabled;
bool hpage_1m_allowed;
} S390CcwMachineClass;
};
/* runtime-instrumentation allowed by the machine */
bool ri_allowed(void);

View file

@ -17,6 +17,7 @@
#include "hw/s390x/adapter.h"
#include "hw/virtio/virtio.h"
#include "qemu/queue.h"
#include "qom/object.h"
/*
* Reserve enough gsis to accommodate all virtio devices.
@ -38,22 +39,24 @@ extern const VMStateDescription vmstate_adapter_routes;
VMSTATE_STRUCT(_f, _s, 1, vmstate_adapter_routes, AdapterRoutes)
#define TYPE_S390_FLIC_COMMON "s390-flic"
typedef struct S390FLICState S390FLICState;
typedef struct S390FLICStateClass S390FLICStateClass;
#define S390_FLIC_COMMON(obj) \
OBJECT_CHECK(S390FLICState, (obj), TYPE_S390_FLIC_COMMON)
typedef struct S390FLICState {
struct S390FLICState {
SysBusDevice parent_obj;
/* to limit AdapterRoutes.num_routes for compat */
uint32_t adapter_routes_max_batch;
bool ais_supported;
} S390FLICState;
};
#define S390_FLIC_COMMON_CLASS(klass) \
OBJECT_CLASS_CHECK(S390FLICStateClass, (klass), TYPE_S390_FLIC_COMMON)
#define S390_FLIC_COMMON_GET_CLASS(obj) \
OBJECT_GET_CLASS(S390FLICStateClass, (obj), TYPE_S390_FLIC_COMMON)
typedef struct S390FLICStateClass {
struct S390FLICStateClass {
DeviceClass parent_class;
int (*register_io_adapter)(S390FLICState *fs, uint32_t id, uint8_t isc,
@ -72,7 +75,7 @@ typedef struct S390FLICStateClass {
uint16_t subchannel_nr, uint32_t io_int_parm,
uint32_t io_int_word);
void (*inject_crw_mchk)(S390FLICState *fs);
} S390FLICStateClass;
};
#define TYPE_KVM_S390_FLIC "s390-flic-kvm"
typedef struct KVMS390FLICState KVMS390FLICState;
@ -80,6 +83,7 @@ typedef struct KVMS390FLICState KVMS390FLICState;
OBJECT_CHECK(KVMS390FLICState, (obj), TYPE_KVM_S390_FLIC)
#define TYPE_QEMU_S390_FLIC "s390-flic-qemu"
typedef struct QEMUS390FLICState QEMUS390FLICState;
#define QEMU_S390_FLIC(obj) \
OBJECT_CHECK(QEMUS390FLICState, (obj), TYPE_QEMU_S390_FLIC)
@ -115,14 +119,14 @@ typedef struct QEMUS390FlicIO {
QLIST_ENTRY(QEMUS390FlicIO) next;
} QEMUS390FlicIO;
typedef struct QEMUS390FLICState {
struct QEMUS390FLICState {
S390FLICState parent_obj;
uint32_t pending;
uint32_t service_param;
uint8_t simm;
uint8_t nimm;
QLIST_HEAD(, QEMUS390FlicIO) io[8];
} QEMUS390FLICState;
};
uint32_t qemu_s390_flic_dequeue_service(QEMUS390FLICState *flic);
QEMUS390FlicIO *qemu_s390_flic_dequeue_io(QEMUS390FLICState *flic,

View file

@ -16,6 +16,7 @@
#include "hw/sysbus.h"
#include "target/s390x/cpu-qom.h"
#include "qom/object.h"
#define SCLP_CMD_CODE_MASK 0xffff00ff
@ -181,22 +182,24 @@ typedef struct SCCB {
} QEMU_PACKED SCCB;
#define TYPE_SCLP "sclp"
typedef struct SCLPDevice SCLPDevice;
typedef struct SCLPDeviceClass SCLPDeviceClass;
#define SCLP(obj) OBJECT_CHECK(SCLPDevice, (obj), TYPE_SCLP)
#define SCLP_CLASS(oc) OBJECT_CLASS_CHECK(SCLPDeviceClass, (oc), TYPE_SCLP)
#define SCLP_GET_CLASS(obj) OBJECT_GET_CLASS(SCLPDeviceClass, (obj), TYPE_SCLP)
struct SCLPEventFacility;
typedef struct SCLPDevice {
struct SCLPDevice {
/* private */
DeviceState parent_obj;
struct SCLPEventFacility *event_facility;
int increment_size;
/* public */
} SCLPDevice;
};
typedef struct SCLPDeviceClass {
struct SCLPDeviceClass {
/* private */
DeviceClass parent_class;
void (*read_SCP_info)(SCLPDevice *sclp, SCCB *sccb);
@ -205,7 +208,7 @@ typedef struct SCLPDeviceClass {
/* public */
void (*execute)(SCLPDevice *sclp, SCCB *sccb, uint32_t code);
void (*service_interrupt)(SCLPDevice *sclp, uint32_t sccb);
} SCLPDeviceClass;
};
static inline int sccb_data_len(SCCB *sccb)
{

View file

@ -14,26 +14,29 @@
#include "hw/qdev-core.h"
#include "monitor/monitor.h"
#include "qom/object.h"
#define TYPE_S390_STATTRIB "s390-storage_attributes"
#define TYPE_QEMU_S390_STATTRIB "s390-storage_attributes-qemu"
#define TYPE_KVM_S390_STATTRIB "s390-storage_attributes-kvm"
typedef struct S390StAttribClass S390StAttribClass;
typedef struct S390StAttribState S390StAttribState;
#define S390_STATTRIB(obj) \
OBJECT_CHECK(S390StAttribState, (obj), TYPE_S390_STATTRIB)
typedef struct S390StAttribState {
struct S390StAttribState {
DeviceState parent_obj;
uint64_t migration_cur_gfn;
bool migration_enabled;
} S390StAttribState;
};
#define S390_STATTRIB_CLASS(klass) \
OBJECT_CLASS_CHECK(S390StAttribClass, (klass), TYPE_S390_STATTRIB)
#define S390_STATTRIB_GET_CLASS(obj) \
OBJECT_GET_CLASS(S390StAttribClass, (obj), TYPE_S390_STATTRIB)
typedef struct S390StAttribClass {
struct S390StAttribClass {
DeviceClass parent_class;
/* Return value: < 0 on error, or new count */
int (*get_stattr)(S390StAttribState *sa, uint64_t *start_gfn,
@ -46,23 +49,25 @@ typedef struct S390StAttribClass {
int (*set_migrationmode)(S390StAttribState *sa, bool value);
int (*get_active)(S390StAttribState *sa);
long long (*get_dirtycount)(S390StAttribState *sa);
} S390StAttribClass;
};
typedef struct QEMUS390StAttribState QEMUS390StAttribState;
#define QEMU_S390_STATTRIB(obj) \
OBJECT_CHECK(QEMUS390StAttribState, (obj), TYPE_QEMU_S390_STATTRIB)
typedef struct QEMUS390StAttribState {
struct QEMUS390StAttribState {
S390StAttribState parent_obj;
} QEMUS390StAttribState;
};
typedef struct KVMS390StAttribState KVMS390StAttribState;
#define KVM_S390_STATTRIB(obj) \
OBJECT_CHECK(KVMS390StAttribState, (obj), TYPE_KVM_S390_STATTRIB)
typedef struct KVMS390StAttribState {
struct KVMS390StAttribState {
S390StAttribState parent_obj;
uint64_t still_dirty;
uint8_t *incoming_buffer;
} KVMS390StAttribState;
};
void s390_stattrib_init(void);

View file

@ -14,41 +14,45 @@
#include "hw/qdev-core.h"
#include "monitor/monitor.h"
#include "qom/object.h"
#define TYPE_S390_SKEYS "s390-skeys"
typedef struct S390SKeysClass S390SKeysClass;
typedef struct S390SKeysState S390SKeysState;
#define S390_SKEYS(obj) \
OBJECT_CHECK(S390SKeysState, (obj), TYPE_S390_SKEYS)
typedef struct S390SKeysState {
struct S390SKeysState {
DeviceState parent_obj;
bool migration_enabled;
} S390SKeysState;
};
#define S390_SKEYS_CLASS(klass) \
OBJECT_CLASS_CHECK(S390SKeysClass, (klass), TYPE_S390_SKEYS)
#define S390_SKEYS_GET_CLASS(obj) \
OBJECT_GET_CLASS(S390SKeysClass, (obj), TYPE_S390_SKEYS)
typedef struct S390SKeysClass {
struct S390SKeysClass {
DeviceClass parent_class;
int (*skeys_enabled)(S390SKeysState *ks);
int (*get_skeys)(S390SKeysState *ks, uint64_t start_gfn, uint64_t count,
uint8_t *keys);
int (*set_skeys)(S390SKeysState *ks, uint64_t start_gfn, uint64_t count,
uint8_t *keys);
} S390SKeysClass;
};
#define TYPE_KVM_S390_SKEYS "s390-skeys-kvm"
#define TYPE_QEMU_S390_SKEYS "s390-skeys-qemu"
typedef struct QEMUS390SKeysState QEMUS390SKeysState;
#define QEMU_S390_SKEYS(obj) \
OBJECT_CHECK(QEMUS390SKeysState, (obj), TYPE_QEMU_S390_SKEYS)
typedef struct QEMUS390SKeysState {
struct QEMUS390SKeysState {
S390SKeysState parent_obj;
uint8_t *keydata;
uint32_t key_count;
} QEMUS390SKeysState;
};
void s390_skeys_init(void);

View file

@ -13,6 +13,7 @@
#include "hw/qdev-core.h"
#include "target/s390x/s390-tod.h"
#include "qom/object.h"
typedef struct S390TOD {
uint8_t high;
@ -20,6 +21,8 @@ typedef struct S390TOD {
} S390TOD;
#define TYPE_S390_TOD "s390-tod"
typedef struct S390TODClass S390TODClass;
typedef struct S390TODState S390TODState;
#define S390_TOD(obj) OBJECT_CHECK(S390TODState, (obj), TYPE_S390_TOD)
#define S390_TOD_CLASS(oc) OBJECT_CLASS_CHECK(S390TODClass, (oc), \
TYPE_S390_TOD)
@ -28,7 +31,7 @@ typedef struct S390TOD {
#define TYPE_KVM_S390_TOD TYPE_S390_TOD "-kvm"
#define TYPE_QEMU_S390_TOD TYPE_S390_TOD "-qemu"
typedef struct S390TODState {
struct S390TODState {
/* private */
DeviceState parent_obj;
@ -39,9 +42,9 @@ typedef struct S390TODState {
S390TOD base;
/* Used by KVM to remember if the TOD is stopped and base is valid. */
bool stopped;
} S390TODState;
};
typedef struct S390TODClass {
struct S390TODClass {
/* private */
DeviceClass parent_class;
void (*parent_realize)(DeviceState *dev, Error **errp);
@ -49,7 +52,7 @@ typedef struct S390TODClass {
/* public */
void (*get)(const S390TODState *td, S390TOD *tod, Error **errp);
void (*set)(S390TODState *td, const S390TOD *tod, Error **errp);
} S390TODClass;
};
void s390_init_tod(void);
S390TODState *s390_get_todstate(void);

View file

@ -17,12 +17,13 @@
#include "hw/vfio/vfio-common.h"
#include "hw/s390x/s390-ccw.h"
#include "hw/s390x/ccw-device.h"
#include "qom/object.h"
#define TYPE_VFIO_CCW "vfio-ccw"
typedef struct VFIOCCWDevice VFIOCCWDevice;
#define VFIO_CCW(obj) \
OBJECT_CHECK(VFIOCCWDevice, (obj), TYPE_VFIO_CCW)
#define TYPE_VFIO_CCW "vfio-ccw"
typedef struct VFIOCCWDevice VFIOCCWDevice;
#endif