Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 3/4] Add ring_buffer_read_advance for partial write
Date: Wed, 10 Feb 2010 09:36:39 -0600	[thread overview]
Message-ID: <201002100936.40723.denkenz@gmail.com> (raw)
In-Reply-To: <1265789623-30146-3-git-send-email-zhenhua.zhang@intel.com>

[-- Attachment #1: Type: text/plain, Size: 969 bytes --]

Hi Zhenhua,

> These two patches are for server side partial write.
> 
> When server writes data into non-blocking IO, we first get the
> read pointer of write_buf and write data as much as we can. Then
> we advance the read_ptr according to the real bytes written.
> ---
>  gatchat/ringbuffer.c |    8 ++++++++
>  gatchat/ringbuffer.h |    7 +++++++
>  2 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/gatchat/ringbuffer.c b/gatchat/ringbuffer.c
> index 42d5b68..e17c1fa 100644
> --- a/gatchat/ringbuffer.c
> +++ b/gatchat/ringbuffer.c
> @@ -130,6 +130,14 @@ int ring_buffer_read(struct ring_buffer *buf, void
>  *data, unsigned int len) return len;
>  }
> 
> +int ring_buffer_read_advance(struct ring_buffer *buf, unsigned int len)
> +{
> +	len = MIN(len, buf->in - buf->out);
> +	buf->out += len;
> +
> +	return len;
> +}
> +

ring_buffer_drain already does this, that is the one you want to use.

Regards,
-Denis

  parent reply	other threads:[~2010-02-10 15:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10  8:13 [PATCH 1/4] Add write ring buffer for non-blocking write Zhenhua Zhang
2010-02-10  8:13 ` [PATCH 2/4] Add handle the case when write buffer is full Zhenhua Zhang
2010-02-10  8:13   ` [PATCH 3/4] Add ring_buffer_read_advance for partial write Zhenhua Zhang
2010-02-10  8:13     ` [PATCH 4/4] Add write server response into non blocking IO Zhenhua Zhang
2010-02-10 15:36     ` Denis Kenzior [this message]
2010-02-10 17:23 ` [PATCH 1/4] Add write ring buffer for non-blocking write Gustavo F. Padovan
2010-02-11  1:40   ` Zhenhua Zhang

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=201002100936.40723.denkenz@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.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