From 3065070153ef4235659d821c0d6fa28fd0630c57 Mon Sep 17 00:00:00 2001 From: Anton Nefedov Date: Thu, 6 Jul 2017 15:08:52 +0300 Subject: char: avoid chardevice direct access MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit frontends should avoid accessing CharDriver struct where possible Signed-off-by: Anton Nefedov Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Marc-André Lureau Message-Id: <1499342940-56739-6-git-send-email-anton.nefedov@virtuozzo.com> Signed-off-by: Paolo Bonzini --- chardev/char-fe.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'chardev') diff --git a/chardev/char-fe.c b/chardev/char-fe.c index de5ba3c..f3af6ae 100644 --- a/chardev/char-fe.c +++ b/chardev/char-fe.c @@ -189,6 +189,11 @@ bool qemu_chr_fe_backend_connected(CharBackend *be) return !!be->chr; } +bool qemu_chr_fe_backend_open(CharBackend *be) +{ + return be->chr && be->chr->be_open; +} + bool qemu_chr_fe_init(CharBackend *b, Chardev *s, Error **errp) { int tag = 0; -- cgit v1.1