aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2016-10-22 12:53:02 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2016-10-24 15:46:10 +0200
commit72ac876248ca2d33b3e1170b2f86fb68daaacdc8 (patch)
treefeb7960f638c51d9d31280f145cd91580a684ad8
parenta4afa548fc6dd9842ed86639b4d37d4d1c4ad480 (diff)
char: rename chr_close/chr_free
The function is used to free the backend opaque pointer, let's name it accordingly. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20161022095318.17775-23-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--backends/baum.c4
-rw-r--r--backends/msmouse.c4
-rw-r--r--backends/testdev.c4
-rw-r--r--include/sysemu/char.h2
-rw-r--r--qemu-char.c58
-rw-r--r--spice-qemu-char.c4
6 files changed, 38 insertions, 38 deletions
diff --git a/backends/baum.c b/backends/baum.c
index c537141b22..a51643496e 100644
--- a/backends/baum.c
+++ b/backends/baum.c
@@ -551,7 +551,7 @@ static void baum_chr_read(void *opaque)
}
}
-static void baum_close(struct CharDriverState *chr)
+static void baum_free(struct CharDriverState *chr)
{
BaumDriverState *baum = chr->opaque;
@@ -589,7 +589,7 @@ static CharDriverState *chr_baum_init(const char *id,
chr->opaque = baum;
chr->chr_write = baum_write;
chr->chr_accept_input = baum_accept_input;
- chr->chr_close = baum_close;
+ chr->chr_free = baum_free;
handle = g_malloc0(brlapi_getHandleSize());
baum->brlapi = handle;
diff --git a/backends/msmouse.c b/backends/msmouse.c
index 85d08f753e..448369fd1c 100644
--- a/backends/msmouse.c
+++ b/backends/msmouse.c
@@ -133,7 +133,7 @@ static int msmouse_chr_write (struct CharDriverState *s, const uint8_t *buf, int
return len;
}
-static void msmouse_chr_close (struct CharDriverState *chr)
+static void msmouse_chr_free(struct CharDriverState *chr)
{
MouseState *mouse = chr->opaque;
@@ -162,7 +162,7 @@ static CharDriverState *qemu_chr_open_msmouse(const char *id,
return NULL;
}
chr->chr_write = msmouse_chr_write;
- chr->chr_close = msmouse_chr_close;
+ chr->chr_free = msmouse_chr_free;
chr->chr_accept_input = msmouse_chr_accept_input;
chr->explicit_be_open = true;
diff --git a/backends/testdev.c b/backends/testdev.c
index 3ab1c90c1c..1ba8bf25a1 100644
--- a/backends/testdev.c
+++ b/backends/testdev.c
@@ -102,7 +102,7 @@ static int testdev_write(CharDriverState *chr, const uint8_t *buf, int len)
return orig_len;
}
-static void testdev_close(struct CharDriverState *chr)
+static void testdev_free(struct CharDriverState *chr)
{
TestdevCharState *testdev = chr->opaque;
@@ -122,7 +122,7 @@ static CharDriverState *chr_testdev_init(const char *id,
chr->opaque = testdev;
chr->chr_write = testdev_write;
- chr->chr_close = testdev_close;
+ chr->chr_free = testdev_free;
return chr;
}
diff --git a/include/sysemu/char.h b/include/sysemu/char.h
index 7187c3ed29..d029d544fe 100644
--- a/include/sysemu/char.h
+++ b/include/sysemu/char.h
@@ -96,7 +96,7 @@ struct CharDriverState {
int (*set_msgfds)(struct CharDriverState *s, int *fds, int num);
int (*chr_add_client)(struct CharDriverState *chr, int fd);
int (*chr_wait_connected)(struct CharDriverState *chr, Error **errp);
- void (*chr_close)(struct CharDriverState *chr);
+ void (*chr_free)(struct CharDriverState *chr);
void (*chr_disconnect)(struct CharDriverState *chr);
void (*chr_accept_input)(struct CharDriverState *chr);
void (*chr_set_echo)(struct CharDriverState *chr, bool echo);
diff --git a/qemu-char.c b/qemu-char.c
index 9d106d1df0..af060ceb64 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -793,7 +793,7 @@ static GSource *mux_chr_add_watch(CharDriverState *s, GIOCondition cond)
return chr->chr_add_watch(chr, cond);
}
-static void mux_chr_close(struct CharDriverState *chr)
+static void mux_chr_free(struct CharDriverState *chr)
{
MuxDriver *d = chr->opaque;
int i;
@@ -871,7 +871,7 @@ static CharDriverState *qemu_chr_open_mux(const char *id,
chr->opaque = d;
d->focus = -1;
- chr->chr_close = mux_chr_close;
+ chr->chr_free = mux_chr_free;
chr->chr_write = mux_chr_write;
chr->chr_accept_input = mux_chr_accept_input;
/* Frontend guest-open / -close notification is not support with muxes */
@@ -1240,7 +1240,7 @@ static void fd_chr_update_read_handler(CharDriverState *chr,
}
}
-static void fd_chr_close(struct CharDriverState *chr)
+static void fd_chr_free(struct CharDriverState *chr)
{
FDCharDriver *s = chr->opaque;
@@ -1276,7 +1276,7 @@ static CharDriverState *qemu_chr_open_fd(int fd_in, int fd_out,
chr->chr_add_watch = fd_chr_add_watch;
chr->chr_write = fd_chr_write;
chr->chr_update_read_handler = fd_chr_update_read_handler;
- chr->chr_close = fd_chr_close;
+ chr->chr_free = fd_chr_free;
return chr;
}
@@ -1357,10 +1357,10 @@ static void qemu_chr_set_echo_stdio(CharDriverState *chr, bool echo)
tcsetattr (0, TCSANOW, &tty);
}
-static void qemu_chr_close_stdio(struct CharDriverState *chr)
+static void qemu_chr_free_stdio(struct CharDriverState *chr)
{
term_exit();
- fd_chr_close(chr);
+ fd_chr_free(chr);
}
static CharDriverState *qemu_chr_open_stdio(const char *id,
@@ -1397,7 +1397,7 @@ static CharDriverState *qemu_chr_open_stdio(const char *id,
if (!chr) {
return NULL;
}
- chr->chr_close = qemu_chr_close_stdio;
+ chr->chr_free = qemu_chr_free_stdio;
chr->chr_set_echo = qemu_chr_set_echo_stdio;
if (opts->has_signal) {
stdio_allow_signal = opts->signal;
@@ -1594,7 +1594,7 @@ static void pty_chr_state(CharDriverState *chr, int connected)
}
}
-static void pty_chr_close(struct CharDriverState *chr)
+static void pty_chr_free(struct CharDriverState *chr)
{
PtyCharDriver *s = chr->opaque;
@@ -1647,7 +1647,7 @@ static CharDriverState *qemu_chr_open_pty(const char *id,
chr->opaque = s;
chr->chr_write = pty_chr_write;
chr->chr_update_read_handler = pty_chr_update_read_handler;
- chr->chr_close = pty_chr_close;
+ chr->chr_free = pty_chr_free;
chr->chr_add_watch = pty_chr_add_watch;
chr->explicit_be_open = true;
@@ -1842,9 +1842,9 @@ static int tty_serial_ioctl(CharDriverState *chr, int cmd, void *arg)
return 0;
}
-static void qemu_chr_close_tty(CharDriverState *chr)
+static void qemu_chr_free_tty(CharDriverState *chr)
{
- fd_chr_close(chr);
+ fd_chr_free(chr);
}
static CharDriverState *qemu_chr_open_tty_fd(int fd,
@@ -1859,7 +1859,7 @@ static CharDriverState *qemu_chr_open_tty_fd(int fd,
return NULL;
}
chr->chr_ioctl = tty_serial_ioctl;
- chr->chr_close = qemu_chr_close_tty;
+ chr->chr_free = qemu_chr_free_tty;
return chr;
}
#endif /* __linux__ || __sun__ */
@@ -1965,7 +1965,7 @@ static int pp_ioctl(CharDriverState *chr, int cmd, void *arg)
return 0;
}
-static void pp_close(CharDriverState *chr)
+static void pp_free(CharDriverState *chr)
{
ParallelCharDriver *drv = chr->opaque;
int fd = drv->fd;
@@ -1999,7 +1999,7 @@ static CharDriverState *qemu_chr_open_pp_fd(int fd,
chr->opaque = drv;
chr->chr_write = null_chr_write;
chr->chr_ioctl = pp_ioctl;
- chr->chr_close = pp_close;
+ chr->chr_free = pp_free;
drv->fd = fd;
drv->mode = IEEE1284_MODE_COMPAT;
@@ -2098,7 +2098,7 @@ typedef struct {
static int win_chr_poll(void *opaque);
static int win_chr_pipe_poll(void *opaque);
-static void win_chr_close(CharDriverState *chr)
+static void win_chr_free(CharDriverState *chr)
{
WinCharState *s = chr->opaque;
@@ -2185,7 +2185,7 @@ static int win_chr_init(CharDriverState *chr, const char *filename, Error **errp
return 0;
fail:
- win_chr_close(chr);
+ win_chr_free(chr);
return -1;
}
@@ -2297,7 +2297,7 @@ static CharDriverState *qemu_chr_open_win_path(const char *filename,
s = g_new0(WinCharState, 1);
chr->opaque = s;
chr->chr_write = win_chr_write;
- chr->chr_close = win_chr_close;
+ chr->chr_free = win_chr_free;
if (win_chr_init(chr, filename, errp) < 0) {
g_free(s);
@@ -2383,7 +2383,7 @@ static int win_chr_pipe_init(CharDriverState *chr, const char *filename,
return 0;
fail:
- win_chr_close(chr);
+ win_chr_free(chr);
return -1;
}
@@ -2406,7 +2406,7 @@ static CharDriverState *qemu_chr_open_pipe(const char *id,
s = g_new0(WinCharState, 1);
chr->opaque = s;
chr->chr_write = win_chr_write;
- chr->chr_close = win_chr_close;
+ chr->chr_free = win_chr_free;
if (win_chr_pipe_init(chr, filename, errp) < 0) {
g_free(s);
@@ -2562,7 +2562,7 @@ static void qemu_chr_set_echo_win_stdio(CharDriverState *chr, bool echo)
}
}
-static void win_stdio_close(CharDriverState *chr)
+static void win_stdio_free(CharDriverState *chr)
{
WinStdioCharState *stdio = chr->opaque;
@@ -2606,7 +2606,7 @@ static CharDriverState *qemu_chr_open_stdio(const char *id,
chr->opaque = stdio;
chr->chr_write = win_stdio_write;
- chr->chr_close = win_stdio_close;
+ chr->chr_free = win_stdio_free;
if (is_console) {
if (qemu_add_wait_object(stdio->hStdIn,
@@ -2743,7 +2743,7 @@ static void udp_chr_update_read_handler(CharDriverState *chr,
}
}
-static void udp_chr_close(CharDriverState *chr)
+static void udp_chr_free(CharDriverState *chr)
{
NetCharDriver *s = chr->opaque;
@@ -2774,7 +2774,7 @@ static CharDriverState *qemu_chr_open_udp(QIOChannelSocket *sioc,
chr->opaque = s;
chr->chr_write = udp_chr_write;
chr->chr_update_read_handler = udp_chr_update_read_handler;
- chr->chr_close = udp_chr_close;
+ chr->chr_free = udp_chr_free;
/* be isn't opened until we get a connection */
chr->explicit_be_open = true;
return chr;
@@ -3401,7 +3401,7 @@ int qemu_chr_fe_wait_connected(CharBackend *be, Error **errp)
return qemu_chr_wait_connected(be->chr, errp);
}
-static void tcp_chr_close(CharDriverState *chr)
+static void tcp_chr_free(CharDriverState *chr)
{
TCPCharDriver *s = chr->opaque;
@@ -3496,7 +3496,7 @@ static int ringbuf_chr_read(CharDriverState *chr, uint8_t *buf, int len)
return i;
}
-static void ringbuf_chr_close(struct CharDriverState *chr)
+static void ringbuf_chr_free(struct CharDriverState *chr)
{
RingBufCharDriver *d = chr->opaque;
@@ -3535,7 +3535,7 @@ static CharDriverState *qemu_chr_open_ringbuf(const char *id,
chr->opaque = d;
chr->chr_write = ringbuf_chr_write;
- chr->chr_close = ringbuf_chr_close;
+ chr->chr_free = ringbuf_chr_free;
return chr;
@@ -4281,8 +4281,8 @@ static void qemu_chr_free_common(CharDriverState *chr)
void qemu_chr_free(CharDriverState *chr)
{
- if (chr->chr_close) {
- chr->chr_close(chr);
+ if (chr->chr_free) {
+ chr->chr_free(chr);
}
qemu_chr_free_common(chr);
}
@@ -4661,7 +4661,7 @@ static CharDriverState *qmp_chardev_open_socket(const char *id,
chr->chr_wait_connected = tcp_chr_wait_connected;
chr->chr_write = tcp_chr_write;
chr->chr_sync_read = tcp_chr_sync_read;
- chr->chr_close = tcp_chr_close;
+ chr->chr_free = tcp_chr_free;
chr->chr_disconnect = tcp_chr_disconnect;
chr->get_msgfds = tcp_get_msgfds;
chr->set_msgfds = tcp_set_msgfds;
diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 351fcaa033..930b8c5b2d 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -199,7 +199,7 @@ static int spice_chr_write(CharDriverState *chr, const uint8_t *buf, int len)
return read_bytes;
}
-static void spice_chr_close(struct CharDriverState *chr)
+static void spice_chr_free(struct CharDriverState *chr)
{
SpiceCharDriver *s = chr->opaque;
@@ -289,7 +289,7 @@ static CharDriverState *chr_open(const char *subtype,
chr->opaque = s;
chr->chr_write = spice_chr_write;
chr->chr_add_watch = spice_chr_add_watch;
- chr->chr_close = spice_chr_close;
+ chr->chr_free = spice_chr_free;
chr->chr_set_fe_open = set_fe_open;
chr->explicit_be_open = true;
chr->chr_fe_event = spice_chr_fe_event;