From patchwork Wed Nov 28 09:05:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 202391 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 4F1822C0091 for ; Wed, 28 Nov 2012 20:06:20 +1100 (EST) Received: from localhost ([::1]:37874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tddb0-0007JT-94 for incoming@patchwork.ozlabs.org; Wed, 28 Nov 2012 04:06:18 -0500 Received: from eggs.gnu.org ([208.118.235.92]:49328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tddab-0006v0-Sc for qemu-devel@nongnu.org; Wed, 28 Nov 2012 04:05:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TddaV-0000sr-RR for qemu-devel@nongnu.org; Wed, 28 Nov 2012 04:05:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:8708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TddaV-0000sl-IM for qemu-devel@nongnu.org; Wed, 28 Nov 2012 04:05:47 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qAS95kiF017309 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 28 Nov 2012 04:05:46 -0500 Received: from garlic.redhat.com (vpn1-4-144.ams2.redhat.com [10.36.4.144]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qAS95eP8011401; Wed, 28 Nov 2012 04:05:44 -0500 From: Alon Levy To: qemu-devel@nongnu.org, amit.shah@redhat.com Date: Wed, 28 Nov 2012 11:05:38 +0200 Message-Id: <1354093540-22583-2-git-send-email-alevy@redhat.com> In-Reply-To: <1354093540-22583-1-git-send-email-alevy@redhat.com> References: <87lidm6f7p.fsf@codemonkey.ws> <1354093540-22583-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: armbru@redhat.com, anthony@codemonkey.ws Subject: [Qemu-devel] [PATCH 1/3] virtio-serial: add virtio_serial_guest_connected X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Alon Levy --- hw/virtio-serial-bus.c | 9 +++++++++ hw/virtio-serial.h | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c index ccce1fa..9147497 100644 --- a/hw/virtio-serial-bus.c +++ b/hw/virtio-serial-bus.c @@ -290,6 +290,15 @@ ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf, } /* + * Connectedness of the guest to the port. + * Returns 1 for guest connected, 0 for disconnected. + */ +int virtio_serial_guest_connected(VirtIOSerialPort *port) +{ + return port->guest_connected; +} + +/* * Readiness of the guest to accept data on a port. * Returns max. data the guest can receive */ diff --git a/hw/virtio-serial.h b/hw/virtio-serial.h index 16e3982..5012194 100644 --- a/hw/virtio-serial.h +++ b/hw/virtio-serial.h @@ -194,6 +194,11 @@ ssize_t virtio_serial_write(VirtIOSerialPort *port, const uint8_t *buf, size_t size); /* + * Query whether a guest is connected. + */ +int virtio_serial_guest_connected(VirtIOSerialPort *port); + +/* * Query whether a guest is ready to receive data. */ size_t virtio_serial_guest_ready(VirtIOSerialPort *port);