V4L/DVB (3484): Make dvb_ringbuffer compatible to dmxdev_buffer
authorAndreas Oberritter <obi@linuxtv.org>
Mon, 13 Mar 2006 16:14:34 +0000 (13:14 -0300)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 21 Mar 2006 16:53:17 +0000 (08:53 -0800)
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@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/dvb-core/dvb_ringbuffer.c
drivers/media/dvb/dvb-core/dvb_ringbuffer.h

index 77ad2410f4d3cd29cfb3a63a72c6dd6512c22cba..f233248358c4d813f94769a9019f018ab1f8afa6 100644 (file)
@@ -45,6 +45,7 @@ void dvb_ringbuffer_init(struct dvb_ringbuffer *rbuf, void *data, size_t len)
        rbuf->pread=rbuf->pwrite=0;
        rbuf->data=data;
        rbuf->size=len;
+       rbuf->error=0;
 
        init_waitqueue_head(&rbuf->queue);
 
@@ -86,7 +87,8 @@ ssize_t dvb_ringbuffer_avail(struct dvb_ringbuffer *rbuf)
 
 void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
 {
-       rbuf->pread = rbuf->pwrite;
+       rbuf->pread = rbuf->pwrite = 0;
+       rbuf->error = 0;
 }
 
 
index 6d25609727719df623adfd83fde491fb1d071cf2..d97714e757362b6ee62204de6444b68337faaede 100644 (file)
@@ -35,6 +35,7 @@ struct dvb_ringbuffer {
        ssize_t           size;
        ssize_t           pread;
        ssize_t           pwrite;
+       int               error;
 
        wait_queue_head_t queue;
        spinlock_t        lock;