From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvW9l-00029F-Bo for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:02:14 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvW9g-000245-JP for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:02:12 -0400 Received: from [199.232.76.173] (port=40362 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvW9f-00023d-Uz for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:02:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40055) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvW9d-0008KC-M1 for qemu-devel@nongnu.org; Wed, 07 Oct 2009 09:02:06 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n97D245J025327 for ; Wed, 7 Oct 2009 09:02:05 -0400 From: Amit Shah Date: Wed, 7 Oct 2009 18:31:17 +0530 Message-Id: <1254920477-4645-4-git-send-email-amit.shah@redhat.com> In-Reply-To: <1254920477-4645-3-git-send-email-amit.shah@redhat.com> References: <1254920477-4645-1-git-send-email-amit.shah@redhat.com> <1254920477-4645-2-git-send-email-amit.shah@redhat.com> <1254920477-4645-3-git-send-email-amit.shah@redhat.com> Subject: [Qemu-devel] [PATCH v2 3/3] 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