chardev: QOM cleanups
cover chardev: QOM cleanups
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(-)
Signature · 1 line
2.26.2
PATCH 1/18 chardev: Move PARALLEL_CHARDEV macro to common code
The macro is exactly the same for both Linux and BSD, so move its definition outside the host OS #ifdef blocks.
--- chardev/char-parallel.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
chardev/char-parallel.c +3 -6
@@ -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);
Signature · 1 line
2.26.2
PATCH 2/18 chardev: Move ParallelChardev typedef to common code
In reply to Eduardo HabkostThe struct itself may have a different definition on each OS, but we can define the typedef in common code, outside the host OS #ifdefs.
--- chardev/char-parallel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
chardev/char-parallel.c +5 -4
@@ -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) {
Signature · 1 line
2.26.2
PATCH 3/18 chardev: Use DECLARE_INSTANCE_CHECKER macro for PARALLEL_CHARDEV
In reply to Eduardo HabkostUse DECLARE_INSTANCE_CHECKER instead of manually defining the instance type checking macro.
--- chardev/char-parallel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
chardev/char-parallel.c +2 -2
@@ -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__)
Signature · 1 line
2.26.2
PATCH 4/18 chardev: Rename MOUSE_CHARDEV to CHARDEV_MSMOUSE
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_MSMOUSE constant name and the QOM type name string ("chardev-msmouse").
--- chardev/msmouse.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
chardev/msmouse.c +6 -6
@@ -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,
Signature · 1 line
2.26.2
PATCH 5/18 chardev: Rename BAUM_CHARDEV to CHARDEV_BRAILLE
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_BRAILLE constant name and the QOM type name string ("chardev-braille").
--- chardev/baum.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
chardev/baum.c +7 -7
@@ -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 ());
Signature · 1 line
2.26.2
PATCH 6/18 chardev: Rename FD_CHARDEV to CHARDEV_FD
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- include/chardev/char-fd.h | 2 +- chardev/char-fd.c | 14 +++++++------- chardev/char-serial.c | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-)
include/chardev/char-fd.h +1 -1
@@ -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);
chardev/char-fd.c +7 -7
@@ -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));
chardev/char-serial.c +1 -1
@@ -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) {
Signature · 1 line
2.26.2
PATCH 7/18 chardev: Rename MUX_CHARDEV to CHARDEV_MUX
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- 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(-)
chardev/chardev-internal.h +1 -1
@@ -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)
chardev/char-fe.c +2 -2
@@ -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) {
chardev/char-mux.c +11 -11
@@ -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 ) {
chardev/char.c +1 -1
@@ -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 ;
Signature · 1 line
2.26.2
PATCH 8/18 chardev: Rename PARALLEL_CHARDEV to CHARDEV_PARALLEL
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/char-parallel.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
chardev/char-parallel.c +6 -6
@@ -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 );
Signature · 1 line
2.26.2
PATCH 9/18 chardev: Rename PTY_CHARDEV to CHARDEV_PTY
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/char-pty.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
chardev/char-pty.c +11 -11
@@ -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);
Signature · 1 line
2.26.2
PATCH 10/18 chardev: Rename RINGBUF_CHARDEV to CHARDEV_RINGBUF
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/char-ringbuf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
chardev/char-ringbuf.c +6 -6
@@ -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 ;
Signature · 1 line
2.26.2
PATCH 11/18 chardev: Rename SOCKET_CHARDEV to CHARDEV_SOCKET
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/char-socket.c | 68 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 34 deletions(-)
chardev/char-socket.c +34 -34
@@ -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 ; }
Signature · 1 line
2.26.2
PATCH 12/18 chardev: Rename SPICE_CHARDEV to CHARDEV_SPICE
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- include/chardev/spice.h | 2 +- chardev/spice.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
include/chardev/spice.h +1 -1
@@ -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,
chardev/spice.c +8 -8
@@ -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) {
Signature · 1 line
2.26.2
PATCH 13/18 chardev: Rename TESTDEV_CHARDEV to CHARDEV_TESTDEV
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/testdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
chardev/testdev.c +2 -2
@@ -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) {
Signature · 1 line
2.26.2
PATCH 14/18 chardev: Rename UDP_CHARDEV to CHARDEV_UDP
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/char-udp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
chardev/char-udp.c +7 -7
@@ -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);
Signature · 1 line
2.26.2
PATCH 15/18 chardev: Rename VC_CHARDEV to CHARDEV_VC
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- ui/console.c | 10 +++++----- ui/gtk.c | 8 ++++---- ui/spice-app.c | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-)
ui/console.c +5 -5
@@ -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 ;
ui/gtk.c +4 -4
@@ -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;
ui/spice-app.c +1 -1
@@ -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 *
Signature · 1 line
2.26.2
PATCH 16/18 chardev: Rename WCTABLET_CHARDEV to CHARDEV_WCTABLET
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/wctablet.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
chardev/wctablet.c +6 -6
@@ -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;
Signature · 1 line
2.26.2
PATCH 17/18 chardev: Rename WIN_CHARDEV to CHARDEV_WIN
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- include/chardev/char-win.h | 2 +- chardev/char-pipe.c | 2 +- chardev/char-win.c | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-)
include/chardev/char-win.h +1 -1
@@ -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);
chardev/char-pipe.c +1 -1
@@ -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;
chardev/char-win.c +7 -7
@@ -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;
Signature · 1 line
2.26.2
PATCH 18/18 chardev: Rename WIN_STDIO_CHARDEV to CHARDEV_WIN_STDIO
In reply to Eduardo HabkostRename instance and class type checkers to match the TYPE_CHARDEV_* constant names and the QOM type name strings ("chardev-*").
--- chardev/char-win-stdio.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
chardev/char-win-stdio.c +7 -7
@@ -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);
Signature · 1 line
2.26.2
Hi
Quoted 11 lines · Eduardo Habkost
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
*_CHARDEVto 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.
Quoted 53 lines
Eduardo Habkost (18):
chardev: MovePARALLEL_CHARDEVmacro to common code
chardev: Move ParallelChardev typedef to common code
chardev: UseDECLARE_INSTANCE_CHECKERmacro forPARALLEL_CHARDEV
chardev: RenameMOUSE_CHARDEVtoCHARDEV_MSMOUSE
chardev: RenameBAUM_CHARDEVtoCHARDEV_BRAILLE
chardev: RenameFD_CHARDEVtoCHARDEV_FD
chardev: RenameMUX_CHARDEVtoCHARDEV_MUX
chardev: RenamePARALLEL_CHARDEVtoCHARDEV_PARALLEL
chardev: RenamePTY_CHARDEVtoCHARDEV_PTY
chardev: RenameRINGBUF_CHARDEVtoCHARDEV_RINGBUF
chardev: RenameSOCKET_CHARDEVtoCHARDEV_SOCKET
chardev: RenameSPICE_CHARDEVtoCHARDEV_SPICE
chardev: RenameTESTDEV_CHARDEVtoCHARDEV_TESTDEV
chardev: RenameUDP_CHARDEVtoCHARDEV_UDP
chardev: RenameVC_CHARDEVtoCHARDEV_VC
chardev: RenameWCTABLET_CHARDEVtoCHARDEV_WCTABLET
chardev: RenameWIN_CHARDEVtoCHARDEV_WIN
chardev: RenameWIN_STDIO_CHARDEVtoCHARDEV_WIN_STDIOchardev/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
Signature · 1 line
Marc-André Lureau
Quoted 17 lines · Marc-André Lureau
Hi
Quoted 11 lines · Eduardo Habkost
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
*_CHARDEVto CHARDEV_* instead of renaming tye TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the identifiers actually match the QOM type name strings ("chardev-*").
Quoted 8 lines
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.
Quoted 2 lines
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
Signature · 3 lines
|: 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 :|
Hi
Quoted 27 lines · Daniel P. Berrangé
Quoted 17 lines · Marc-André Lureau
Hi
Quoted 11 lines · Eduardo Habkost
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
*_CHARDEVto CHARDEV_* instead of renaming tye TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the identifiers actually match the QOM type name strings ("chardev-*").Quoted 8 lines
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...
Quoted 10 lines
I tend to think the structs should be renamed too - I've always considerd them to be backwards.
Quoted 2 lines
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)
Signature · 1 line
Marc-André Lureau
Quoted 38 lines · Marc-André Lureau
Hi
Quoted 33 lines · Daniel P. Berrangé
Quoted 17 lines · Marc-André Lureau
Hi
Quoted 11 lines · Eduardo Habkost
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
*_CHARDEVto CHARDEV_* instead of renaming tye TYPE_CHARDEV_* constants to TYPE_*_CHARDEV, to make the identifiers actually match the QOM type name strings ("chardev-*").Quoted 8 lines
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.
Quoted 2 lines
Imho, the QOM type name is mostly an internal detail, the C type name is dominant in the code.
Quoted 6 lines
Quoted 3 lines
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
Signature · 3 lines
|: 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 :|
Quoted 21 lines · Daniel P. Berrangé
Quoted 20 lines · Marc-André Lureau
Hi
Quoted 11 lines · Eduardo Habkost
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
*_CHARDEVto 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.
Quoted 8 lines
Quoted 5 lines
- 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.)
Quoted 6 lines
Quoted 3 lines
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/
Signature · 1 line
Eduardo