[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v3 02/51] char: add qemu_chr_free()
From: |
marcandre . lureau |
Subject: |
[Qemu-devel] [PULL v3 02/51] char: add qemu_chr_free() |
Date: |
Tue, 13 Oct 2015 16:25:29 +0200 |
From: Marc-André Lureau <address@hidden>
If a chardev is allowed to be created outside of QMP, then it must be
also possible to free it. This is useful for ivshmem that creates
chardev anonymously and must be able to free them.
Signed-off-by: Marc-André Lureau <address@hidden>
Acked-by: Paolo Bonzini <address@hidden>
Reviewed-by: Claudio Fontana <address@hidden>
---
include/sysemu/char.h | 10 +++++++++-
qemu-char.c | 9 +++++++--
2 files changed, 16 insertions(+), 3 deletions(-)
diff --git a/include/sysemu/char.h b/include/sysemu/char.h
index 832b7fe..5fd0a09 100644
--- a/include/sysemu/char.h
+++ b/include/sysemu/char.h
@@ -128,11 +128,19 @@ CharDriverState *qemu_chr_new(const char *label, const
char *filename,
/**
* @qemu_chr_delete:
*
- * Destroy a character backend.
+ * Destroy a character backend and remove it from the list of
+ * identified character backends.
*/
void qemu_chr_delete(CharDriverState *chr);
/**
+ * @qemu_chr_free:
+ *
+ * Destroy a character backend.
+ */
+void qemu_chr_free(CharDriverState *chr);
+
+/**
* @qemu_chr_fe_set_echo:
*
* Ask the backend to override its normal echo setting. This only really
diff --git a/qemu-char.c b/qemu-char.c
index 653ea10..e6ed85c 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -3840,9 +3840,8 @@ void qemu_chr_fe_release(CharDriverState *s)
s->avail_connections++;
}
-void qemu_chr_delete(CharDriverState *chr)
+void qemu_chr_free(CharDriverState *chr)
{
- QTAILQ_REMOVE(&chardevs, chr, next);
if (chr->chr_close) {
chr->chr_close(chr);
}
@@ -3852,6 +3851,12 @@ void qemu_chr_delete(CharDriverState *chr)
g_free(chr);
}
+void qemu_chr_delete(CharDriverState *chr)
+{
+ QTAILQ_REMOVE(&chardevs, chr, next);
+ qemu_chr_free(chr);
+}
+
ChardevInfoList *qmp_query_chardev(Error **errp)
{
ChardevInfoList *chr_list = NULL;
--
2.4.3
- [Qemu-devel] [PULL v3 00/51] Ivshmem patches, marcandre . lureau, 2015/10/15
- [Qemu-devel] [PULL v3 01/51] tests: Add ivshmem qtest, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 02/51] char: add qemu_chr_free(),
marcandre . lureau <=
- [Qemu-devel] [PULL v3 03/51] msix: add VMSTATE_MSIX_TEST, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 04/51] ivhsmem: read do not accept more than sizeof(long), marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 05/51] ivshmem: fix number of bytes to push to fifo, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 06/51] ivshmem: factor out the incoming fifo handling, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 08/51] ivshmem: remove superflous ivshmem_attr field, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 09/51] ivshmem: remove useless doorbell field, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 07/51] ivshmem: remove unnecessary dup(), marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 10/51] ivshmem: more qdev conversion, marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 11/51] ivshmem: remove last exit(1), marcandre . lureau, 2015/10/13
- [Qemu-devel] [PULL v3 15/51] ivshmem: remove useless ivshmem_update_irq() val argument, marcandre . lureau, 2015/10/13