[linux-dvb] [PATCH] make dvb_ringbuffer compatible to dmxdev_buffer

Andreas Oberritter obi at linuxtv.org
Mon Mar 13 16:21:26 CET 2006


From: Andreas Oberritter <obi at linuxtv.org>

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 at linuxtv.org>
---

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
@@ -45,6 +45,7 @@ void dvb_ringbuffer_init(struct dvb_ring
 	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_
 
 void dvb_ringbuffer_flush(struct dvb_ringbuffer *rbuf)
 {
-	rbuf->pread = rbuf->pwrite;
+	rbuf->pread = rbuf->pwrite = 0;
+	rbuf->error = 0;
 }
 
 
diff -r 427667c87c7b linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h
--- a/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h	Sun Mar 12 00:03:47 2006 -0300
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ringbuffer.h	Mon Mar 13 16:02:46 2006 +0100
@@ -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;





More information about the linux-dvb mailing list