diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-12-08 19:32:57 +0300 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2017-01-31 13:01:47 +0400 |
commit | 7f2fe073f3bbe4ecda7afd5a14c24736d19e921a (patch) | |
tree | 229568fe28d64e9b6c40826ddc8fc3805caebcaa /qemu-char.c | |
parent | 53a5736f949a47fa7d890baf8472824263682c92 (diff) |
char-fd: convert to finalize
char-serial inherits from char-fd finalizer.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qemu-char.c')
-rw-r--r-- | qemu-char.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/qemu-char.c b/qemu-char.c index 0cece8a34f..3d0d690999 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -1296,9 +1296,10 @@ static void fd_chr_update_read_handler(Chardev *chr, } } -static void fd_chr_free(struct Chardev *chr) +static void char_fd_finalize(Object *obj) { - FDChardev *s = FD_CHARDEV(chr); + Chardev *chr = CHARDEV(obj); + FDChardev *s = FD_CHARDEV(obj); remove_fd_in_watch(chr); if (s->ioc_in) { @@ -1337,13 +1338,13 @@ static void char_fd_class_init(ObjectClass *oc, void *data) cc->chr_add_watch = fd_chr_add_watch; cc->chr_write = fd_chr_write; cc->chr_update_read_handler = fd_chr_update_read_handler; - cc->chr_free = fd_chr_free; } static const TypeInfo char_fd_type_info = { .name = TYPE_CHARDEV_FD, .parent = TYPE_CHARDEV, .instance_size = sizeof(FDChardev), + .instance_finalize = char_fd_finalize, .class_init = char_fd_class_init, .abstract = true, }; @@ -1425,7 +1426,6 @@ static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo) static void char_stdio_finalize(Object *obj) { term_exit(); - fd_chr_free(CHARDEV(chr)); } static void qemu_chr_open_stdio(Chardev *chr, @@ -1913,11 +1913,6 @@ static int tty_serial_ioctl(Chardev *chr, int cmd, void *arg) } return 0; } - -static void qemu_chr_free_tty(Chardev *chr) -{ - fd_chr_free(chr); -} #endif /* __linux__ || __sun__ */ #if defined(__linux__) @@ -4760,7 +4755,6 @@ static void char_serial_class_init(ObjectClass *oc, void *data) cc->open = qmp_chardev_open_serial; #ifndef _WIN32 cc->chr_ioctl = tty_serial_ioctl; - cc->chr_free = qemu_chr_free_tty; #endif } |