From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N08lM-0000Ju-2R for qemu-devel@nongnu.org; Tue, 20 Oct 2009 03:04:08 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N08lE-0000Ey-AL for qemu-devel@nongnu.org; Tue, 20 Oct 2009 03:04:06 -0400 Received: from [199.232.76.173] (port=52020 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N08lE-0000El-2v for qemu-devel@nongnu.org; Tue, 20 Oct 2009 03:04:00 -0400 Received: from mx20.gnu.org ([199.232.41.8]:11450) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N08lD-00069g-6D for qemu-devel@nongnu.org; Tue, 20 Oct 2009 03:03:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N08lC-0003aJ-4X for qemu-devel@nongnu.org; Tue, 20 Oct 2009 03:03:58 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n9K73uUh009126 for ; Tue, 20 Oct 2009 03:03:57 -0400 From: Amit Shah Date: Tue, 20 Oct 2009 12:33:02 +0530 Message-Id: <1256022182-15570-5-git-send-email-amit.shah@redhat.com> In-Reply-To: <1256022182-15570-4-git-send-email-amit.shah@redhat.com> References: <1256022182-15570-1-git-send-email-amit.shah@redhat.com> <1256022182-15570-2-git-send-email-amit.shah@redhat.com> <1256022182-15570-3-git-send-email-amit.shah@redhat.com> <1256022182-15570-4-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH 4/4] char: emit the OPENED event only when a new char connection is opened List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Amit Shah The OPENED event gets sent also when qemu resets its state initially. The consumers of the event aren't interested in receiving this event on reset. Signed-off-by: Amit Shah --- qemu-char.c | 7 ++++++- qemu-char.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletions(-) diff --git a/qemu-char.c b/qemu-char.c index 4757689..0fd402c 100644 --- a/qemu-char.c +++ b/qemu-char.c @@ -119,7 +119,12 @@ static void qemu_chr_event(CharDriverState *s, int event) static void qemu_chr_reset_bh(void *opaque) { CharDriverState *s = opaque; - qemu_chr_event(s, CHR_EVENT_OPENED); + + if (s->initial_reset_issued) { + qemu_chr_event(s, CHR_EVENT_OPENED); + } else { + s->initial_reset_issued = true; + } qemu_bh_delete(s->bh); s->bh = NULL; } diff --git a/qemu-char.h b/qemu-char.h index 05fe15d..409961d 100644 --- a/qemu-char.h +++ b/qemu-char.h @@ -1,6 +1,7 @@ #ifndef QEMU_CHAR_H #define QEMU_CHAR_H +#include #include "qemu-common.h" #include "qemu-queue.h" #include "qemu-option.h" @@ -66,6 +67,7 @@ struct CharDriverState { QEMUBH *bh; char *label; char *filename; + bool initial_reset_issued; QTAILQ_ENTRY(CharDriverState) next; }; -- 1.6.2.5