This define is used by several character devices, place it in char common header.
Signed-off-by: Marc-André Lureau <marcandre.lur...@redhat.com> --- chardev/char.c | 13 ++++++------- include/sysemu/char.h | 1 + 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chardev/char.c b/chardev/char.c index 94b42bbe01..1fdfa98954 100644 --- a/chardev/char.c +++ b/chardev/char.c @@ -87,7 +87,6 @@ #include "char-mux.h" -#define READ_BUF_LEN 4096 #define READ_RETRIES 10 #define TCP_MAX_FDS 16 @@ -471,7 +470,7 @@ void qemu_chr_fe_accept_input(CharBackend *be) void qemu_chr_fe_printf(CharBackend *be, const char *fmt, ...) { - char buf[READ_BUF_LEN]; + char buf[CHR_READ_BUF_LEN]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof(buf), fmt, ap); @@ -911,7 +910,7 @@ static gboolean fd_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque) Chardev *chr = CHARDEV(opaque); FDChardev *s = FD_CHARDEV(opaque); int len; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; ssize_t ret; len = sizeof(buf); @@ -1263,7 +1262,7 @@ static gboolean pty_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque) Chardev *chr = CHARDEV(opaque); PtyChardev *s = PTY_CHARDEV(opaque); gsize len; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; ssize_t ret; len = sizeof(buf); @@ -1953,7 +1952,7 @@ static void win_chr_readfile(Chardev *chr) WinChardev *s = WIN_CHARDEV(chr); int ret, err; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; DWORD size; ZeroMemory(&s->orecv, sizeof(s->orecv)); @@ -2355,7 +2354,7 @@ err1: typedef struct { Chardev parent; QIOChannel *ioc; - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; int bufcnt; int bufptr; int max_size; @@ -2760,7 +2759,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque) { Chardev *chr = CHARDEV(opaque); SocketChardev *s = SOCKET_CHARDEV(opaque); - uint8_t buf[READ_BUF_LEN]; + uint8_t buf[CHR_READ_BUF_LEN]; int len, size; if (!s->connected || s->max_size <= 0) { diff --git a/include/sysemu/char.h b/include/sysemu/char.h index dd91c4c03e..0b96b00d56 100644 --- a/include/sysemu/char.h +++ b/include/sysemu/char.h @@ -22,6 +22,7 @@ typedef enum { CHR_EVENT_CLOSED /* connection closed */ } QEMUChrEvent; +#define CHR_READ_BUF_LEN 4096 #define CHR_IOCTL_SERIAL_SET_PARAMS 1 typedef struct { -- 2.11.0