aboutsummaryrefslogtreecommitdiff
path: root/hw/scsi
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/scsi
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
downloadqemu-arm-db1015e92e04835c9eb50c29625fe566d1202dbd.tar.gz
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/scsi')
-rw-r--r--hw/scsi/esp-pci.c11
-rw-r--r--hw/scsi/lsi53c895a.c6
-rw-r--r--hw/scsi/megasas.c11
-rw-r--r--hw/scsi/mptsas.h1
-rw-r--r--hw/scsi/scsi-disk.c12
-rw-r--r--hw/scsi/spapr_vscsi.c6
-rw-r--r--hw/scsi/vmw_pvscsi.c11
7 files changed, 37 insertions, 21 deletions
diff --git a/hw/scsi/esp-pci.c b/hw/scsi/esp-pci.c
index 90432ef107..544f5f19b3 100644
--- a/hw/scsi/esp-pci.c
+++ b/hw/scsi/esp-pci.c
@@ -33,9 +33,11 @@
#include "qapi/error.h"
#include "qemu/log.h"
#include "qemu/module.h"
+#include "qom/object.h"
#define TYPE_AM53C974_DEVICE "am53c974"
+typedef struct PCIESPState PCIESPState;
#define PCI_ESP(obj) \
OBJECT_CHECK(PCIESPState, (obj), TYPE_AM53C974_DEVICE)
@@ -64,7 +66,7 @@
#define SBAC_STATUS (1 << 24)
-typedef struct PCIESPState {
+struct PCIESPState {
/*< private >*/
PCIDevice parent_obj;
/*< public >*/
@@ -73,7 +75,7 @@ typedef struct PCIESPState {
uint32_t dma_regs[8];
uint32_t sbac;
ESPState esp;
-} PCIESPState;
+};
static void esp_pci_handle_idle(PCIESPState *pci, uint32_t val)
{
@@ -408,10 +410,11 @@ static const TypeInfo esp_pci_info = {
},
};
-typedef struct {
+struct DC390State {
PCIESPState pci;
eeprom_t *eeprom;
-} DC390State;
+};
+typedef struct DC390State DC390State;
#define TYPE_DC390_DEVICE "dc390"
#define DC390(obj) \
diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c
index 63ff4181de..0e40587c18 100644
--- a/hw/scsi/lsi53c895a.c
+++ b/hw/scsi/lsi53c895a.c
@@ -23,6 +23,7 @@
#include "qemu/log.h"
#include "qemu/module.h"
#include "trace.h"
+#include "qom/object.h"
static const char *names[] = {
"SCNTL0", "SCNTL1", "SCNTL2", "SCNTL3", "SCID", "SXFER", "SDID", "GPREG",
@@ -213,7 +214,7 @@ enum {
LSI_MSG_ACTION_DIN = 3,
};
-typedef struct {
+struct LSIState {
/*< private >*/
PCIDevice parent_obj;
/*< public >*/
@@ -303,7 +304,8 @@ typedef struct {
uint32_t adder;
uint8_t script_ram[2048 * sizeof(uint32_t)];
-} LSIState;
+};
+typedef struct LSIState LSIState;
#define TYPE_LSI53C810 "lsi53c810"
#define TYPE_LSI53C895A "lsi53c895a"
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index 390c2f2edb..aab0b36598 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -34,6 +34,7 @@
#include "qapi/error.h"
#include "mfi.h"
#include "migration/vmstate.h"
+#include "qom/object.h"
#define MEGASAS_VERSION_GEN1 "1.70"
#define MEGASAS_VERSION_GEN2 "1.80"
@@ -72,7 +73,7 @@ typedef struct MegasasCmd {
struct MegasasState *state;
} MegasasCmd;
-typedef struct MegasasState {
+struct MegasasState {
/*< private >*/
PCIDevice parent_obj;
/*< public >*/
@@ -116,16 +117,18 @@ typedef struct MegasasState {
MegasasCmd frames[MEGASAS_MAX_FRAMES];
DECLARE_BITMAP(frame_map, MEGASAS_MAX_FRAMES);
SCSIBus bus;
-} MegasasState;
+};
+typedef struct MegasasState MegasasState;
-typedef struct MegasasBaseClass {
+struct MegasasBaseClass {
PCIDeviceClass parent_class;
const char *product_name;
const char *product_version;
int mmio_bar;
int ioport_bar;
int osts;
-} MegasasBaseClass;
+};
+typedef struct MegasasBaseClass MegasasBaseClass;
#define TYPE_MEGASAS_BASE "megasas-base"
#define TYPE_MEGASAS_GEN1 "megasas"
diff --git a/hw/scsi/mptsas.h b/hw/scsi/mptsas.h
index 9ac98fc20e..2e76bda79e 100644
--- a/hw/scsi/mptsas.h
+++ b/hw/scsi/mptsas.h
@@ -2,6 +2,7 @@
#define MPTSAS_H
#include "mpi.h"
+#include "qom/object.h"
#define MPTSAS_NUM_PORTS 8
#define MPTSAS_MAX_FRAMES 2048 /* Firmware limit at 65535 */
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
index 7612035a4e..ea66422c2b 100644
--- a/hw/scsi/scsi-disk.c
+++ b/hw/scsi/scsi-disk.c
@@ -38,6 +38,7 @@
#include "sysemu/sysemu.h"
#include "qemu/cutils.h"
#include "trace.h"
+#include "qom/object.h"
#ifdef __linux
#include <scsi/sg.h>
@@ -54,6 +55,8 @@
#define TYPE_SCSI_DISK_BASE "scsi-disk-base"
+typedef struct SCSIDiskClass SCSIDiskClass;
+typedef struct SCSIDiskState SCSIDiskState;
#define SCSI_DISK_BASE(obj) \
OBJECT_CHECK(SCSIDiskState, (obj), TYPE_SCSI_DISK_BASE)
#define SCSI_DISK_BASE_CLASS(klass) \
@@ -61,13 +64,13 @@
#define SCSI_DISK_BASE_GET_CLASS(obj) \
OBJECT_GET_CLASS(SCSIDiskClass, (obj), TYPE_SCSI_DISK_BASE)
-typedef struct SCSIDiskClass {
+struct SCSIDiskClass {
SCSIDeviceClass parent_class;
DMAIOFunc *dma_readv;
DMAIOFunc *dma_writev;
bool (*need_fua_emulation)(SCSICommand *cmd);
void (*update_sense)(SCSIRequest *r);
-} SCSIDiskClass;
+};
typedef struct SCSIDiskReq {
SCSIRequest req;
@@ -87,8 +90,7 @@ typedef struct SCSIDiskReq {
#define SCSI_DISK_F_DPOFUA 1
#define SCSI_DISK_F_NO_REMOVABLE_DEVOPS 2
-typedef struct SCSIDiskState
-{
+struct SCSIDiskState {
SCSIDevice qdev;
uint32_t features;
bool media_changed;
@@ -113,7 +115,7 @@ typedef struct SCSIDiskState
* 0xffff - reserved
*/
uint16_t rotation_rate;
-} SCSIDiskState;
+};
static bool scsi_handle_rw_error(SCSIDiskReq *r, int error, bool acct_failed);
diff --git a/hw/scsi/spapr_vscsi.c b/hw/scsi/spapr_vscsi.c
index 57f0a1336f..3c64f45bdb 100644
--- a/hw/scsi/spapr_vscsi.c
+++ b/hw/scsi/spapr_vscsi.c
@@ -46,6 +46,7 @@
#include "trace.h"
#include <libfdt.h>
+#include "qom/object.h"
/*
* Virtual SCSI device
@@ -90,14 +91,15 @@ typedef struct vscsi_req {
} vscsi_req;
#define TYPE_VIO_SPAPR_VSCSI_DEVICE "spapr-vscsi"
+typedef struct VSCSIState VSCSIState;
#define VIO_SPAPR_VSCSI_DEVICE(obj) \
OBJECT_CHECK(VSCSIState, (obj), TYPE_VIO_SPAPR_VSCSI_DEVICE)
-typedef struct {
+struct VSCSIState {
SpaprVioDevice vdev;
SCSIBus bus;
vscsi_req reqs[VSCSI_REQ_LIMIT];
-} VSCSIState;
+};
static union viosrp_iu *req_iu(vscsi_req *req)
{
diff --git a/hw/scsi/vmw_pvscsi.c b/hw/scsi/vmw_pvscsi.c
index c071e0c7aa..aa0d57b970 100644
--- a/hw/scsi/vmw_pvscsi.c
+++ b/hw/scsi/vmw_pvscsi.c
@@ -36,6 +36,7 @@
#include "hw/qdev-properties.h"
#include "vmw_pvscsi.h"
#include "trace.h"
+#include "qom/object.h"
#define PVSCSI_USE_64BIT (true)
@@ -56,12 +57,14 @@
(stl_le_pci_dma(&container_of(m, PVSCSIState, rings)->parent_obj, \
(m)->rs_pa + offsetof(struct PVSCSIRingsState, field), val))
-typedef struct PVSCSIClass {
+struct PVSCSIClass {
PCIDeviceClass parent_class;
DeviceRealize parent_dc_realize;
-} PVSCSIClass;
+};
+typedef struct PVSCSIClass PVSCSIClass;
#define TYPE_PVSCSI "pvscsi"
+typedef struct PVSCSIState PVSCSIState;
#define PVSCSI(obj) OBJECT_CHECK(PVSCSIState, (obj), TYPE_PVSCSI)
#define PVSCSI_CLASS(klass) \
@@ -104,7 +107,7 @@ typedef struct PVSCSISGState {
typedef QTAILQ_HEAD(, PVSCSIRequest) PVSCSIRequestList;
-typedef struct {
+struct PVSCSIState {
PCIDevice parent_obj;
MemoryRegion io_space;
SCSIBus bus;
@@ -132,7 +135,7 @@ typedef struct {
uint32_t resetting; /* Reset in progress */
uint32_t compat_flags;
-} PVSCSIState;
+};
typedef struct PVSCSIRequest {
SCSIRequest *sreq;