Re: [PATCH] make dvb_ringbuffer compatible to dmxdev_buffer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andreas Oberritter wrote:
> From: Andreas Oberritter <obi@xxxxxxxxxxx>
> 
> Added variable 'error' to struct dvb_ringbuffer, which is set to zero on
> init() and flush(). Also reset read an write pointers to zero on flush()
> to get less fragmented data.
> 
> Signed-off-by: Andreas Oberritter <obi@xxxxxxxxxxx>
> ---
> 
> A patch to make dmxdev use dvb_ringbuffer will follow.
> 
> diff -r 427667c87c7b linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c
> --- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c	Sun Mar 12 00:03:47 2006 -0300
> +++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.c	Mon Mar 13 16:02:46 2006 +0100
> ...
> @@ -86,7 +87,8 @@ ssize_t dvb_ringbuffer_avail(struct dvb_
>  
>  void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
>  {
> -	rbuf->pread = rbuf->pwrite;
> +	rbuf->pread = rbuf->pwrite = 0;
                                   +++

Attention, this will convert dvb_ringbuffer_flush() into a writer!

from dvb_ringbuffer.h:
| ** (2) If there is exactly one reader and one writer, there is no need
| **     to lock read or write operations.
| **     Two or more readers must be locked against each other.
| **     Flushing the buffer counts as a read operation.
         +++++++++++++++++++++++++++++++++++++++++++++++
| **     Two or more writers must be locked against each other.

With this patch flushing the ring buffer is a read _and_ a write
operation. It might break existing code. Are you aware of that?

CU
Oliver

-- 
--------------------------------------------------------
VDR Remote Plugin available at
http://www.escape-edv.de/endriss/vdr/
--------------------------------------------------------

_______________________________________________

linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux