aboutsummaryrefslogtreecommitdiff
path: root/chardev
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 /chardev
parent1c8eef0227e2942264063f22f10a06b84e0d3fa9 (diff)
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 'chardev')
-rw-r--r--chardev/baum.c6
-rw-r--r--chardev/char-pty.c6
-rw-r--r--chardev/char-ringbuf.c6
-rw-r--r--chardev/char-socket.c6
-rw-r--r--chardev/char-udp.c6
-rw-r--r--chardev/char-win-stdio.c6
-rw-r--r--chardev/chardev-internal.h5
-rw-r--r--chardev/msmouse.c6
-rw-r--r--chardev/testdev.c6
-rw-r--r--chardev/wctablet.c6
10 files changed, 39 insertions, 20 deletions
diff --git a/chardev/baum.c b/chardev/baum.c
index 9c95e7bc79..cb906060d9 100644
--- a/chardev/baum.c
+++ b/chardev/baum.c
@@ -33,6 +33,7 @@
#include <brlapi.h>
#include <brlapi_constants.h>
#include <brlapi_keycodes.h>
+#include "qom/object.h"
#if 0
#define DPRINTF(fmt, ...) \
@@ -86,7 +87,7 @@
#define BUF_SIZE 256
-typedef struct {
+struct BaumChardev {
Chardev parent;
brlapi_handle_t *brlapi;
@@ -100,7 +101,8 @@ typedef struct {
uint8_t out_buf_used, out_buf_ptr;
QEMUTimer *cellCount_timer;
-} BaumChardev;
+};
+typedef struct BaumChardev BaumChardev;
#define TYPE_CHARDEV_BRAILLE "chardev-braille"
#define BAUM_CHARDEV(obj) OBJECT_CHECK(BaumChardev, (obj), TYPE_CHARDEV_BRAILLE)
diff --git a/chardev/char-pty.c b/chardev/char-pty.c
index 1cc501a481..963fe4f0ca 100644
--- a/chardev/char-pty.c
+++ b/chardev/char-pty.c
@@ -33,15 +33,17 @@
#include "qemu/qemu-print.h"
#include "chardev/char-io.h"
+#include "qom/object.h"
-typedef struct {
+struct PtyChardev {
Chardev parent;
QIOChannel *ioc;
int read_bytes;
int connected;
GSource *timer_src;
-} PtyChardev;
+};
+typedef struct PtyChardev PtyChardev;
#define PTY_CHARDEV(obj) OBJECT_CHECK(PtyChardev, (obj), TYPE_CHARDEV_PTY)
diff --git a/chardev/char-ringbuf.c b/chardev/char-ringbuf.c
index 67397a8ce9..301a5d8634 100644
--- a/chardev/char-ringbuf.c
+++ b/chardev/char-ringbuf.c
@@ -29,16 +29,18 @@
#include "qemu/base64.h"
#include "qemu/module.h"
#include "qemu/option.h"
+#include "qom/object.h"
/* Ring buffer chardev */
-typedef struct {
+struct RingBufChardev {
Chardev parent;
size_t size;
size_t prod;
size_t cons;
uint8_t *cbuf;
-} RingBufChardev;
+};
+typedef struct RingBufChardev RingBufChardev;
#define RINGBUF_CHARDEV(obj) \
OBJECT_CHECK(RingBufChardev, (obj), TYPE_CHARDEV_RINGBUF)
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index ef62dbf3d7..9435b7d643 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -36,6 +36,7 @@
#include "qapi/qapi-visit-sockets.h"
#include "chardev/char-io.h"
+#include "qom/object.h"
/***********************************************************/
/* TCP Net console */
@@ -53,7 +54,7 @@ typedef enum {
TCP_CHARDEV_STATE_CONNECTED,
} TCPChardevState;
-typedef struct {
+struct SocketChardev {
Chardev parent;
QIOChannel *ioc; /* Client I/O channel */
QIOChannelSocket *sioc; /* Client master channel */
@@ -84,7 +85,8 @@ typedef struct {
bool connect_err_reported;
QIOTask *connect_task;
-} SocketChardev;
+};
+typedef struct SocketChardev SocketChardev;
#define SOCKET_CHARDEV(obj) \
OBJECT_CHECK(SocketChardev, (obj), TYPE_CHARDEV_SOCKET)
diff --git a/chardev/char-udp.c b/chardev/char-udp.c
index bba4145f96..58be3487e6 100644
--- a/chardev/char-udp.c
+++ b/chardev/char-udp.c
@@ -30,18 +30,20 @@
#include "qemu/option.h"
#include "chardev/char-io.h"
+#include "qom/object.h"
/***********************************************************/
/* UDP Net console */
-typedef struct {
+struct UdpChardev {
Chardev parent;
QIOChannel *ioc;
uint8_t buf[CHR_READ_BUF_LEN];
int bufcnt;
int bufptr;
int max_size;
-} UdpChardev;
+};
+typedef struct UdpChardev UdpChardev;
#define UDP_CHARDEV(obj) OBJECT_CHECK(UdpChardev, (obj), TYPE_CHARDEV_UDP)
diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c
index 99afda353c..980e0d1356 100644
--- a/chardev/char-win-stdio.c
+++ b/chardev/char-win-stdio.c
@@ -28,15 +28,17 @@
#include "qemu/module.h"
#include "chardev/char-win.h"
#include "chardev/char-win-stdio.h"
+#include "qom/object.h"
-typedef struct {
+struct WinStdioChardev {
Chardev parent;
HANDLE hStdIn;
HANDLE hInputReadyEvent;
HANDLE hInputDoneEvent;
HANDLE hInputThread;
uint8_t win_stdio_buf;
-} WinStdioChardev;
+};
+typedef struct WinStdioChardev WinStdioChardev;
#define WIN_STDIO_CHARDEV(obj) \
OBJECT_CHECK(WinStdioChardev, (obj), TYPE_CHARDEV_WIN_STDIO)
diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h
index f4d0429763..2926a326e0 100644
--- a/chardev/chardev-internal.h
+++ b/chardev/chardev-internal.h
@@ -32,7 +32,7 @@
#define MUX_BUFFER_SIZE 32 /* Must be a power of 2. */
#define MUX_BUFFER_MASK (MUX_BUFFER_SIZE - 1)
-typedef struct MuxChardev {
+struct MuxChardev {
Chardev parent;
CharBackend *backends[MAX_MUX];
CharBackend chr;
@@ -51,7 +51,8 @@ typedef struct MuxChardev {
/* Protected by the Chardev chr_write_lock. */
int linestart;
int64_t timestamps_start;
-} MuxChardev;
+};
+typedef struct MuxChardev MuxChardev;
#define MUX_CHARDEV(obj) OBJECT_CHECK(MuxChardev, (obj), TYPE_CHARDEV_MUX)
#define CHARDEV_IS_MUX(chr) \
diff --git a/chardev/msmouse.c b/chardev/msmouse.c
index 6d8f06fed4..0a7926697c 100644
--- a/chardev/msmouse.c
+++ b/chardev/msmouse.c
@@ -27,11 +27,12 @@
#include "chardev/char.h"
#include "ui/console.h"
#include "ui/input.h"
+#include "qom/object.h"
#define MSMOUSE_LO6(n) ((n) & 0x3f)
#define MSMOUSE_HI2(n) (((n) & 0xc0) >> 6)
-typedef struct {
+struct MouseChardev {
Chardev parent;
QemuInputHandlerState *hs;
@@ -40,7 +41,8 @@ typedef struct {
bool btnc[INPUT_BUTTON__MAX];
uint8_t outbuf[32];
int outlen;
-} MouseChardev;
+};
+typedef struct MouseChardev MouseChardev;
#define TYPE_CHARDEV_MSMOUSE "chardev-msmouse"
#define MOUSE_CHARDEV(obj) \
diff --git a/chardev/testdev.c b/chardev/testdev.c
index 368a8c041e..bbae59c941 100644
--- a/chardev/testdev.c
+++ b/chardev/testdev.c
@@ -27,15 +27,17 @@
#include "qemu/osdep.h"
#include "qemu/module.h"
#include "chardev/char.h"
+#include "qom/object.h"
#define BUF_SIZE 32
-typedef struct {
+struct TestdevChardev {
Chardev parent;
uint8_t in_buf[32];
int in_buf_used;
-} TestdevChardev;
+};
+typedef struct TestdevChardev TestdevChardev;
#define TYPE_CHARDEV_TESTDEV "chardev-testdev"
#define TESTDEV_CHARDEV(obj) \
diff --git a/chardev/wctablet.c b/chardev/wctablet.c
index e9cb7ca710..361a12fdd4 100644
--- a/chardev/wctablet.c
+++ b/chardev/wctablet.c
@@ -32,6 +32,7 @@
#include "ui/console.h"
#include "ui/input.h"
#include "trace.h"
+#include "qom/object.h"
#define WC_OUTPUT_BUF_MAX_LEN 512
@@ -64,7 +65,7 @@ uint8_t WC_FULL_CONFIG_STRING[WC_FULL_CONFIG_STRING_LENGTH + 1] = {
};
/* This structure is used to save private info for Wacom Tablet. */
-typedef struct {
+struct TabletChardev {
Chardev parent;
QemuInputHandlerState *hs;
@@ -81,7 +82,8 @@ typedef struct {
int axis[INPUT_AXIS__MAX];
bool btns[INPUT_BUTTON__MAX];
-} TabletChardev;
+};
+typedef struct TabletChardev TabletChardev;
#define TYPE_CHARDEV_WCTABLET "chardev-wctablet"
#define WCTABLET_CHARDEV(obj) \