* [PATCH 00/18] chardev: QOM cleanups
@ 2020-09-10 19:48 Eduardo Habkost
2020-09-10 19:48 ` [PATCH 01/18] chardev: Move PARALLEL_CHARDEV macro to common code Eduardo Habkost
` (18 more replies)
0 siblings, 19 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Some chardev QOM cleanup patches had to be dropped from my queue
due to build erros introduced by code movements across ifdef
boundaries at char-parallel.c. This series redo the changes from
those patches, but the macro renames are now a little different:
In this version I have decided to rename the type checking macros
from *_CHARDEV to CHARDEV_* instead of renaming tye
TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the
identifiers actually match the QOM type name strings
("chardev-*").
Eduardo Habkost (18):
chardev: Move PARALLEL_CHARDEV macro to common code
chardev: Move ParallelChardev typedef to common code
chardev: Use DECLARE_INSTANCE_CHECKER macro for PARALLEL_CHARDEV
chardev: Rename MOUSE_CHARDEV to CHARDEV_MSMOUSE
chardev: Rename BAUM_CHARDEV to CHARDEV_BRAILLE
chardev: Rename FD_CHARDEV to CHARDEV_FD
chardev: Rename MUX_CHARDEV to CHARDEV_MUX
chardev: Rename PARALLEL_CHARDEV to CHARDEV_PARALLEL
chardev: Rename PTY_CHARDEV to CHARDEV_PTY
chardev: Rename RINGBUF_CHARDEV to CHARDEV_RINGBUF
chardev: Rename SOCKET_CHARDEV to CHARDEV_SOCKET
chardev: Rename SPICE_CHARDEV to CHARDEV_SPICE
chardev: Rename TESTDEV_CHARDEV to CHARDEV_TESTDEV
chardev: Rename UDP_CHARDEV to CHARDEV_UDP
chardev: Rename VC_CHARDEV to CHARDEV_VC
chardev: Rename WCTABLET_CHARDEV to CHARDEV_WCTABLET
chardev: Rename WIN_CHARDEV to CHARDEV_WIN
chardev: Rename WIN_STDIO_CHARDEV to CHARDEV_WIN_STDIO
chardev/chardev-internal.h | 2 +-
include/chardev/char-fd.h | 2 +-
include/chardev/char-win.h | 2 +-
include/chardev/spice.h | 2 +-
chardev/baum.c | 14 ++++----
chardev/char-fd.c | 14 ++++----
chardev/char-fe.c | 4 +--
chardev/char-mux.c | 22 ++++++------
chardev/char-parallel.c | 28 ++++++++--------
chardev/char-pipe.c | 2 +-
chardev/char-pty.c | 22 ++++++------
chardev/char-ringbuf.c | 12 +++----
chardev/char-serial.c | 2 +-
chardev/char-socket.c | 68 +++++++++++++++++++-------------------
chardev/char-udp.c | 14 ++++----
chardev/char-win-stdio.c | 14 ++++----
chardev/char-win.c | 14 ++++----
chardev/char.c | 2 +-
chardev/msmouse.c | 12 +++----
chardev/spice.c | 16 ++++-----
chardev/testdev.c | 4 +--
chardev/wctablet.c | 12 +++----
ui/console.c | 10 +++---
ui/gtk.c | 8 ++---
ui/spice-app.c | 2 +-
25 files changed, 151 insertions(+), 153 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH 01/18] chardev: Move PARALLEL_CHARDEV macro to common code
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 02/18] chardev: Move ParallelChardev typedef " Eduardo Habkost
` (17 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
The macro is exactly the same for both Linux and BSD, so move its
definition outside the host OS #ifdef blocks.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-parallel.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/chardev/char-parallel.c b/chardev/char-parallel.c
index 05e7efbd6c..390d03506c 100644
--- a/chardev/char-parallel.c
+++ b/chardev/char-parallel.c
@@ -47,6 +47,9 @@
#include "chardev/char-fd.h"
#include "chardev/char-parallel.h"
+#define PARALLEL_CHARDEV(obj) \
+ OBJECT_CHECK(ParallelChardev, (obj), TYPE_CHARDEV_PARALLEL)
+
#if defined(__linux__)
typedef struct {
@@ -55,9 +58,6 @@ typedef struct {
int mode;
} ParallelChardev;
-#define PARALLEL_CHARDEV(obj) \
- OBJECT_CHECK(ParallelChardev, (obj), TYPE_CHARDEV_PARALLEL)
-
static int pp_hw_mode(ParallelChardev *s, uint16_t mode)
{
if (s->mode != mode) {
@@ -182,9 +182,6 @@ typedef struct {
int fd;
} ParallelChardev;
-#define PARALLEL_CHARDEV(obj) \
- OBJECT_CHECK(ParallelChardev, (obj), TYPE_CHARDEV_PARALLEL)
-
static int pp_ioctl(Chardev *chr, int cmd, void *arg)
{
ParallelChardev *drv = PARALLEL_CHARDEV(chr);
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 02/18] chardev: Move ParallelChardev typedef to common code
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
2020-09-10 19:48 ` [PATCH 01/18] chardev: Move PARALLEL_CHARDEV macro to common code Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 03/18] chardev: Use DECLARE_INSTANCE_CHECKER macro for PARALLEL_CHARDEV Eduardo Habkost
` (16 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
The struct itself may have a different definition on each OS, but
we can define the typedef in common code, outside the host OS #ifdefs.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-parallel.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/chardev/char-parallel.c b/chardev/char-parallel.c
index 390d03506c..e32aa2d226 100644
--- a/chardev/char-parallel.c
+++ b/chardev/char-parallel.c
@@ -47,16 +47,17 @@
#include "chardev/char-fd.h"
#include "chardev/char-parallel.h"
+typedef struct ParallelChardev ParallelChardev;
#define PARALLEL_CHARDEV(obj) \
OBJECT_CHECK(ParallelChardev, (obj), TYPE_CHARDEV_PARALLEL)
#if defined(__linux__)
-typedef struct {
+struct ParallelChardev {
Chardev parent;
int fd;
int mode;
-} ParallelChardev;
+};
static int pp_hw_mode(ParallelChardev *s, uint16_t mode)
{
@@ -177,10 +178,10 @@ static void qemu_chr_open_pp_fd(Chardev *chr,
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-typedef struct {
+struct ParallelChardev {
Chardev parent;
int fd;
-} ParallelChardev;
+};
static int pp_ioctl(Chardev *chr, int cmd, void *arg)
{
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 03/18] chardev: Use DECLARE_INSTANCE_CHECKER macro for PARALLEL_CHARDEV
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
2020-09-10 19:48 ` [PATCH 01/18] chardev: Move PARALLEL_CHARDEV macro to common code Eduardo Habkost
2020-09-10 19:48 ` [PATCH 02/18] chardev: Move ParallelChardev typedef " Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 04/18] chardev: Rename MOUSE_CHARDEV to CHARDEV_MSMOUSE Eduardo Habkost
` (15 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Use DECLARE_INSTANCE_CHECKER instead of manually defining the
instance type checking macro.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-parallel.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chardev/char-parallel.c b/chardev/char-parallel.c
index e32aa2d226..3d670bcb1d 100644
--- a/chardev/char-parallel.c
+++ b/chardev/char-parallel.c
@@ -48,8 +48,8 @@
#include "chardev/char-parallel.h"
typedef struct ParallelChardev ParallelChardev;
-#define PARALLEL_CHARDEV(obj) \
- OBJECT_CHECK(ParallelChardev, (obj), TYPE_CHARDEV_PARALLEL)
+DECLARE_INSTANCE_CHECKER(ParallelChardev, PARALLEL_CHARDEV,
+ TYPE_CHARDEV_PARALLEL)
#if defined(__linux__)
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 04/18] chardev: Rename MOUSE_CHARDEV to CHARDEV_MSMOUSE
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (2 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 03/18] chardev: Use DECLARE_INSTANCE_CHECKER macro for PARALLEL_CHARDEV Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 05/18] chardev: Rename BAUM_CHARDEV to CHARDEV_BRAILLE Eduardo Habkost
` (14 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_MSMOUSE constant name and the QOM type name string
("chardev-msmouse").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/msmouse.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/chardev/msmouse.c b/chardev/msmouse.c
index eb9231dcdb..5cc3055c53 100644
--- a/chardev/msmouse.c
+++ b/chardev/msmouse.c
@@ -45,12 +45,12 @@ struct MouseChardev {
typedef struct MouseChardev MouseChardev;
#define TYPE_CHARDEV_MSMOUSE "chardev-msmouse"
-DECLARE_INSTANCE_CHECKER(MouseChardev, MOUSE_CHARDEV,
+DECLARE_INSTANCE_CHECKER(MouseChardev, CHARDEV_MSMOUSE,
TYPE_CHARDEV_MSMOUSE)
static void msmouse_chr_accept_input(Chardev *chr)
{
- MouseChardev *mouse = MOUSE_CHARDEV(chr);
+ MouseChardev *mouse = CHARDEV_MSMOUSE(chr);
int len;
len = qemu_chr_be_can_write(chr);
@@ -105,7 +105,7 @@ static void msmouse_queue_event(MouseChardev *mouse)
static void msmouse_input_event(DeviceState *dev, QemuConsole *src,
InputEvent *evt)
{
- MouseChardev *mouse = MOUSE_CHARDEV(dev);
+ MouseChardev *mouse = CHARDEV_MSMOUSE(dev);
InputMoveEvent *move;
InputBtnEvent *btn;
@@ -129,7 +129,7 @@ static void msmouse_input_event(DeviceState *dev, QemuConsole *src,
static void msmouse_input_sync(DeviceState *dev)
{
- MouseChardev *mouse = MOUSE_CHARDEV(dev);
+ MouseChardev *mouse = CHARDEV_MSMOUSE(dev);
Chardev *chr = CHARDEV(dev);
msmouse_queue_event(mouse);
@@ -144,7 +144,7 @@ static int msmouse_chr_write(struct Chardev *s, const uint8_t *buf, int len)
static void char_msmouse_finalize(Object *obj)
{
- MouseChardev *mouse = MOUSE_CHARDEV(obj);
+ MouseChardev *mouse = CHARDEV_MSMOUSE(obj);
qemu_input_handler_unregister(mouse->hs);
}
@@ -161,7 +161,7 @@ static void msmouse_chr_open(Chardev *chr,
bool *be_opened,
Error **errp)
{
- MouseChardev *mouse = MOUSE_CHARDEV(chr);
+ MouseChardev *mouse = CHARDEV_MSMOUSE(chr);
*be_opened = false;
mouse->hs = qemu_input_handler_register((DeviceState *)mouse,
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 05/18] chardev: Rename BAUM_CHARDEV to CHARDEV_BRAILLE
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (3 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 04/18] chardev: Rename MOUSE_CHARDEV to CHARDEV_MSMOUSE Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 06/18] chardev: Rename FD_CHARDEV to CHARDEV_FD Eduardo Habkost
` (13 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_BRAILLE constant name and the QOM type name string
("chardev-braille").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/baum.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/chardev/baum.c b/chardev/baum.c
index 5deca778bc..48459bd73c 100644
--- a/chardev/baum.c
+++ b/chardev/baum.c
@@ -105,7 +105,7 @@ struct BaumChardev {
typedef struct BaumChardev BaumChardev;
#define TYPE_CHARDEV_BRAILLE "chardev-braille"
-DECLARE_INSTANCE_CHECKER(BaumChardev, BAUM_CHARDEV,
+DECLARE_INSTANCE_CHECKER(BaumChardev, CHARDEV_BRAILLE,
TYPE_CHARDEV_BRAILLE)
/* Let's assume NABCC by default */
@@ -269,7 +269,7 @@ static int baum_deferred_init(BaumChardev *baum)
/* The serial port can receive more of our data */
static void baum_chr_accept_input(struct Chardev *chr)
{
- BaumChardev *baum = BAUM_CHARDEV(chr);
+ BaumChardev *baum = CHARDEV_BRAILLE(chr);
int room, first;
if (!baum->out_buf_used)
@@ -336,7 +336,7 @@ static void baum_write_packet(BaumChardev *baum, const uint8_t *buf, int len)
/* Called when the other end seems to have a wrong idea of our display size */
static void baum_cellCount_timer_cb(void *opaque)
{
- BaumChardev *baum = BAUM_CHARDEV(opaque);
+ BaumChardev *baum = CHARDEV_BRAILLE(opaque);
uint8_t cell_count[] = { BAUM_RSP_CellCount, baum->x * baum->y };
DPRINTF("Timeout waiting for DisplayData, sending cell count\n");
baum_write_packet(baum, cell_count, sizeof(cell_count));
@@ -486,7 +486,7 @@ static int baum_eat_packet(BaumChardev *baum, const uint8_t *buf, int len)
/* The other end is writing some data. Store it and try to interpret */
static int baum_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- BaumChardev *baum = BAUM_CHARDEV(chr);
+ BaumChardev *baum = CHARDEV_BRAILLE(chr);
int tocopy, cur, eaten, orig_len = len;
if (!len)
@@ -543,7 +543,7 @@ static void baum_send_key2(BaumChardev *baum, uint8_t type, uint8_t value,
/* We got some data on the BrlAPI socket */
static void baum_chr_read(void *opaque)
{
- BaumChardev *baum = BAUM_CHARDEV(opaque);
+ BaumChardev *baum = CHARDEV_BRAILLE(opaque);
brlapi_keyCode_t code;
int ret;
if (!baum->brlapi)
@@ -629,7 +629,7 @@ static void baum_chr_read(void *opaque)
static void char_braille_finalize(Object *obj)
{
- BaumChardev *baum = BAUM_CHARDEV(obj);
+ BaumChardev *baum = CHARDEV_BRAILLE(obj);
timer_free(baum->cellCount_timer);
if (baum->brlapi) {
@@ -643,7 +643,7 @@ static void baum_chr_open(Chardev *chr,
bool *be_opened,
Error **errp)
{
- BaumChardev *baum = BAUM_CHARDEV(chr);
+ BaumChardev *baum = CHARDEV_BRAILLE(chr);
brlapi_handle_t *handle;
handle = g_malloc0(brlapi_getHandleSize());
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 06/18] chardev: Rename FD_CHARDEV to CHARDEV_FD
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (4 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 05/18] chardev: Rename BAUM_CHARDEV to CHARDEV_BRAILLE Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 07/18] chardev: Rename MUX_CHARDEV to CHARDEV_MUX Eduardo Habkost
` (12 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/chardev/char-fd.h | 2 +-
chardev/char-fd.c | 14 +++++++-------
chardev/char-serial.c | 2 +-
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/chardev/char-fd.h b/include/chardev/char-fd.h
index 9de0e440de..707f7f1700 100644
--- a/include/chardev/char-fd.h
+++ b/include/chardev/char-fd.h
@@ -38,7 +38,7 @@ typedef struct FDChardev FDChardev;
#define TYPE_CHARDEV_FD "chardev-fd"
-DECLARE_INSTANCE_CHECKER(FDChardev, FD_CHARDEV,
+DECLARE_INSTANCE_CHECKER(FDChardev, CHARDEV_FD,
TYPE_CHARDEV_FD)
void qemu_chr_open_fd(Chardev *chr, int fd_in, int fd_out);
diff --git a/chardev/char-fd.c b/chardev/char-fd.c
index c2d8101106..b1701c4e4a 100644
--- a/chardev/char-fd.c
+++ b/chardev/char-fd.c
@@ -36,7 +36,7 @@
/* Called with chr_write_lock held. */
static int fd_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- FDChardev *s = FD_CHARDEV(chr);
+ FDChardev *s = CHARDEV_FD(chr);
return io_channel_send(s->ioc_out, buf, len);
}
@@ -44,7 +44,7 @@ static int fd_chr_write(Chardev *chr, const uint8_t *buf, int len)
static gboolean fd_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- FDChardev *s = FD_CHARDEV(opaque);
+ FDChardev *s = CHARDEV_FD(opaque);
int len;
uint8_t buf[CHR_READ_BUF_LEN];
ssize_t ret;
@@ -74,7 +74,7 @@ static gboolean fd_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
static int fd_chr_read_poll(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- FDChardev *s = FD_CHARDEV(opaque);
+ FDChardev *s = CHARDEV_FD(opaque);
s->max_size = qemu_chr_be_can_write(chr);
return s->max_size;
@@ -82,13 +82,13 @@ static int fd_chr_read_poll(void *opaque)
static GSource *fd_chr_add_watch(Chardev *chr, GIOCondition cond)
{
- FDChardev *s = FD_CHARDEV(chr);
+ FDChardev *s = CHARDEV_FD(chr);
return qio_channel_create_watch(s->ioc_out, cond);
}
static void fd_chr_update_read_handler(Chardev *chr)
{
- FDChardev *s = FD_CHARDEV(chr);
+ FDChardev *s = CHARDEV_FD(chr);
remove_fd_in_watch(chr);
if (s->ioc_in) {
@@ -102,7 +102,7 @@ static void fd_chr_update_read_handler(Chardev *chr)
static void char_fd_finalize(Object *obj)
{
Chardev *chr = CHARDEV(obj);
- FDChardev *s = FD_CHARDEV(obj);
+ FDChardev *s = CHARDEV_FD(obj);
remove_fd_in_watch(chr);
if (s->ioc_in) {
@@ -130,7 +130,7 @@ int qmp_chardev_open_file_source(char *src, int flags, Error **errp)
void qemu_chr_open_fd(Chardev *chr,
int fd_in, int fd_out)
{
- FDChardev *s = FD_CHARDEV(chr);
+ FDChardev *s = CHARDEV_FD(chr);
char *name;
s->ioc_in = QIO_CHANNEL(qio_channel_file_new_fd(fd_in));
diff --git a/chardev/char-serial.c b/chardev/char-serial.c
index 7c3d84ae24..de1705d2a8 100644
--- a/chardev/char-serial.c
+++ b/chardev/char-serial.c
@@ -178,7 +178,7 @@ static void tty_serial_init(int fd, int speed,
static int tty_serial_ioctl(Chardev *chr, int cmd, void *arg)
{
- FDChardev *s = FD_CHARDEV(chr);
+ FDChardev *s = CHARDEV_FD(chr);
QIOChannelFile *fioc = QIO_CHANNEL_FILE(s->ioc_in);
switch (cmd) {
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 07/18] chardev: Rename MUX_CHARDEV to CHARDEV_MUX
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (5 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 06/18] chardev: Rename FD_CHARDEV to CHARDEV_FD Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 08/18] chardev: Rename PARALLEL_CHARDEV to CHARDEV_PARALLEL Eduardo Habkost
` (11 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/chardev-internal.h | 2 +-
chardev/char-fe.c | 4 ++--
chardev/char-mux.c | 22 +++++++++++-----------
chardev/char.c | 2 +-
4 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/chardev/chardev-internal.h b/chardev/chardev-internal.h
index aba0240759..740d56bf94 100644
--- a/chardev/chardev-internal.h
+++ b/chardev/chardev-internal.h
@@ -54,7 +54,7 @@ struct MuxChardev {
};
typedef struct MuxChardev MuxChardev;
-DECLARE_INSTANCE_CHECKER(MuxChardev, MUX_CHARDEV,
+DECLARE_INSTANCE_CHECKER(MuxChardev, CHARDEV_MUX,
TYPE_CHARDEV_MUX)
#define CHARDEV_IS_MUX(chr) \
object_dynamic_cast(OBJECT(chr), TYPE_CHARDEV_MUX)
diff --git a/chardev/char-fe.c b/chardev/char-fe.c
index 474715c5a9..419835c340 100644
--- a/chardev/char-fe.c
+++ b/chardev/char-fe.c
@@ -196,7 +196,7 @@ bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp)
if (s) {
if (CHARDEV_IS_MUX(s)) {
- MuxChardev *d = MUX_CHARDEV(s);
+ MuxChardev *d = CHARDEV_MUX(s);
if (d->mux_cnt >= MAX_MUX) {
goto unavailable;
@@ -231,7 +231,7 @@ void qemu_chr_fe_deinit(CharBackend *b, bool del)
b->chr->be = NULL;
}
if (CHARDEV_IS_MUX(b->chr)) {
- MuxChardev *d = MUX_CHARDEV(b->chr);
+ MuxChardev *d = CHARDEV_MUX(b->chr);
d->backends[b->tag] = NULL;
}
if (del) {
diff --git a/chardev/char-mux.c b/chardev/char-mux.c
index 6f980bb836..a9dcbf2cc0 100644
--- a/chardev/char-mux.c
+++ b/chardev/char-mux.c
@@ -36,7 +36,7 @@
/* Called with chr_write_lock held. */
static int mux_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- MuxChardev *d = MUX_CHARDEV(chr);
+ MuxChardev *d = CHARDEV_MUX(chr);
int ret;
if (!d->timestamps) {
ret = qemu_chr_fe_write(&d->chr, buf, len);
@@ -128,7 +128,7 @@ static void mux_chr_send_event(MuxChardev *d, int mux_nr, QEMUChrEvent event)
static void mux_chr_be_event(Chardev *chr, QEMUChrEvent event)
{
- MuxChardev *d = MUX_CHARDEV(chr);
+ MuxChardev *d = CHARDEV_MUX(chr);
if (d->focus != -1) {
mux_chr_send_event(d, d->focus, event);
@@ -182,7 +182,7 @@ static int mux_proc_byte(Chardev *chr, MuxChardev *d, int ch)
static void mux_chr_accept_input(Chardev *chr)
{
- MuxChardev *d = MUX_CHARDEV(chr);
+ MuxChardev *d = CHARDEV_MUX(chr);
int m = d->focus;
CharBackend *be = d->backends[m];
@@ -195,7 +195,7 @@ static void mux_chr_accept_input(Chardev *chr)
static int mux_chr_can_read(void *opaque)
{
- MuxChardev *d = MUX_CHARDEV(opaque);
+ MuxChardev *d = CHARDEV_MUX(opaque);
int m = d->focus;
CharBackend *be = d->backends[m];
@@ -213,7 +213,7 @@ static int mux_chr_can_read(void *opaque)
static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
{
Chardev *chr = CHARDEV(opaque);
- MuxChardev *d = MUX_CHARDEV(opaque);
+ MuxChardev *d = CHARDEV_MUX(opaque);
int m = d->focus;
CharBackend *be = d->backends[m];
int i;
@@ -234,7 +234,7 @@ static void mux_chr_read(void *opaque, const uint8_t *buf, int size)
void mux_chr_send_all_event(Chardev *chr, QEMUChrEvent event)
{
- MuxChardev *d = MUX_CHARDEV(chr);
+ MuxChardev *d = CHARDEV_MUX(chr);
int i;
if (!machine_init_done) {
@@ -254,7 +254,7 @@ static void mux_chr_event(void *opaque, QEMUChrEvent event)
static GSource *mux_chr_add_watch(Chardev *s, GIOCondition cond)
{
- MuxChardev *d = MUX_CHARDEV(s);
+ MuxChardev *d = CHARDEV_MUX(s);
Chardev *chr = qemu_chr_fe_get_driver(&d->chr);
ChardevClass *cc = CHARDEV_GET_CLASS(chr);
@@ -267,7 +267,7 @@ static GSource *mux_chr_add_watch(Chardev *s, GIOCondition cond)
static void char_mux_finalize(Object *obj)
{
- MuxChardev *d = MUX_CHARDEV(obj);
+ MuxChardev *d = CHARDEV_MUX(obj);
int i;
for (i = 0; i < d->mux_cnt; i++) {
@@ -281,7 +281,7 @@ static void char_mux_finalize(Object *obj)
static void mux_chr_update_read_handlers(Chardev *chr)
{
- MuxChardev *d = MUX_CHARDEV(chr);
+ MuxChardev *d = CHARDEV_MUX(chr);
/* Fix up the real driver with mux routines */
qemu_chr_fe_set_handlers_full(&d->chr,
@@ -295,7 +295,7 @@ static void mux_chr_update_read_handlers(Chardev *chr)
void mux_set_focus(Chardev *chr, int focus)
{
- MuxChardev *d = MUX_CHARDEV(chr);
+ MuxChardev *d = CHARDEV_MUX(chr);
assert(focus >= 0);
assert(focus < d->mux_cnt);
@@ -316,7 +316,7 @@ static void qemu_chr_open_mux(Chardev *chr,
{
ChardevMux *mux = backend->u.mux.data;
Chardev *drv;
- MuxChardev *d = MUX_CHARDEV(chr);
+ MuxChardev *d = CHARDEV_MUX(chr);
drv = qemu_chr_find(mux->chardev);
if (drv == NULL) {
diff --git a/chardev/char.c b/chardev/char.c
index 77e7ec814f..43fb8bd50e 100644
--- a/chardev/char.c
+++ b/chardev/char.c
@@ -308,7 +308,7 @@ static const TypeInfo char_type_info = {
static bool qemu_chr_is_busy(Chardev *s)
{
if (CHARDEV_IS_MUX(s)) {
- MuxChardev *d = MUX_CHARDEV(s);
+ MuxChardev *d = CHARDEV_MUX(s);
return d->mux_cnt >= 0;
} else {
return s->be != NULL;
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 08/18] chardev: Rename PARALLEL_CHARDEV to CHARDEV_PARALLEL
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (6 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 07/18] chardev: Rename MUX_CHARDEV to CHARDEV_MUX Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 09/18] chardev: Rename PTY_CHARDEV to CHARDEV_PTY Eduardo Habkost
` (10 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-parallel.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/chardev/char-parallel.c b/chardev/char-parallel.c
index 3d670bcb1d..7ab19339c7 100644
--- a/chardev/char-parallel.c
+++ b/chardev/char-parallel.c
@@ -48,7 +48,7 @@
#include "chardev/char-parallel.h"
typedef struct ParallelChardev ParallelChardev;
-DECLARE_INSTANCE_CHECKER(ParallelChardev, PARALLEL_CHARDEV,
+DECLARE_INSTANCE_CHECKER(ParallelChardev, CHARDEV_PARALLEL,
TYPE_CHARDEV_PARALLEL)
#if defined(__linux__)
@@ -73,7 +73,7 @@ static int pp_hw_mode(ParallelChardev *s, uint16_t mode)
static int pp_ioctl(Chardev *chr, int cmd, void *arg)
{
- ParallelChardev *drv = PARALLEL_CHARDEV(chr);
+ ParallelChardev *drv = CHARDEV_PARALLEL(chr);
int fd = drv->fd;
uint8_t b;
@@ -163,7 +163,7 @@ static void qemu_chr_open_pp_fd(Chardev *chr,
bool *be_opened,
Error **errp)
{
- ParallelChardev *drv = PARALLEL_CHARDEV(chr);
+ ParallelChardev *drv = CHARDEV_PARALLEL(chr);
if (ioctl(fd, PPCLAIM) < 0) {
error_setg_errno(errp, errno, "not a parallel port");
@@ -185,7 +185,7 @@ struct ParallelChardev {
static int pp_ioctl(Chardev *chr, int cmd, void *arg)
{
- ParallelChardev *drv = PARALLEL_CHARDEV(chr);
+ ParallelChardev *drv = CHARDEV_PARALLEL(chr);
uint8_t b;
switch (cmd) {
@@ -230,7 +230,7 @@ static void qemu_chr_open_pp_fd(Chardev *chr,
bool *be_opened,
Error **errp)
{
- ParallelChardev *drv = PARALLEL_CHARDEV(chr);
+ ParallelChardev *drv = CHARDEV_PARALLEL(chr);
drv->fd = fd;
*be_opened = false;
}
@@ -286,7 +286,7 @@ static void char_parallel_finalize(Object *obj)
{
#if defined(__linux__)
Chardev *chr = CHARDEV(obj);
- ParallelChardev *drv = PARALLEL_CHARDEV(chr);
+ ParallelChardev *drv = CHARDEV_PARALLEL(chr);
int fd = drv->fd;
pp_hw_mode(drv, IEEE1284_MODE_COMPAT);
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 09/18] chardev: Rename PTY_CHARDEV to CHARDEV_PTY
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (7 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 08/18] chardev: Rename PARALLEL_CHARDEV to CHARDEV_PARALLEL Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 10/18] chardev: Rename RINGBUF_CHARDEV to CHARDEV_RINGBUF Eduardo Habkost
` (9 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-pty.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/chardev/char-pty.c b/chardev/char-pty.c
index a2d1e7c985..4c1c877097 100644
--- a/chardev/char-pty.c
+++ b/chardev/char-pty.c
@@ -45,7 +45,7 @@ struct PtyChardev {
};
typedef struct PtyChardev PtyChardev;
-DECLARE_INSTANCE_CHECKER(PtyChardev, PTY_CHARDEV,
+DECLARE_INSTANCE_CHECKER(PtyChardev, CHARDEV_PTY,
TYPE_CHARDEV_PTY)
static void pty_chr_state(Chardev *chr, int connected);
@@ -62,7 +62,7 @@ static void pty_chr_timer_cancel(PtyChardev *s)
static gboolean pty_chr_timer(gpointer opaque)
{
struct Chardev *chr = CHARDEV(opaque);
- PtyChardev *s = PTY_CHARDEV(opaque);
+ PtyChardev *s = CHARDEV_PTY(opaque);
pty_chr_timer_cancel(s);
if (!s->connected) {
@@ -74,7 +74,7 @@ static gboolean pty_chr_timer(gpointer opaque)
static void pty_chr_rearm_timer(Chardev *chr, int ms)
{
- PtyChardev *s = PTY_CHARDEV(chr);
+ PtyChardev *s = CHARDEV_PTY(chr);
char *name;
pty_chr_timer_cancel(s);
@@ -86,7 +86,7 @@ static void pty_chr_rearm_timer(Chardev *chr, int ms)
static void pty_chr_update_read_handler(Chardev *chr)
{
- PtyChardev *s = PTY_CHARDEV(chr);
+ PtyChardev *s = CHARDEV_PTY(chr);
GPollFD pfd;
int rc;
QIOChannelFile *fioc = QIO_CHANNEL_FILE(s->ioc);
@@ -108,7 +108,7 @@ static void pty_chr_update_read_handler(Chardev *chr)
static int char_pty_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- PtyChardev *s = PTY_CHARDEV(chr);
+ PtyChardev *s = CHARDEV_PTY(chr);
if (!s->connected) {
return len;
@@ -118,7 +118,7 @@ static int char_pty_chr_write(Chardev *chr, const uint8_t *buf, int len)
static GSource *pty_chr_add_watch(Chardev *chr, GIOCondition cond)
{
- PtyChardev *s = PTY_CHARDEV(chr);
+ PtyChardev *s = CHARDEV_PTY(chr);
if (!s->connected) {
return NULL;
}
@@ -128,7 +128,7 @@ static GSource *pty_chr_add_watch(Chardev *chr, GIOCondition cond)
static int pty_chr_read_poll(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- PtyChardev *s = PTY_CHARDEV(opaque);
+ PtyChardev *s = CHARDEV_PTY(opaque);
s->read_bytes = qemu_chr_be_can_write(chr);
return s->read_bytes;
@@ -137,7 +137,7 @@ static int pty_chr_read_poll(void *opaque)
static gboolean pty_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- PtyChardev *s = PTY_CHARDEV(opaque);
+ PtyChardev *s = CHARDEV_PTY(opaque);
gsize len;
uint8_t buf[CHR_READ_BUF_LEN];
ssize_t ret;
@@ -162,7 +162,7 @@ static gboolean pty_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
static void pty_chr_state(Chardev *chr, int connected)
{
- PtyChardev *s = PTY_CHARDEV(chr);
+ PtyChardev *s = CHARDEV_PTY(chr);
if (!connected) {
remove_fd_in_watch(chr);
@@ -189,7 +189,7 @@ static void pty_chr_state(Chardev *chr, int connected)
static void char_pty_finalize(Object *obj)
{
Chardev *chr = CHARDEV(obj);
- PtyChardev *s = PTY_CHARDEV(obj);
+ PtyChardev *s = CHARDEV_PTY(obj);
pty_chr_state(chr, 0);
object_unref(OBJECT(s->ioc));
@@ -220,7 +220,7 @@ static void char_pty_open(Chardev *chr,
qemu_printf("char device redirected to %s (label %s)\n",
pty_name, chr->label);
- s = PTY_CHARDEV(chr);
+ s = CHARDEV_PTY(chr);
s->ioc = QIO_CHANNEL(qio_channel_file_new_fd(master_fd));
name = g_strdup_printf("chardev-pty-%s", chr->label);
qio_channel_set_name(QIO_CHANNEL(s->ioc), name);
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 10/18] chardev: Rename RINGBUF_CHARDEV to CHARDEV_RINGBUF
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (8 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 09/18] chardev: Rename PTY_CHARDEV to CHARDEV_PTY Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 11/18] chardev: Rename SOCKET_CHARDEV to CHARDEV_SOCKET Eduardo Habkost
` (8 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-ringbuf.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/chardev/char-ringbuf.c b/chardev/char-ringbuf.c
index d40d21d3cf..8d2916cd78 100644
--- a/chardev/char-ringbuf.c
+++ b/chardev/char-ringbuf.c
@@ -42,19 +42,19 @@ struct RingBufChardev {
};
typedef struct RingBufChardev RingBufChardev;
-DECLARE_INSTANCE_CHECKER(RingBufChardev, RINGBUF_CHARDEV,
+DECLARE_INSTANCE_CHECKER(RingBufChardev, CHARDEV_RINGBUF,
TYPE_CHARDEV_RINGBUF)
static size_t ringbuf_count(const Chardev *chr)
{
- const RingBufChardev *d = RINGBUF_CHARDEV(chr);
+ const RingBufChardev *d = CHARDEV_RINGBUF(chr);
return d->prod - d->cons;
}
static int ringbuf_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- RingBufChardev *d = RINGBUF_CHARDEV(chr);
+ RingBufChardev *d = CHARDEV_RINGBUF(chr);
int i;
if (!buf || (len < 0)) {
@@ -73,7 +73,7 @@ static int ringbuf_chr_write(Chardev *chr, const uint8_t *buf, int len)
static int ringbuf_chr_read(Chardev *chr, uint8_t *buf, int len)
{
- RingBufChardev *d = RINGBUF_CHARDEV(chr);
+ RingBufChardev *d = CHARDEV_RINGBUF(chr);
int i;
qemu_mutex_lock(&chr->chr_write_lock);
@@ -87,7 +87,7 @@ static int ringbuf_chr_read(Chardev *chr, uint8_t *buf, int len)
static void char_ringbuf_finalize(Object *obj)
{
- RingBufChardev *d = RINGBUF_CHARDEV(obj);
+ RingBufChardev *d = CHARDEV_RINGBUF(obj);
g_free(d->cbuf);
}
@@ -98,7 +98,7 @@ static void qemu_chr_open_ringbuf(Chardev *chr,
Error **errp)
{
ChardevRingbuf *opts = backend->u.ringbuf.data;
- RingBufChardev *d = RINGBUF_CHARDEV(chr);
+ RingBufChardev *d = CHARDEV_RINGBUF(chr);
d->size = opts->has_size ? opts->size : 65536;
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 11/18] chardev: Rename SOCKET_CHARDEV to CHARDEV_SOCKET
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (9 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 10/18] chardev: Rename RINGBUF_CHARDEV to CHARDEV_RINGBUF Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 12/18] chardev: Rename SPICE_CHARDEV to CHARDEV_SPICE Eduardo Habkost
` (7 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-socket.c | 68 +++++++++++++++++++++----------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/chardev/char-socket.c b/chardev/char-socket.c
index 95e45812d5..fac2b4a821 100644
--- a/chardev/char-socket.c
+++ b/chardev/char-socket.c
@@ -88,7 +88,7 @@ struct SocketChardev {
};
typedef struct SocketChardev SocketChardev;
-DECLARE_INSTANCE_CHECKER(SocketChardev, SOCKET_CHARDEV,
+DECLARE_INSTANCE_CHECKER(SocketChardev, CHARDEV_SOCKET,
TYPE_CHARDEV_SOCKET)
static gboolean socket_reconnect_timeout(gpointer opaque);
@@ -120,7 +120,7 @@ static void tcp_chr_reconn_timer_cancel(SocketChardev *s)
static void qemu_chr_socket_restart_timer(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
char *name;
assert(s->state == TCP_CHARDEV_STATE_DISCONNECTED);
@@ -137,7 +137,7 @@ static void qemu_chr_socket_restart_timer(Chardev *chr)
static void check_report_connect_error(Chardev *chr,
Error *err)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
if (!s->connect_err_reported) {
error_reportf_err(err,
@@ -160,7 +160,7 @@ static void tcp_chr_disconnect_locked(Chardev *chr);
/* Called with chr_write_lock held. */
static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
if (s->state == TCP_CHARDEV_STATE_CONNECTED) {
int ret = io_channel_send_full(s->ioc, buf, len,
@@ -195,7 +195,7 @@ static int tcp_chr_write(Chardev *chr, const uint8_t *buf, int len)
static int tcp_chr_read_poll(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- SocketChardev *s = SOCKET_CHARDEV(opaque);
+ SocketChardev *s = CHARDEV_SOCKET(opaque);
if (s->state != TCP_CHARDEV_STATE_CONNECTED) {
return 0;
}
@@ -276,7 +276,7 @@ static void tcp_chr_process_IAC_bytes(Chardev *chr,
static int tcp_get_msgfds(Chardev *chr, int *fds, int num)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
int to_copy = (s->read_msgfds_num < num) ? s->read_msgfds_num : num;
@@ -302,7 +302,7 @@ static int tcp_get_msgfds(Chardev *chr, int *fds, int num)
static int tcp_set_msgfds(Chardev *chr, int *fds, int num)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
/* clear old pending fd array */
g_free(s->write_msgfds);
@@ -327,7 +327,7 @@ static int tcp_set_msgfds(Chardev *chr, int *fds, int num)
static ssize_t tcp_chr_recv(Chardev *chr, char *buf, size_t len)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
struct iovec iov = { .iov_base = buf, .iov_len = len };
int ret;
size_t i;
@@ -384,7 +384,7 @@ static ssize_t tcp_chr_recv(Chardev *chr, char *buf, size_t len)
static GSource *tcp_chr_add_watch(Chardev *chr, GIOCondition cond)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
return qio_channel_create_watch(s->ioc, cond);
}
@@ -399,7 +399,7 @@ static void remove_hup_source(SocketChardev *s)
static void tcp_chr_free_connection(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
int i;
if (s->read_msgfds_num) {
@@ -479,7 +479,7 @@ static void update_disconnected_filename(SocketChardev *s)
*/
static void tcp_chr_disconnect_locked(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
bool emit_close = s->state == TCP_CHARDEV_STATE_CONNECTED;
tcp_chr_free_connection(chr);
@@ -507,7 +507,7 @@ static void tcp_chr_disconnect(Chardev *chr)
static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- SocketChardev *s = SOCKET_CHARDEV(opaque);
+ SocketChardev *s = CHARDEV_SOCKET(opaque);
uint8_t buf[CHR_READ_BUF_LEN];
int len, size;
@@ -546,7 +546,7 @@ static gboolean tcp_chr_hup(QIOChannel *channel,
static int tcp_chr_sync_read(Chardev *chr, const uint8_t *buf, int len)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
int size;
if (s->state != TCP_CHARDEV_STATE_CONNECTED) {
@@ -627,7 +627,7 @@ static void update_ioc_handlers(SocketChardev *s)
static void tcp_chr_connect(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- SocketChardev *s = SOCKET_CHARDEV(opaque);
+ SocketChardev *s = CHARDEV_SOCKET(opaque);
g_free(chr->filename);
chr->filename = qemu_chr_compute_filename(s);
@@ -648,7 +648,7 @@ static void tcp_chr_telnet_destroy(SocketChardev *s)
static void tcp_chr_update_read_handler(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
if (s->listener && s->state == TCP_CHARDEV_STATE_DISCONNECTED) {
/*
@@ -708,7 +708,7 @@ end:
static void tcp_chr_telnet_init(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
TCPChardevTelnetInit *init;
size_t n = 0;
@@ -779,7 +779,7 @@ static void tcp_chr_websock_handshake(QIOTask *task, gpointer user_data)
static void tcp_chr_websock_init(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
QIOChannelWebsock *wioc = NULL;
gchar *name;
@@ -817,7 +817,7 @@ static void tcp_chr_tls_handshake(QIOTask *task,
static void tcp_chr_tls_init(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
QIOChannelTLS *tioc;
gchar *name;
@@ -855,7 +855,7 @@ static void tcp_chr_tls_init(Chardev *chr)
static void tcp_chr_set_client_ioc_name(Chardev *chr,
QIOChannelSocket *sioc)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
char *name;
name = g_strdup_printf("chardev-tcp-%s-%s",
s->is_listen ? "server" : "client",
@@ -867,7 +867,7 @@ static void tcp_chr_set_client_ioc_name(Chardev *chr,
static int tcp_chr_new_client(Chardev *chr, QIOChannelSocket *sioc)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
if (s->state != TCP_CHARDEV_STATE_CONNECTING) {
return -1;
@@ -906,7 +906,7 @@ static int tcp_chr_add_client(Chardev *chr, int fd)
{
int ret;
QIOChannelSocket *sioc;
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
if (s->state != TCP_CHARDEV_STATE_DISCONNECTED) {
return -1;
@@ -928,7 +928,7 @@ static void tcp_chr_accept(QIONetListener *listener,
void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
tcp_chr_set_client_ioc_name(chr, cioc);
@@ -938,7 +938,7 @@ static void tcp_chr_accept(QIONetListener *listener,
static int tcp_chr_connect_client_sync(Chardev *chr, Error **errp)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
QIOChannelSocket *sioc = qio_channel_socket_new();
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
tcp_chr_set_client_ioc_name(chr, sioc);
@@ -955,7 +955,7 @@ static int tcp_chr_connect_client_sync(Chardev *chr, Error **errp)
static void tcp_chr_accept_server_sync(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
QIOChannelSocket *sioc;
info_report("QEMU waiting for connection on: %s",
chr->filename);
@@ -969,7 +969,7 @@ static void tcp_chr_accept_server_sync(Chardev *chr)
static int tcp_chr_wait_connected(Chardev *chr, Error **errp)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
const char *opts[] = { "telnet", "tn3270", "websock", "tls-creds" };
bool optset[] = { s->is_telnet, s->is_tn3270, s->is_websock, s->tls_creds };
size_t i;
@@ -1056,7 +1056,7 @@ static int tcp_chr_wait_connected(Chardev *chr, Error **errp)
static void char_socket_finalize(Object *obj)
{
Chardev *chr = CHARDEV(obj);
- SocketChardev *s = SOCKET_CHARDEV(obj);
+ SocketChardev *s = CHARDEV_SOCKET(obj);
tcp_chr_free_connection(chr);
tcp_chr_reconn_timer_cancel(s);
@@ -1080,7 +1080,7 @@ static void qemu_chr_socket_connected(QIOTask *task, void *opaque)
{
QIOChannelSocket *sioc = QIO_CHANNEL_SOCKET(qio_task_get_source(task));
Chardev *chr = CHARDEV(opaque);
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
Error *err = NULL;
s->connect_task = NULL;
@@ -1114,7 +1114,7 @@ static void tcp_chr_connect_client_task(QIOTask *task,
static void tcp_chr_connect_client_async(Chardev *chr)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
QIOChannelSocket *sioc;
tcp_chr_change_state(s, TCP_CHARDEV_STATE_CONNECTING);
@@ -1143,7 +1143,7 @@ static void tcp_chr_connect_client_async(Chardev *chr)
static gboolean socket_reconnect_timeout(gpointer opaque)
{
Chardev *chr = CHARDEV(opaque);
- SocketChardev *s = SOCKET_CHARDEV(opaque);
+ SocketChardev *s = CHARDEV_SOCKET(opaque);
qemu_mutex_lock(&chr->chr_write_lock);
g_source_unref(s->reconnect_timer);
@@ -1165,7 +1165,7 @@ static int qmp_chardev_open_socket_server(Chardev *chr,
bool is_waitconnect,
Error **errp)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
char *name;
if (is_telnet) {
s->do_telnetopt = 1;
@@ -1203,7 +1203,7 @@ static int qmp_chardev_open_socket_client(Chardev *chr,
int64_t reconnect,
Error **errp)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
if (reconnect > 0) {
s->reconnect_time = reconnect;
@@ -1300,7 +1300,7 @@ static void qmp_chardev_open_socket(Chardev *chr,
bool *be_opened,
Error **errp)
{
- SocketChardev *s = SOCKET_CHARDEV(chr);
+ SocketChardev *s = CHARDEV_SOCKET(chr);
ChardevSocket *sock = backend->u.socket.data;
bool do_nodelay = sock->has_nodelay ? sock->nodelay : false;
bool is_listen = sock->has_server ? sock->server : true;
@@ -1468,7 +1468,7 @@ static void
char_socket_get_addr(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- SocketChardev *s = SOCKET_CHARDEV(obj);
+ SocketChardev *s = CHARDEV_SOCKET(obj);
visit_type_SocketAddress(v, name, &s->addr, errp);
}
@@ -1476,7 +1476,7 @@ char_socket_get_addr(Object *obj, Visitor *v, const char *name,
static bool
char_socket_get_connected(Object *obj, Error **errp)
{
- SocketChardev *s = SOCKET_CHARDEV(obj);
+ SocketChardev *s = CHARDEV_SOCKET(obj);
return s->state == TCP_CHARDEV_STATE_CONNECTED;
}
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 12/18] chardev: Rename SPICE_CHARDEV to CHARDEV_SPICE
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (10 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 11/18] chardev: Rename SOCKET_CHARDEV to CHARDEV_SOCKET Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 13/18] chardev: Rename TESTDEV_CHARDEV to CHARDEV_TESTDEV Eduardo Habkost
` (6 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/chardev/spice.h | 2 +-
chardev/spice.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/chardev/spice.h b/include/chardev/spice.h
index 99f26aedde..a48146d2c1 100644
--- a/include/chardev/spice.h
+++ b/include/chardev/spice.h
@@ -21,7 +21,7 @@ typedef struct SpiceChardev SpiceChardev;
#define TYPE_CHARDEV_SPICEVMC "chardev-spicevmc"
#define TYPE_CHARDEV_SPICEPORT "chardev-spiceport"
-DECLARE_INSTANCE_CHECKER(SpiceChardev, SPICE_CHARDEV,
+DECLARE_INSTANCE_CHECKER(SpiceChardev, CHARDEV_SPICE,
TYPE_CHARDEV_SPICE)
void qemu_chr_open_spice_port(Chardev *chr, ChardevBackend *backend,
diff --git a/chardev/spice.c b/chardev/spice.c
index bf7ea1e294..90a6a55626 100644
--- a/chardev/spice.c
+++ b/chardev/spice.c
@@ -173,7 +173,7 @@ static GSourceFuncs SpiceCharSourceFuncs = {
static GSource *spice_chr_add_watch(Chardev *chr, GIOCondition cond)
{
- SpiceChardev *scd = SPICE_CHARDEV(chr);
+ SpiceChardev *scd = CHARDEV_SPICE(chr);
SpiceCharSource *src;
assert(cond & G_IO_OUT);
@@ -187,7 +187,7 @@ static GSource *spice_chr_add_watch(Chardev *chr, GIOCondition cond)
static int spice_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- SpiceChardev *s = SPICE_CHARDEV(chr);
+ SpiceChardev *s = CHARDEV_SPICE(chr);
int read_bytes;
assert(s->datalen == 0);
@@ -212,7 +212,7 @@ static int spice_chr_write(Chardev *chr, const uint8_t *buf, int len)
static void char_spice_finalize(Object *obj)
{
- SpiceChardev *s = SPICE_CHARDEV(obj);
+ SpiceChardev *s = CHARDEV_SPICE(obj);
vmc_unregister_interface(s);
@@ -224,7 +224,7 @@ static void char_spice_finalize(Object *obj)
static void spice_vmc_set_fe_open(struct Chardev *chr, int fe_open)
{
- SpiceChardev *s = SPICE_CHARDEV(chr);
+ SpiceChardev *s = CHARDEV_SPICE(chr);
if (fe_open) {
vmc_register_interface(s);
} else {
@@ -234,7 +234,7 @@ static void spice_vmc_set_fe_open(struct Chardev *chr, int fe_open)
static void spice_port_set_fe_open(struct Chardev *chr, int fe_open)
{
- SpiceChardev *s = SPICE_CHARDEV(chr);
+ SpiceChardev *s = CHARDEV_SPICE(chr);
if (fe_open) {
spice_server_port_event(&s->sin, SPICE_PORT_EVENT_OPENED);
@@ -245,14 +245,14 @@ static void spice_port_set_fe_open(struct Chardev *chr, int fe_open)
static void spice_chr_accept_input(struct Chardev *chr)
{
- SpiceChardev *s = SPICE_CHARDEV(chr);
+ SpiceChardev *s = CHARDEV_SPICE(chr);
spice_server_char_device_wakeup(&s->sin);
}
static void chr_open(Chardev *chr, const char *subtype)
{
- SpiceChardev *s = SPICE_CHARDEV(chr);
+ SpiceChardev *s = CHARDEV_SPICE(chr);
s->active = false;
s->sin.subtype = g_strdup(subtype);
@@ -313,7 +313,7 @@ void qemu_chr_open_spice_port(Chardev *chr,
chr_open(chr, "port");
*be_opened = false;
- s = SPICE_CHARDEV(chr);
+ s = CHARDEV_SPICE(chr);
s->sin.portname = g_strdup(name);
if (using_spice) {
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 13/18] chardev: Rename TESTDEV_CHARDEV to CHARDEV_TESTDEV
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (11 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 12/18] chardev: Rename SPICE_CHARDEV to CHARDEV_SPICE Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:48 ` [PATCH 14/18] chardev: Rename UDP_CHARDEV to CHARDEV_UDP Eduardo Habkost
` (5 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/testdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/chardev/testdev.c b/chardev/testdev.c
index a92caca3c3..307e6bd09c 100644
--- a/chardev/testdev.c
+++ b/chardev/testdev.c
@@ -40,7 +40,7 @@ struct TestdevChardev {
typedef struct TestdevChardev TestdevChardev;
#define TYPE_CHARDEV_TESTDEV "chardev-testdev"
-DECLARE_INSTANCE_CHECKER(TestdevChardev, TESTDEV_CHARDEV,
+DECLARE_INSTANCE_CHECKER(TestdevChardev, CHARDEV_TESTDEV,
TYPE_CHARDEV_TESTDEV)
/* Try to interpret a whole incoming packet */
@@ -87,7 +87,7 @@ static int testdev_eat_packet(TestdevChardev *testdev)
/* The other end is writing some data. Store it and try to interpret */
static int testdev_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- TestdevChardev *testdev = TESTDEV_CHARDEV(chr);
+ TestdevChardev *testdev = CHARDEV_TESTDEV(chr);
int tocopy, eaten, orig_len = len;
while (len) {
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 14/18] chardev: Rename UDP_CHARDEV to CHARDEV_UDP
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (12 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 13/18] chardev: Rename TESTDEV_CHARDEV to CHARDEV_TESTDEV Eduardo Habkost
@ 2020-09-10 19:48 ` Eduardo Habkost
2020-09-10 19:49 ` [PATCH 15/18] chardev: Rename VC_CHARDEV to CHARDEV_VC Eduardo Habkost
` (4 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:48 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-udp.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/chardev/char-udp.c b/chardev/char-udp.c
index 16b5dbce58..9fa5b19a22 100644
--- a/chardev/char-udp.c
+++ b/chardev/char-udp.c
@@ -45,13 +45,13 @@ struct UdpChardev {
};
typedef struct UdpChardev UdpChardev;
-DECLARE_INSTANCE_CHECKER(UdpChardev, UDP_CHARDEV,
+DECLARE_INSTANCE_CHECKER(UdpChardev, CHARDEV_UDP,
TYPE_CHARDEV_UDP)
/* Called with chr_write_lock held. */
static int udp_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- UdpChardev *s = UDP_CHARDEV(chr);
+ UdpChardev *s = CHARDEV_UDP(chr);
return qio_channel_write(
s->ioc, (const char *)buf, len, NULL);
@@ -72,7 +72,7 @@ static void udp_chr_flush_buffer(UdpChardev *s)
static int udp_chr_read_poll(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- UdpChardev *s = UDP_CHARDEV(opaque);
+ UdpChardev *s = CHARDEV_UDP(opaque);
s->max_size = qemu_chr_be_can_write(chr);
@@ -87,7 +87,7 @@ static int udp_chr_read_poll(void *opaque)
static gboolean udp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- UdpChardev *s = UDP_CHARDEV(opaque);
+ UdpChardev *s = CHARDEV_UDP(opaque);
ssize_t ret;
if (s->max_size == 0) {
@@ -108,7 +108,7 @@ static gboolean udp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
static void udp_chr_update_read_handler(Chardev *chr)
{
- UdpChardev *s = UDP_CHARDEV(chr);
+ UdpChardev *s = CHARDEV_UDP(chr);
remove_fd_in_watch(chr);
if (s->ioc) {
@@ -122,7 +122,7 @@ static void udp_chr_update_read_handler(Chardev *chr)
static void char_udp_finalize(Object *obj)
{
Chardev *chr = CHARDEV(obj);
- UdpChardev *s = UDP_CHARDEV(obj);
+ UdpChardev *s = CHARDEV_UDP(obj);
remove_fd_in_watch(chr);
if (s->ioc) {
@@ -200,7 +200,7 @@ static void qmp_chardev_open_udp(Chardev *chr,
SocketAddress *remote_addr = socket_address_flatten(udp->remote);
QIOChannelSocket *sioc = qio_channel_socket_new();
char *name;
- UdpChardev *s = UDP_CHARDEV(chr);
+ UdpChardev *s = CHARDEV_UDP(chr);
int ret;
ret = qio_channel_socket_dgram_sync(sioc, local_addr, remote_addr, errp);
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 15/18] chardev: Rename VC_CHARDEV to CHARDEV_VC
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (13 preceding siblings ...)
2020-09-10 19:48 ` [PATCH 14/18] chardev: Rename UDP_CHARDEV to CHARDEV_UDP Eduardo Habkost
@ 2020-09-10 19:49 ` Eduardo Habkost
2020-09-10 19:49 ` [PATCH 16/18] chardev: Rename WCTABLET_CHARDEV to CHARDEV_WCTABLET Eduardo Habkost
` (3 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:49 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
ui/console.c | 10 +++++-----
ui/gtk.c | 8 ++++----
ui/spice-app.c | 2 +-
3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/ui/console.c b/ui/console.c
index f8d7643fe4..37a7c4a713 100644
--- a/ui/console.c
+++ b/ui/console.c
@@ -1090,12 +1090,12 @@ struct VCChardev {
typedef struct VCChardev VCChardev;
#define TYPE_CHARDEV_VC "chardev-vc"
-DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV,
+DECLARE_INSTANCE_CHECKER(VCChardev, CHARDEV_VC,
TYPE_CHARDEV_VC)
static int vc_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- VCChardev *drv = VC_CHARDEV(chr);
+ VCChardev *drv = CHARDEV_VC(chr);
QemuConsole *s = drv->console;
int i;
@@ -2108,7 +2108,7 @@ int qemu_console_get_height(QemuConsole *con, int fallback)
static void vc_chr_set_echo(Chardev *chr, bool echo)
{
- VCChardev *drv = VC_CHARDEV(chr);
+ VCChardev *drv = CHARDEV_VC(chr);
QemuConsole *s = drv->console;
s->echo = echo;
@@ -2148,7 +2148,7 @@ static const GraphicHwOps text_console_ops = {
static void text_console_do_init(Chardev *chr, DisplayState *ds)
{
- VCChardev *drv = VC_CHARDEV(chr);
+ VCChardev *drv = CHARDEV_VC(chr);
QemuConsole *s = drv->console;
int g_width = 80 * FONT_WIDTH;
int g_height = 24 * FONT_HEIGHT;
@@ -2205,7 +2205,7 @@ static void vc_chr_open(Chardev *chr,
Error **errp)
{
ChardevVC *vc = backend->u.vc.data;
- VCChardev *drv = VC_CHARDEV(chr);
+ VCChardev *drv = CHARDEV_VC(chr);
QemuConsole *s;
unsigned width = 0;
unsigned height = 0;
diff --git a/ui/gtk.c b/ui/gtk.c
index 1c59de2af4..30c607a412 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -179,7 +179,7 @@ struct VCChardev {
typedef struct VCChardev VCChardev;
#define TYPE_CHARDEV_VC "chardev-vc"
-DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV,
+DECLARE_INSTANCE_CHECKER(VCChardev, CHARDEV_VC,
TYPE_CHARDEV_VC)
bool gtk_use_gl_area;
@@ -1693,7 +1693,7 @@ static void gd_vc_adjustment_changed(GtkAdjustment *adjustment, void *opaque)
static int gd_vc_chr_write(Chardev *chr, const uint8_t *buf, int len)
{
- VCChardev *vcd = VC_CHARDEV(chr);
+ VCChardev *vcd = CHARDEV_VC(chr);
VirtualConsole *vc = vcd->console;
vte_terminal_feed(VTE_TERMINAL(vc->vte.terminal), (const char *)buf, len);
@@ -1702,7 +1702,7 @@ static int gd_vc_chr_write(Chardev *chr, const uint8_t *buf, int len)
static void gd_vc_chr_set_echo(Chardev *chr, bool echo)
{
- VCChardev *vcd = VC_CHARDEV(chr);
+ VCChardev *vcd = CHARDEV_VC(chr);
VirtualConsole *vc = vcd->console;
if (vc) {
@@ -1784,7 +1784,7 @@ static GSList *gd_vc_vte_init(GtkDisplayState *s, VirtualConsole *vc,
GtkWidget *box;
GtkWidget *scrollbar;
GtkAdjustment *vadjustment;
- VCChardev *vcd = VC_CHARDEV(chr);
+ VCChardev *vcd = CHARDEV_VC(chr);
vc->s = s;
vc->vte.echo = vcd->echo;
diff --git a/ui/spice-app.c b/ui/spice-app.c
index 93e105c6ee..e66c422e02 100644
--- a/ui/spice-app.c
+++ b/ui/spice-app.c
@@ -47,7 +47,7 @@ struct VCChardev {
typedef struct VCChardev VCChardev;
#define TYPE_CHARDEV_VC "chardev-vc"
-DECLARE_INSTANCE_CHECKER(VCChardev, VC_CHARDEV,
+DECLARE_INSTANCE_CHECKER(VCChardev, CHARDEV_VC,
TYPE_CHARDEV_VC)
static ChardevBackend *
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 16/18] chardev: Rename WCTABLET_CHARDEV to CHARDEV_WCTABLET
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (14 preceding siblings ...)
2020-09-10 19:49 ` [PATCH 15/18] chardev: Rename VC_CHARDEV to CHARDEV_VC Eduardo Habkost
@ 2020-09-10 19:49 ` Eduardo Habkost
2020-09-10 19:49 ` [PATCH 17/18] chardev: Rename WIN_CHARDEV to CHARDEV_WIN Eduardo Habkost
` (2 subsequent siblings)
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:49 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/wctablet.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/chardev/wctablet.c b/chardev/wctablet.c
index 95e005f5a5..c5b0be0451 100644
--- a/chardev/wctablet.c
+++ b/chardev/wctablet.c
@@ -86,7 +86,7 @@ struct TabletChardev {
typedef struct TabletChardev TabletChardev;
#define TYPE_CHARDEV_WCTABLET "chardev-wctablet"
-DECLARE_INSTANCE_CHECKER(TabletChardev, WCTABLET_CHARDEV,
+DECLARE_INSTANCE_CHECKER(TabletChardev, CHARDEV_WCTABLET,
TYPE_CHARDEV_WCTABLET)
@@ -187,7 +187,7 @@ static QemuInputHandler wctablet_handler = {
static void wctablet_chr_accept_input(Chardev *chr)
{
- TabletChardev *tablet = WCTABLET_CHARDEV(chr);
+ TabletChardev *tablet = CHARDEV_WCTABLET(chr);
int len, canWrite;
canWrite = qemu_chr_be_can_write(chr);
@@ -208,7 +208,7 @@ static void wctablet_chr_accept_input(Chardev *chr)
static int wctablet_chr_write(struct Chardev *chr,
const uint8_t *buf, int len)
{
- TabletChardev *tablet = WCTABLET_CHARDEV(chr);
+ TabletChardev *tablet = CHARDEV_WCTABLET(chr);
unsigned int i, clen;
char *pos;
@@ -297,7 +297,7 @@ static int wctablet_chr_write(struct Chardev *chr,
static int wctablet_chr_ioctl(Chardev *chr, int cmd, void *arg)
{
- TabletChardev *tablet = WCTABLET_CHARDEV(chr);
+ TabletChardev *tablet = CHARDEV_WCTABLET(chr);
QEMUSerialSetParams *ssp;
switch (cmd) {
@@ -317,7 +317,7 @@ static int wctablet_chr_ioctl(Chardev *chr, int cmd, void *arg)
static void wctablet_chr_finalize(Object *obj)
{
- TabletChardev *tablet = WCTABLET_CHARDEV(obj);
+ TabletChardev *tablet = CHARDEV_WCTABLET(obj);
qemu_input_handler_unregister(tablet->hs);
g_free(tablet);
@@ -328,7 +328,7 @@ static void wctablet_chr_open(Chardev *chr,
bool *be_opened,
Error **errp)
{
- TabletChardev *tablet = WCTABLET_CHARDEV(chr);
+ TabletChardev *tablet = CHARDEV_WCTABLET(chr);
*be_opened = true;
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 17/18] chardev: Rename WIN_CHARDEV to CHARDEV_WIN
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (15 preceding siblings ...)
2020-09-10 19:49 ` [PATCH 16/18] chardev: Rename WCTABLET_CHARDEV to CHARDEV_WCTABLET Eduardo Habkost
@ 2020-09-10 19:49 ` Eduardo Habkost
2020-09-10 19:49 ` [PATCH 18/18] chardev: Rename WIN_STDIO_CHARDEV to CHARDEV_WIN_STDIO Eduardo Habkost
2020-09-11 8:07 ` [PATCH 00/18] chardev: QOM cleanups Marc-André Lureau
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:49 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
include/chardev/char-win.h | 2 +-
chardev/char-pipe.c | 2 +-
chardev/char-win.c | 14 +++++++-------
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/chardev/char-win.h b/include/chardev/char-win.h
index 485521469c..0e718d60c4 100644
--- a/include/chardev/char-win.h
+++ b/include/chardev/char-win.h
@@ -44,7 +44,7 @@ typedef struct WinChardev WinChardev;
#define NRECVBUF 2048
#define TYPE_CHARDEV_WIN "chardev-win"
-DECLARE_INSTANCE_CHECKER(WinChardev, WIN_CHARDEV,
+DECLARE_INSTANCE_CHECKER(WinChardev, CHARDEV_WIN,
TYPE_CHARDEV_WIN)
void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open);
diff --git a/chardev/char-pipe.c b/chardev/char-pipe.c
index fd12c9e63b..96854cfe99 100644
--- a/chardev/char-pipe.c
+++ b/chardev/char-pipe.c
@@ -43,7 +43,7 @@
static int win_chr_pipe_init(Chardev *chr, const char *filename,
Error **errp)
{
- WinChardev *s = WIN_CHARDEV(chr);
+ WinChardev *s = CHARDEV_WIN(chr);
OVERLAPPED ov;
int ret;
DWORD size;
diff --git a/chardev/char-win.c b/chardev/char-win.c
index d4fb44c4dc..39cfd12177 100644
--- a/chardev/char-win.c
+++ b/chardev/char-win.c
@@ -30,7 +30,7 @@
static void win_chr_read(Chardev *chr, DWORD len)
{
- WinChardev *s = WIN_CHARDEV(chr);
+ WinChardev *s = CHARDEV_WIN(chr);
int max_size = qemu_chr_be_can_write(chr);
int ret, err;
uint8_t buf[CHR_READ_BUF_LEN];
@@ -61,7 +61,7 @@ static void win_chr_read(Chardev *chr, DWORD len)
static int win_chr_serial_poll(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- WinChardev *s = WIN_CHARDEV(opaque);
+ WinChardev *s = CHARDEV_WIN(opaque);
COMSTAT status;
DWORD comerr;
@@ -75,7 +75,7 @@ static int win_chr_serial_poll(void *opaque)
int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp)
{
- WinChardev *s = WIN_CHARDEV(chr);
+ WinChardev *s = CHARDEV_WIN(chr);
COMMCONFIG comcfg;
COMMTIMEOUTS cto = { 0, 0, 0, 0, 0};
COMSTAT comstat;
@@ -142,7 +142,7 @@ int win_chr_serial_init(Chardev *chr, const char *filename, Error **errp)
int win_chr_pipe_poll(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- WinChardev *s = WIN_CHARDEV(opaque);
+ WinChardev *s = CHARDEV_WIN(opaque);
DWORD size;
PeekNamedPipe(s->file, NULL, 0, NULL, &size, NULL);
@@ -156,7 +156,7 @@ int win_chr_pipe_poll(void *opaque)
/* Called with chr_write_lock held. */
static int win_chr_write(Chardev *chr, const uint8_t *buf, int len1)
{
- WinChardev *s = WIN_CHARDEV(chr);
+ WinChardev *s = CHARDEV_WIN(chr);
DWORD len, ret, size, err;
len = len1;
@@ -192,7 +192,7 @@ static int win_chr_write(Chardev *chr, const uint8_t *buf, int len1)
static void char_win_finalize(Object *obj)
{
Chardev *chr = CHARDEV(obj);
- WinChardev *s = WIN_CHARDEV(chr);
+ WinChardev *s = CHARDEV_WIN(chr);
if (s->hsend) {
CloseHandle(s->hsend);
@@ -214,7 +214,7 @@ static void char_win_finalize(Object *obj)
void win_chr_set_file(Chardev *chr, HANDLE file, bool keep_open)
{
- WinChardev *s = WIN_CHARDEV(chr);
+ WinChardev *s = CHARDEV_WIN(chr);
s->keep_open = keep_open;
s->file = file;
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* [PATCH 18/18] chardev: Rename WIN_STDIO_CHARDEV to CHARDEV_WIN_STDIO
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (16 preceding siblings ...)
2020-09-10 19:49 ` [PATCH 17/18] chardev: Rename WIN_CHARDEV to CHARDEV_WIN Eduardo Habkost
@ 2020-09-10 19:49 ` Eduardo Habkost
2020-09-11 8:07 ` [PATCH 00/18] chardev: QOM cleanups Marc-André Lureau
18 siblings, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-10 19:49 UTC (permalink / raw)
To: qemu-devel
Cc: Daniel P. Berrange, Paolo Bonzini, Gerd Hoffmann,
Samuel Thibault, Marc-André Lureau,
Philippe Mathieu-Daudé
Rename instance and class type checkers to match the
TYPE_CHARDEV_* constant names and the QOM type name strings
("chardev-*").
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
chardev/char-win-stdio.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/chardev/char-win-stdio.c b/chardev/char-win-stdio.c
index a4771ab82e..46f715afb1 100644
--- a/chardev/char-win-stdio.c
+++ b/chardev/char-win-stdio.c
@@ -40,13 +40,13 @@ struct WinStdioChardev {
};
typedef struct WinStdioChardev WinStdioChardev;
-DECLARE_INSTANCE_CHECKER(WinStdioChardev, WIN_STDIO_CHARDEV,
+DECLARE_INSTANCE_CHECKER(WinStdioChardev, CHARDEV_WIN_STDIO,
TYPE_CHARDEV_WIN_STDIO)
static void win_stdio_wait_func(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- WinStdioChardev *stdio = WIN_STDIO_CHARDEV(opaque);
+ WinStdioChardev *stdio = CHARDEV_WIN_STDIO(opaque);
INPUT_RECORD buf[4];
int ret;
DWORD dwSize;
@@ -79,7 +79,7 @@ static void win_stdio_wait_func(void *opaque)
static DWORD WINAPI win_stdio_thread(LPVOID param)
{
- WinStdioChardev *stdio = WIN_STDIO_CHARDEV(param);
+ WinStdioChardev *stdio = CHARDEV_WIN_STDIO(param);
int ret;
DWORD dwSize;
@@ -118,7 +118,7 @@ static DWORD WINAPI win_stdio_thread(LPVOID param)
static void win_stdio_thread_wait_func(void *opaque)
{
Chardev *chr = CHARDEV(opaque);
- WinStdioChardev *stdio = WIN_STDIO_CHARDEV(opaque);
+ WinStdioChardev *stdio = CHARDEV_WIN_STDIO(opaque);
if (qemu_chr_be_can_write(chr)) {
qemu_chr_be_write(chr, &stdio->win_stdio_buf, 1);
@@ -129,7 +129,7 @@ static void win_stdio_thread_wait_func(void *opaque)
static void qemu_chr_set_echo_win_stdio(Chardev *chr, bool echo)
{
- WinStdioChardev *stdio = WIN_STDIO_CHARDEV(chr);
+ WinStdioChardev *stdio = CHARDEV_WIN_STDIO(chr);
DWORD dwMode = 0;
GetConsoleMode(stdio->hStdIn, &dwMode);
@@ -146,7 +146,7 @@ static void qemu_chr_open_stdio(Chardev *chr,
bool *be_opened,
Error **errp)
{
- WinStdioChardev *stdio = WIN_STDIO_CHARDEV(chr);
+ WinStdioChardev *stdio = CHARDEV_WIN_STDIO(chr);
DWORD dwMode;
int is_console = 0;
@@ -213,7 +213,7 @@ err1:
static void char_win_stdio_finalize(Object *obj)
{
- WinStdioChardev *stdio = WIN_STDIO_CHARDEV(obj);
+ WinStdioChardev *stdio = CHARDEV_WIN_STDIO(obj);
if (stdio->hInputReadyEvent != INVALID_HANDLE_VALUE) {
CloseHandle(stdio->hInputReadyEvent);
--
2.26.2
^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH 00/18] chardev: QOM cleanups
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
` (17 preceding siblings ...)
2020-09-10 19:49 ` [PATCH 18/18] chardev: Rename WIN_STDIO_CHARDEV to CHARDEV_WIN_STDIO Eduardo Habkost
@ 2020-09-11 8:07 ` Marc-André Lureau
2020-09-11 8:10 ` Daniel P. Berrangé
18 siblings, 1 reply; 24+ messages in thread
From: Marc-André Lureau @ 2020-09-11 8:07 UTC (permalink / raw)
To: Eduardo Habkost
Cc: Daniel P. Berrange, QEMU, Gerd Hoffmann, Samuel Thibault,
Paolo Bonzini, Philippe Mathieu-Daudé
[-- Attachment #1: Type: text/plain, Size: 3201 bytes --]
Hi
On Thu, Sep 10, 2020 at 11:50 PM Eduardo Habkost <ehabkost@redhat.com>
wrote:
> Some chardev QOM cleanup patches had to be dropped from my queue
> due to build erros introduced by code movements across ifdef
> boundaries at char-parallel.c. This series redo the changes from
> those patches, but the macro renames are now a little different:
>
> In this version I have decided to rename the type checking macros
> from *_CHARDEV to CHARDEV_* instead of renaming tye
> TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the
> identifiers actually match the QOM type name strings
> ("chardev-*").
>
Sounds reasonable to me, but it loses the matching with the
structure/object type name though.
- MuxChardev *d = MUX_CHARDEV(s);
+ MuxChardev *d = CHARDEV_MUX(s);
I have a preference for the first. Unless we rename all the chardev types
too...
Imho, the QOM type name is mostly an internal detail, the C type name is
dominant in the code.
> Eduardo Habkost (18):
> chardev: Move PARALLEL_CHARDEV macro to common code
> chardev: Move ParallelChardev typedef to common code
> chardev: Use DECLARE_INSTANCE_CHECKER macro for PARALLEL_CHARDEV
> chardev: Rename MOUSE_CHARDEV to CHARDEV_MSMOUSE
> chardev: Rename BAUM_CHARDEV to CHARDEV_BRAILLE
> chardev: Rename FD_CHARDEV to CHARDEV_FD
> chardev: Rename MUX_CHARDEV to CHARDEV_MUX
> chardev: Rename PARALLEL_CHARDEV to CHARDEV_PARALLEL
> chardev: Rename PTY_CHARDEV to CHARDEV_PTY
> chardev: Rename RINGBUF_CHARDEV to CHARDEV_RINGBUF
> chardev: Rename SOCKET_CHARDEV to CHARDEV_SOCKET
> chardev: Rename SPICE_CHARDEV to CHARDEV_SPICE
> chardev: Rename TESTDEV_CHARDEV to CHARDEV_TESTDEV
> chardev: Rename UDP_CHARDEV to CHARDEV_UDP
> chardev: Rename VC_CHARDEV to CHARDEV_VC
> chardev: Rename WCTABLET_CHARDEV to CHARDEV_WCTABLET
> chardev: Rename WIN_CHARDEV to CHARDEV_WIN
> chardev: Rename WIN_STDIO_CHARDEV to CHARDEV_WIN_STDIO
>
> chardev/chardev-internal.h | 2 +-
> include/chardev/char-fd.h | 2 +-
> include/chardev/char-win.h | 2 +-
> include/chardev/spice.h | 2 +-
> chardev/baum.c | 14 ++++----
> chardev/char-fd.c | 14 ++++----
> chardev/char-fe.c | 4 +--
> chardev/char-mux.c | 22 ++++++------
> chardev/char-parallel.c | 28 ++++++++--------
> chardev/char-pipe.c | 2 +-
> chardev/char-pty.c | 22 ++++++------
> chardev/char-ringbuf.c | 12 +++----
> chardev/char-serial.c | 2 +-
> chardev/char-socket.c | 68 +++++++++++++++++++-------------------
> chardev/char-udp.c | 14 ++++----
> chardev/char-win-stdio.c | 14 ++++----
> chardev/char-win.c | 14 ++++----
> chardev/char.c | 2 +-
> chardev/msmouse.c | 12 +++----
> chardev/spice.c | 16 ++++-----
> chardev/testdev.c | 4 +--
> chardev/wctablet.c | 12 +++----
> ui/console.c | 10 +++---
> ui/gtk.c | 8 ++---
> ui/spice-app.c | 2 +-
> 25 files changed, 151 insertions(+), 153 deletions(-)
>
> --
> 2.26.2
>
>
>
>
--
Marc-André Lureau
[-- Attachment #2: Type: text/html, Size: 4221 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 00/18] chardev: QOM cleanups
2020-09-11 8:07 ` [PATCH 00/18] chardev: QOM cleanups Marc-André Lureau
@ 2020-09-11 8:10 ` Daniel P. Berrangé
2020-09-11 8:19 ` Marc-André Lureau
2020-09-11 13:50 ` Eduardo Habkost
0 siblings, 2 replies; 24+ messages in thread
From: Daniel P. Berrangé @ 2020-09-11 8:10 UTC (permalink / raw)
To: Marc-André Lureau
Cc: Eduardo Habkost, QEMU, Gerd Hoffmann, Samuel Thibault,
Paolo Bonzini, Philippe Mathieu-Daudé
On Fri, Sep 11, 2020 at 12:07:27PM +0400, Marc-André Lureau wrote:
> Hi
>
> On Thu, Sep 10, 2020 at 11:50 PM Eduardo Habkost <ehabkost@redhat.com>
> wrote:
>
> > Some chardev QOM cleanup patches had to be dropped from my queue
> > due to build erros introduced by code movements across ifdef
> > boundaries at char-parallel.c. This series redo the changes from
> > those patches, but the macro renames are now a little different:
> >
> > In this version I have decided to rename the type checking macros
> > from *_CHARDEV to CHARDEV_* instead of renaming tye
> > TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the
> > identifiers actually match the QOM type name strings
> > ("chardev-*").
> >
>
> Sounds reasonable to me, but it loses the matching with the
> structure/object type name though.
>
> - MuxChardev *d = MUX_CHARDEV(s);
> + MuxChardev *d = CHARDEV_MUX(s);
>
> I have a preference for the first. Unless we rename all the chardev types
> too...
I tend to think the structs should be renamed too - I've always considerd
them to be backwards.
> Imho, the QOM type name is mostly an internal detail, the C type name is
> dominant in the code.
Err it is the reverse. The QOM type name is exposed public API via QOM
commands, while the C struct names are a internal private detail.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 00/18] chardev: QOM cleanups
2020-09-11 8:10 ` Daniel P. Berrangé
@ 2020-09-11 8:19 ` Marc-André Lureau
2020-09-11 8:32 ` Daniel P. Berrangé
2020-09-11 13:50 ` Eduardo Habkost
1 sibling, 1 reply; 24+ messages in thread
From: Marc-André Lureau @ 2020-09-11 8:19 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: Eduardo Habkost, QEMU, Gerd Hoffmann, Samuel Thibault,
Paolo Bonzini, Philippe Mathieu-Daudé
[-- Attachment #1: Type: text/plain, Size: 1638 bytes --]
Hi
On Fri, Sep 11, 2020 at 12:10 PM Daniel P. Berrangé <berrange@redhat.com>
wrote:
> On Fri, Sep 11, 2020 at 12:07:27PM +0400, Marc-André Lureau wrote:
> > Hi
> >
> > On Thu, Sep 10, 2020 at 11:50 PM Eduardo Habkost <ehabkost@redhat.com>
> > wrote:
> >
> > > Some chardev QOM cleanup patches had to be dropped from my queue
> > > due to build erros introduced by code movements across ifdef
> > > boundaries at char-parallel.c. This series redo the changes from
> > > those patches, but the macro renames are now a little different:
> > >
> > > In this version I have decided to rename the type checking macros
> > > from *_CHARDEV to CHARDEV_* instead of renaming tye
> > > TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the
> > > identifiers actually match the QOM type name strings
> > > ("chardev-*").
> > >
> >
> > Sounds reasonable to me, but it loses the matching with the
> > structure/object type name though.
> >
> > - MuxChardev *d = MUX_CHARDEV(s);
> > + MuxChardev *d = CHARDEV_MUX(s);
> >
> > I have a preference for the first. Unless we rename all the chardev types
> > too...
>
> I tend to think the structs should be renamed too - I've always considerd
> them to be backwards.
>
> > Imho, the QOM type name is mostly an internal detail, the C type name is
> > dominant in the code.
>
> Err it is the reverse. The QOM type name is exposed public API via QOM
> commands, while the C struct names are a internal private detail.
>
>
Yes, but without the chardev- prefix (unless you try object-add which I
don't think will work with chardev)
--
Marc-André Lureau
[-- Attachment #2: Type: text/html, Size: 2302 bytes --]
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 00/18] chardev: QOM cleanups
2020-09-11 8:19 ` Marc-André Lureau
@ 2020-09-11 8:32 ` Daniel P. Berrangé
0 siblings, 0 replies; 24+ messages in thread
From: Daniel P. Berrangé @ 2020-09-11 8:32 UTC (permalink / raw)
To: Marc-André Lureau
Cc: Eduardo Habkost, QEMU, Gerd Hoffmann, Paolo Bonzini,
Samuel Thibault, Philippe Mathieu-Daudé
On Fri, Sep 11, 2020 at 12:19:08PM +0400, Marc-André Lureau wrote:
> Hi
>
> On Fri, Sep 11, 2020 at 12:10 PM Daniel P. Berrangé <berrange@redhat.com>
> wrote:
>
> > On Fri, Sep 11, 2020 at 12:07:27PM +0400, Marc-André Lureau wrote:
> > > Hi
> > >
> > > On Thu, Sep 10, 2020 at 11:50 PM Eduardo Habkost <ehabkost@redhat.com>
> > > wrote:
> > >
> > > > Some chardev QOM cleanup patches had to be dropped from my queue
> > > > due to build erros introduced by code movements across ifdef
> > > > boundaries at char-parallel.c. This series redo the changes from
> > > > those patches, but the macro renames are now a little different:
> > > >
> > > > In this version I have decided to rename the type checking macros
> > > > from *_CHARDEV to CHARDEV_* instead of renaming tye
> > > > TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the
> > > > identifiers actually match the QOM type name strings
> > > > ("chardev-*").
> > > >
> > >
> > > Sounds reasonable to me, but it loses the matching with the
> > > structure/object type name though.
> > >
> > > - MuxChardev *d = MUX_CHARDEV(s);
> > > + MuxChardev *d = CHARDEV_MUX(s);
> > >
> > > I have a preference for the first. Unless we rename all the chardev types
> > > too...
> >
> > I tend to think the structs should be renamed too - I've always considerd
> > them to be backwards.
> >
> > > Imho, the QOM type name is mostly an internal detail, the C type name is
> > > dominant in the code.
> >
> > Err it is the reverse. The QOM type name is exposed public API via QOM
> > commands, while the C struct names are a internal private detail.
> >
>
> Yes, but without the chardev- prefix (unless you try object-add which I
> don't think will work with chardev)
Sure, that's just the way it had to be wired into the -chardev arg
syntax, but from the POV of exposed QOM type information the canonical
type name has the full chardev- prefix.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 00/18] chardev: QOM cleanups
2020-09-11 8:10 ` Daniel P. Berrangé
2020-09-11 8:19 ` Marc-André Lureau
@ 2020-09-11 13:50 ` Eduardo Habkost
1 sibling, 0 replies; 24+ messages in thread
From: Eduardo Habkost @ 2020-09-11 13:50 UTC (permalink / raw)
To: Daniel P. Berrangé
Cc: QEMU, Marc-André Lureau, Gerd Hoffmann, Samuel Thibault,
Paolo Bonzini, Philippe Mathieu-Daudé
On Fri, Sep 11, 2020 at 09:10:18AM +0100, Daniel P. Berrangé wrote:
> On Fri, Sep 11, 2020 at 12:07:27PM +0400, Marc-André Lureau wrote:
> > Hi
> >
> > On Thu, Sep 10, 2020 at 11:50 PM Eduardo Habkost <ehabkost@redhat.com>
> > wrote:
> >
> > > Some chardev QOM cleanup patches had to be dropped from my queue
> > > due to build erros introduced by code movements across ifdef
> > > boundaries at char-parallel.c. This series redo the changes from
> > > those patches, but the macro renames are now a little different:
> > >
> > > In this version I have decided to rename the type checking macros
> > > from *_CHARDEV to CHARDEV_* instead of renaming tye
> > > TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the
> > > identifiers actually match the QOM type name strings
> > > ("chardev-*").
> > >
> >
> > Sounds reasonable to me, but it loses the matching with the
> > structure/object type name though.
> >
> > - MuxChardev *d = MUX_CHARDEV(s);
> > + MuxChardev *d = CHARDEV_MUX(s);
> >
> > I have a preference for the first. Unless we rename all the chardev types
> > too...
>
> I tend to think the structs should be renamed too - I've always considerd
> them to be backwards.
FWIW, "MuxChardev" sounds better to me. Not a big deal, though.
(Also, I am not planning to touch any struct names for the sake
of the new QOM declaration/definition macros. Renaming the type
checking functions is enough churn.)
>
> > Imho, the QOM type name is mostly an internal detail, the C type name is
> > dominant in the code.
>
> Err it is the reverse. The QOM type name is exposed public API via QOM
> commands, while the C struct names are a internal private detail.
I agree with Marc-André here. The C code is not just a detail.
Code needs be easy to read, change and refactor. I'd really
prefer to not have the external public API forcing a specific
internal naming style.
We have at least one case where it's probably going to be
impossible to keep an exact match between the QOM type and type
checker functions: "accel"/ACCEL.
https://lore.kernel.org/qemu-devel/CAFEAcA9WEjne5TfwggVWPuBprkRs-a2-iNc43Xa_jBamaf9t8A@mail.gmail.com/
--
Eduardo
^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2020-09-11 13:51 UTC | newest]
Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-10 19:48 [PATCH 00/18] chardev: QOM cleanups Eduardo Habkost
2020-09-10 19:48 ` [PATCH 01/18] chardev: Move PARALLEL_CHARDEV macro to common code Eduardo Habkost
2020-09-10 19:48 ` [PATCH 02/18] chardev: Move ParallelChardev typedef " Eduardo Habkost
2020-09-10 19:48 ` [PATCH 03/18] chardev: Use DECLARE_INSTANCE_CHECKER macro for PARALLEL_CHARDEV Eduardo Habkost
2020-09-10 19:48 ` [PATCH 04/18] chardev: Rename MOUSE_CHARDEV to CHARDEV_MSMOUSE Eduardo Habkost
2020-09-10 19:48 ` [PATCH 05/18] chardev: Rename BAUM_CHARDEV to CHARDEV_BRAILLE Eduardo Habkost
2020-09-10 19:48 ` [PATCH 06/18] chardev: Rename FD_CHARDEV to CHARDEV_FD Eduardo Habkost
2020-09-10 19:48 ` [PATCH 07/18] chardev: Rename MUX_CHARDEV to CHARDEV_MUX Eduardo Habkost
2020-09-10 19:48 ` [PATCH 08/18] chardev: Rename PARALLEL_CHARDEV to CHARDEV_PARALLEL Eduardo Habkost
2020-09-10 19:48 ` [PATCH 09/18] chardev: Rename PTY_CHARDEV to CHARDEV_PTY Eduardo Habkost
2020-09-10 19:48 ` [PATCH 10/18] chardev: Rename RINGBUF_CHARDEV to CHARDEV_RINGBUF Eduardo Habkost
2020-09-10 19:48 ` [PATCH 11/18] chardev: Rename SOCKET_CHARDEV to CHARDEV_SOCKET Eduardo Habkost
2020-09-10 19:48 ` [PATCH 12/18] chardev: Rename SPICE_CHARDEV to CHARDEV_SPICE Eduardo Habkost
2020-09-10 19:48 ` [PATCH 13/18] chardev: Rename TESTDEV_CHARDEV to CHARDEV_TESTDEV Eduardo Habkost
2020-09-10 19:48 ` [PATCH 14/18] chardev: Rename UDP_CHARDEV to CHARDEV_UDP Eduardo Habkost
2020-09-10 19:49 ` [PATCH 15/18] chardev: Rename VC_CHARDEV to CHARDEV_VC Eduardo Habkost
2020-09-10 19:49 ` [PATCH 16/18] chardev: Rename WCTABLET_CHARDEV to CHARDEV_WCTABLET Eduardo Habkost
2020-09-10 19:49 ` [PATCH 17/18] chardev: Rename WIN_CHARDEV to CHARDEV_WIN Eduardo Habkost
2020-09-10 19:49 ` [PATCH 18/18] chardev: Rename WIN_STDIO_CHARDEV to CHARDEV_WIN_STDIO Eduardo Habkost
2020-09-11 8:07 ` [PATCH 00/18] chardev: QOM cleanups Marc-André Lureau
2020-09-11 8:10 ` Daniel P. Berrangé
2020-09-11 8:19 ` Marc-André Lureau
2020-09-11 8:32 ` Daniel P. Berrangé
2020-09-11 13:50 ` Eduardo Habkost
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.