From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NfLP5-0001NE-J4 for qemu-devel@nongnu.org; Wed, 10 Feb 2010 17:51:27 -0500 Received: from [199.232.76.173] (port=53658 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NfLP4-0001Ly-I2 for qemu-devel@nongnu.org; Wed, 10 Feb 2010 17:51:26 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NfLP3-0000IP-0B for qemu-devel@nongnu.org; Wed, 10 Feb 2010 17:51:26 -0500 Received: from mail-iw0-f194.google.com ([209.85.223.194]:33570) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NfLP2-0000ID-Ir for qemu-devel@nongnu.org; Wed, 10 Feb 2010 17:51:24 -0500 Received: by iwn32 with SMTP id 32so1044153iwn.14 for ; Wed, 10 Feb 2010 14:51:23 -0800 (PST) Message-ID: <4B733868.2040100@codemonkey.ws> Date: Wed, 10 Feb 2010 16:51:20 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] add close callback for tty-based char device References: <1265839249-12068-1-git-send-email-daahern@cisco.com> In-Reply-To: <1265839249-12068-1-git-send-email-daahern@cisco.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Ahern Cc: qemu-devel@nongnu.org On 02/10/2010 04:00 PM, David Ahern wrote: > Add a tty close callback. Right now if a guest device that is connected > to a tty-based chardev in the host is removed, the tty is not closed. > With this patch it is closed. > > Example use case is connecting an emulated USB serial cable in the guest > to ttyS0 of the host using the monitor command: > > usb_add serial::/dev/ttyS0 > > and then removing the device with: > > usb_del serial::/dev/ttyS0 > > Signed-off-by: David Ahern > --- > qemu-char.c | 15 +++++++++++++++ > 1 files changed, 15 insertions(+), 0 deletions(-) > > diff --git a/qemu-char.c b/qemu-char.c > index 75dbf66..77edec9 100644 > --- a/qemu-char.c > +++ b/qemu-char.c > @@ -1173,6 +1173,20 @@ static int tty_serial_ioctl(CharDriverState *chr, int cmd, void *arg) > return 0; > } > > +static void qemu_chr_close_tty(CharDriverState *chr) > +{ > + FDCharDriver *s = chr->opaque; > + int fd = -1; > + > + if (s) > + fd = s->fd_in; > > You've got trailing spaces and this doesn't adhere to CODING_STYLE (needs curly braces around the if clause). Regards, Anthony Liguori