From patchwork Tue Oct 20 07:03:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Shah X-Patchwork-Id: 36441 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A4122B7B98 for ; Tue, 20 Oct 2009 18:10:26 +1100 (EST) Received: from localhost ([127.0.0.1]:44802 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N08rO-0002C0-M1 for incoming@patchwork.ozlabs.org; Tue, 20 Oct 2009 03:10:22 -0400 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 Received: from localhost (vpn-12-92.rdu.redhat.com [10.11.12.92]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n9K73sol028325; Tue, 20 Oct 2009 03:03:55 -0400 From: Amit Shah To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by mx20.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) Cc: Amit Shah Subject: [Qemu-devel] [PATCH 4/4] char: emit the OPENED event only when a new char connection is opened X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; };