Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


change poll mode for each VNET device
[palacios.git] / linux_module / iface-stream.c
index 5c08204..36582d9 100644 (file)
@@ -1,8 +1,9 @@
-
-/* 
- * VM specific Controls
- * (c) Lei Xia, 2010
+/*
+ * Stream Implementation
+ * (c) Lei Xia  2010
  */
 #include <linux/errno.h>
 #include <linux/percpu.h>
 #include <linux/sched.h>
@@ -47,37 +48,12 @@ struct vm_stream_state {
     struct list_head open_streams;
 };
 
-static int stream_enqueue(struct stream_buffer * stream, char * buf, int len) {
-    int bytes = 0;
-
-    bytes = ringbuf_write(stream->buf, buf, len);
-
-    return bytes;
-}
-
-
-static int stream_dequeue(struct stream_buffer * stream, char * buf, int len) {
-    int bytes = 0;
-
-    bytes = ringbuf_read(stream->buf, buf, len);
-
-    return bytes;
-}
-
-static int stream_datalen(struct stream_buffer * stream){
-    return ringbuf_data_len(stream->buf);
-}
-
-
-
-
 
 static struct stream_buffer * find_stream_by_name(struct v3_guest * guest, const char * name) {
     struct stream_buffer * stream = NULL;
     struct list_head * stream_list = NULL;
     struct vm_stream_state * vm_state = NULL;
 
-
     if (guest == NULL) {
        stream_list = &global_streams;
     } else {
@@ -107,8 +83,7 @@ static ssize_t stream_read(struct file * filp, char __user * buf, size_t size, l
     
     wait_event_interruptible(stream->intr_queue, (ringbuf_data_len(stream->buf) != 0));
 
-
-    return 0;
+    return ringbuf_read(stream->buf, buf, size);
 }
 
 
@@ -164,7 +139,7 @@ static int palacios_stream_write(void * stream_ptr, char * buf, int len) {
     struct stream_buffer * stream = (struct stream_buffer *)stream_ptr;
     int ret = 0;
 
-    ret = stream_enqueue(stream, buf, len);
+    ret = ringbuf_write(stream->buf, buf, len);
 
     if (ret > 0) {
        wake_up_interruptible(&(stream->intr_queue));