summaryrefslogtreecommitdiff
path: root/hw/block
diff options
context:
space:
mode:
authorEduardo Habkost <ehabkost@redhat.com>2020-09-03 16:43:22 -0400
committerEduardo Habkost <ehabkost@redhat.com>2020-09-09 09:26:43 -0400
commitdb1015e92e04835c9eb50c29625fe566d1202dbd (patch)
tree41fbc0bf3e3f29b7ecb339224a049e3f2a7db8fa /hw/block
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
downloadqemu-db1015e92e04835c9eb50c29625fe566d1202dbd.zip
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>
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/fdc.c21
-rw-r--r--hw/block/m25p80.c11
-rw-r--r--hw/block/nand.c1
-rw-r--r--hw/block/onenand.c6
4 files changed, 25 insertions, 14 deletions
diff --git a/hw/block/fdc.c b/hw/block/fdc.c
index e9ed3eef45..70bfb136e4 100644
--- a/hw/block/fdc.c
+++ b/hw/block/fdc.c
@@ -46,6 +46,7 @@
#include "qemu/main-loop.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qom/object.h"
/********************************************************/
/* debug Floppy devices */
@@ -64,16 +65,17 @@
/* qdev floppy bus */
#define TYPE_FLOPPY_BUS "floppy-bus"
+typedef struct FloppyBus FloppyBus;
#define FLOPPY_BUS(obj) OBJECT_CHECK(FloppyBus, (obj), TYPE_FLOPPY_BUS)
typedef struct FDCtrl FDCtrl;
typedef struct FDrive FDrive;
static FDrive *get_drv(FDCtrl *fdctrl, int unit);
-typedef struct FloppyBus {
+struct FloppyBus {
BusState bus;
FDCtrl *fdc;
-} FloppyBus;
+};
static const TypeInfo floppy_bus_info = {
.name = TYPE_FLOPPY_BUS,
@@ -494,15 +496,16 @@ static const BlockDevOps fd_block_ops = {
#define TYPE_FLOPPY_DRIVE "floppy"
+typedef struct FloppyDrive FloppyDrive;
#define FLOPPY_DRIVE(obj) \
OBJECT_CHECK(FloppyDrive, (obj), TYPE_FLOPPY_DRIVE)
-typedef struct FloppyDrive {
+struct FloppyDrive {
DeviceState qdev;
uint32_t unit;
BlockConf conf;
FloppyDriveType type;
-} FloppyDrive;
+};
static Property floppy_drive_properties[] = {
DEFINE_PROP_UINT32("unit", FloppyDrive, unit, -1),
@@ -886,19 +889,21 @@ static FloppyDriveType get_fallback_drive_type(FDrive *drv)
}
#define TYPE_SYSBUS_FDC "base-sysbus-fdc"
+typedef struct FDCtrlSysBus FDCtrlSysBus;
#define SYSBUS_FDC(obj) OBJECT_CHECK(FDCtrlSysBus, (obj), TYPE_SYSBUS_FDC)
-typedef struct FDCtrlSysBus {
+struct FDCtrlSysBus {
/*< private >*/
SysBusDevice parent_obj;
/*< public >*/
struct FDCtrl state;
-} FDCtrlSysBus;
+};
+typedef struct FDCtrlISABus FDCtrlISABus;
#define ISA_FDC(obj) OBJECT_CHECK(FDCtrlISABus, (obj), TYPE_ISA_FDC)
-typedef struct FDCtrlISABus {
+struct FDCtrlISABus {
ISADevice parent_obj;
uint32_t iobase;
@@ -907,7 +912,7 @@ typedef struct FDCtrlISABus {
struct FDCtrl state;
int32_t bootindexA;
int32_t bootindexB;
-} FDCtrlISABus;
+};
static uint32_t fdctrl_read (void *opaque, uint32_t reg)
{
diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 15824450cd..9de4f9b274 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -33,6 +33,7 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "trace.h"
+#include "qom/object.h"
/* Fields for FlashPartInfo->flags */
@@ -414,7 +415,7 @@ typedef enum {
#define M25P80_INTERNAL_DATA_BUFFER_SZ 16
-typedef struct Flash {
+struct Flash {
SSISlave parent_obj;
BlockBackend *blk;
@@ -454,12 +455,14 @@ typedef struct Flash {
const FlashPartInfo *pi;
-} Flash;
+};
+typedef struct Flash Flash;
-typedef struct M25P80Class {
+struct M25P80Class {
SSISlaveClass parent_class;
FlashPartInfo *pi;
-} M25P80Class;
+};
+typedef struct M25P80Class M25P80Class;
#define TYPE_M25P80 "m25p80-generic"
#define M25P80(obj) \
diff --git a/hw/block/nand.c b/hw/block/nand.c
index 654e0cb5d1..7c7a08b7aa 100644
--- a/hw/block/nand.c
+++ b/hw/block/nand.c
@@ -27,6 +27,7 @@
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qemu/module.h"
+#include "qom/object.h"
# define NAND_CMD_READ0 0x00
# define NAND_CMD_READ1 0x01
diff --git a/hw/block/onenand.c b/hw/block/onenand.c
index 898ac563a3..5fe235d11d 100644
--- a/hw/block/onenand.c
+++ b/hw/block/onenand.c
@@ -31,6 +31,7 @@
#include "qemu/error-report.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "qom/object.h"
/* 11 for 2kB-page OneNAND ("2nd generation") and 10 for 1kB-page chips */
#define PAGE_SHIFT 11
@@ -39,9 +40,10 @@
#define BLOCK_SHIFT (PAGE_SHIFT + 6)
#define TYPE_ONE_NAND "onenand"
+typedef struct OneNANDState OneNANDState;
#define ONE_NAND(obj) OBJECT_CHECK(OneNANDState, (obj), TYPE_ONE_NAND)
-typedef struct OneNANDState {
+struct OneNANDState {
SysBusDevice parent_obj;
struct {
@@ -85,7 +87,7 @@ typedef struct OneNANDState {
int secs_cur;
int blocks;
uint8_t *blockwp;
-} OneNANDState;
+};
enum {
ONEN_BUF_BLOCK = 0,