char: rename and move to header CHR_READ_BUF_LEN
This define is used by several character devices, place it in char common header. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
parent
bf51f62869
commit
f612143a03
@ -87,7 +87,6 @@
|
|||||||
|
|
||||||
#include "char-mux.h"
|
#include "char-mux.h"
|
||||||
|
|
||||||
#define READ_BUF_LEN 4096
|
|
||||||
#define READ_RETRIES 10
|
#define READ_RETRIES 10
|
||||||
#define TCP_MAX_FDS 16
|
#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, ...)
|
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_list ap;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
vsnprintf(buf, sizeof(buf), fmt, ap);
|
vsnprintf(buf, sizeof(buf), fmt, ap);
|
||||||
@ -913,7 +912,7 @@ static gboolean fd_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
|
|||||||
Chardev *chr = CHARDEV(opaque);
|
Chardev *chr = CHARDEV(opaque);
|
||||||
FDChardev *s = FD_CHARDEV(opaque);
|
FDChardev *s = FD_CHARDEV(opaque);
|
||||||
int len;
|
int len;
|
||||||
uint8_t buf[READ_BUF_LEN];
|
uint8_t buf[CHR_READ_BUF_LEN];
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
len = sizeof(buf);
|
len = sizeof(buf);
|
||||||
@ -1265,7 +1264,7 @@ static gboolean pty_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
|
|||||||
Chardev *chr = CHARDEV(opaque);
|
Chardev *chr = CHARDEV(opaque);
|
||||||
PtyChardev *s = PTY_CHARDEV(opaque);
|
PtyChardev *s = PTY_CHARDEV(opaque);
|
||||||
gsize len;
|
gsize len;
|
||||||
uint8_t buf[READ_BUF_LEN];
|
uint8_t buf[CHR_READ_BUF_LEN];
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
len = sizeof(buf);
|
len = sizeof(buf);
|
||||||
@ -1952,7 +1951,7 @@ static void win_chr_readfile(Chardev *chr)
|
|||||||
WinChardev *s = WIN_CHARDEV(chr);
|
WinChardev *s = WIN_CHARDEV(chr);
|
||||||
|
|
||||||
int ret, err;
|
int ret, err;
|
||||||
uint8_t buf[READ_BUF_LEN];
|
uint8_t buf[CHR_READ_BUF_LEN];
|
||||||
DWORD size;
|
DWORD size;
|
||||||
|
|
||||||
ZeroMemory(&s->orecv, sizeof(s->orecv));
|
ZeroMemory(&s->orecv, sizeof(s->orecv));
|
||||||
@ -2354,7 +2353,7 @@ err1:
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
Chardev parent;
|
Chardev parent;
|
||||||
QIOChannel *ioc;
|
QIOChannel *ioc;
|
||||||
uint8_t buf[READ_BUF_LEN];
|
uint8_t buf[CHR_READ_BUF_LEN];
|
||||||
int bufcnt;
|
int bufcnt;
|
||||||
int bufptr;
|
int bufptr;
|
||||||
int max_size;
|
int max_size;
|
||||||
@ -2759,7 +2758,7 @@ static gboolean tcp_chr_read(QIOChannel *chan, GIOCondition cond, void *opaque)
|
|||||||
{
|
{
|
||||||
Chardev *chr = CHARDEV(opaque);
|
Chardev *chr = CHARDEV(opaque);
|
||||||
SocketChardev *s = SOCKET_CHARDEV(opaque);
|
SocketChardev *s = SOCKET_CHARDEV(opaque);
|
||||||
uint8_t buf[READ_BUF_LEN];
|
uint8_t buf[CHR_READ_BUF_LEN];
|
||||||
int len, size;
|
int len, size;
|
||||||
|
|
||||||
if (!s->connected || s->max_size <= 0) {
|
if (!s->connected || s->max_size <= 0) {
|
||||||
|
@ -22,6 +22,7 @@ typedef enum {
|
|||||||
CHR_EVENT_CLOSED /* connection closed */
|
CHR_EVENT_CLOSED /* connection closed */
|
||||||
} QEMUChrEvent;
|
} QEMUChrEvent;
|
||||||
|
|
||||||
|
#define CHR_READ_BUF_LEN 4096
|
||||||
|
|
||||||
#define CHR_IOCTL_SERIAL_SET_PARAMS 1
|
#define CHR_IOCTL_SERIAL_SET_PARAMS 1
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user