From: Anthony Liguori <anthony@codemonkey.ws>
To: Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Amit Shah <amit.shah@redhat.com>,
Hans de Goede <hdegoede@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 12/12] char: enforce the use of qemu_chr_guest_open()
Date: Mon, 01 Aug 2011 10:39:43 -0500 [thread overview]
Message-ID: <4E36C8BF.8060505@codemonkey.ws> (raw)
In-Reply-To: <20110801153812.GE2574@bow.tlv.redhat.com>
On 08/01/2011 10:38 AM, Alon Levy wrote:
> On Mon, Aug 01, 2011 at 09:23:10AM -0500, Anthony Liguori wrote:
>> Signed-off-by: Anthony Liguori<aliguori@us.ibm.com>
>
> Title should be "fe_open", not guest_open.
Indeed, thanks.
Regards,
Anthony Liguori
>
>> ---
>> qemu-char.c | 10 ++++++++++
>> qemu-char.h | 2 ++
>> 2 files changed, 12 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu-char.c b/qemu-char.c
>> index fb7c937..5e62795 100644
>> --- a/qemu-char.c
>> +++ b/qemu-char.c
>> @@ -206,6 +206,8 @@ int qemu_chr_fe_write(CharDriverState *s, const uint8_t *buf, int len)
>> int ret;
>> bool is_empty;
>>
>> + assert(s->fe_opened> 0);
>> +
>> is_empty = char_queue_get_empty(&s->fe_tx);
>>
>> ret = char_queue_write(&s->fe_tx, buf, len);
>> @@ -228,6 +230,8 @@ int qemu_chr_fe_read(CharDriverState *s, uint8_t *buf, int len)
>> bool is_full;
>> int ret;
>>
>> + assert(s->fe_opened> 0);
>> +
>> is_full = (char_queue_get_avail(&s->be_tx) == 0);
>>
>> ret = char_queue_read(&s->be_tx, buf, len);
>> @@ -249,6 +253,8 @@ void qemu_chr_fe_set_handlers(CharDriverState *s,
>> IOEventHandler *chr_event,
>> void *opaque)
>> {
>> + assert(s->fe_opened> 0);
>> +
>> if (!opaque&& !chr_read&& !chr_write&& !chr_event) {
>> /* chr driver being released. */
>> ++s->avail_connections;
>> @@ -2822,6 +2828,8 @@ void qemu_chr_set_echo(struct CharDriverState *chr, bool echo)
>>
>> void qemu_chr_fe_open(struct CharDriverState *chr)
>> {
>> + chr->fe_opened++;
>> +
>> if (chr->chr_guest_open) {
>> chr->chr_guest_open(chr);
>> }
>> @@ -2832,6 +2840,8 @@ void qemu_chr_fe_close(struct CharDriverState *chr)
>> if (chr->chr_guest_close) {
>> chr->chr_guest_close(chr);
>> }
>> +
>> + chr->fe_opened--;
>> }
>>
>> void qemu_chr_close(CharDriverState *chr)
>> diff --git a/qemu-char.h b/qemu-char.h
>> index 8b37fcf..b910c5e 100644
>> --- a/qemu-char.h
>> +++ b/qemu-char.h
>> @@ -88,6 +88,8 @@ struct CharDriverState {
>> int opened;
>> int avail_connections;
>>
>> + int fe_opened;
>> +
>> CharQueue fe_tx;
>> CharQueue be_tx;
>>
>> --
>> 1.7.4.1
>>
>>
>
next prev parent reply other threads:[~2011-08-01 15:39 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-01 14:22 [Qemu-devel] [PATCH 00/12][RFC] char: add flow control and fix guest_[open|close] Anthony Liguori
2011-08-01 14:22 ` [Qemu-devel] [PATCH 01/12] char: rename qemu_chr_write() to qemu_chr_fe_write() Anthony Liguori
2011-08-04 16:00 ` Avi Kivity
2011-08-04 16:11 ` Anthony Liguori
2011-08-04 16:14 ` Avi Kivity
2011-08-04 16:17 ` Avi Kivity
2011-08-04 16:22 ` Anthony Liguori
2011-08-04 16:21 ` Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 02/12] char: rename qemu_chr_[can_]read() to qemu_chr_be_[can_]write() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 03/12] char: introduce tx queue to enable Unix style flow control Anthony Liguori
2011-08-04 16:04 ` Avi Kivity
2011-08-04 16:31 ` Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 04/12] char: introduce backend tx queue Anthony Liguori
2011-08-01 15:33 ` Stefan Hajnoczi
2011-08-01 15:37 ` Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 05/12] char: add read functions for backend and frontend Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 06/12] char: add an edge event API for the front ends Anthony Liguori
2011-08-01 15:39 ` Stefan Hajnoczi
2011-08-01 15:40 ` Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 07/12] char: add backend edge notification interface Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 08/12] char: make monitor use new style interface Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 09/12] char: rename qemu_chr_guest_open() -> qemu_chr_fe_open() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 10/12] char: rename qemu_chr_guest_close() -> qemu_chr_fe_close() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 11/12] char: make all devices do qemu_chr_fe_open() Anthony Liguori
2011-08-01 14:23 ` [Qemu-devel] [PATCH 12/12] char: enforce the use of qemu_chr_guest_open() Anthony Liguori
2011-08-01 15:38 ` Alon Levy
2011-08-01 15:39 ` Anthony Liguori [this message]
2011-08-01 16:04 ` [Qemu-devel] [PATCH 00/12][RFC] char: add flow control and fix guest_[open|close] Alon Levy
2011-08-01 16:13 ` Anthony Liguori
2011-08-01 17:42 ` Hans de Goede
2011-08-01 21:54 ` Blue Swirl
2011-08-01 22:47 ` Anthony Liguori
2011-08-04 6:45 ` Amit Shah
2011-08-04 13:11 ` Anthony Liguori
2011-08-04 14:46 ` Amit Shah
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4E36C8BF.8060505@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=aliguori@us.ibm.com \
--cc=amit.shah@redhat.com \
--cc=hdegoede@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).