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.


minor fix on reference of v3_init_vnet
[palacios.git] / palacios / src / devices / stream.c
index e470cd9..0c6aed2 100644 (file)
@@ -24,7 +24,7 @@
 #include <palacios/vmm_host_events.h>
 #include <palacios/vmm_lock.h>
 #include <palacios/vmm_string.h>
-
+#include <devices/serial.h>
 
 struct stream_state {
     void *stream;
@@ -52,7 +52,7 @@ static int stream_write(char *buf, uint_t length, void *private_data)
 
 static struct v3_stream_ops stream_ops = {
     .write = stream_write,
-    .read = stream_read
+    .read = stream_read,
 };
 
 static struct v3_device_ops dev_ops = {
@@ -69,6 +69,7 @@ static int stream_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg)
     struct vm_device * frontend = v3_find_dev(vm, frontend_tag);
     char * dev_id = v3_cfg_val(cfg, "ID");
     char * path = v3_cfg_val(cfg, "localname");
+    struct stream_state *state;
 
     /* read configuration */
     V3_ASSERT(frontend_cfg);
@@ -77,13 +78,13 @@ static int stream_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg)
 
     
     /* allocate state */
-    state = (struct cons_state *)V3_Malloc(sizeof(struct stream_state));
+    state = (struct stream_state *)V3_Malloc(sizeof(struct stream_state));
     V3_ASSERT(state);
     state->frontend_dev = frontend;
     V3_ASSERT(path);
        
     /* The system is responsible for interpreting the localname of the stream */
-    state->stream = V3_StreamOpen(ttypath, STREAM_OPEN_MODE_READ | STREAM_OPEN_MODE_WRITE);
+    state->stream = V3_StreamOpen(path, STREAM_OPEN_MODE_READ | STREAM_OPEN_MODE_WRITE);
     if (!state->stream) {
        PrintError("Could not open localname %s\n", path);
        V3_Free(state);
@@ -101,11 +102,10 @@ static int stream_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg)
        return -1;
     }
 
-    /* attach to front-end display adapter */
-    v3_console_register_cga(frontend, &cons_ops, dev);
-
-       return 0;
+    v3_stream_register_serial(frontend, &stream_ops, dev);
+       
+    return 0;
 }
 
-device_register("CURSES_CONSOLE", cons_init)
+device_register("STREAM", stream_init)