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.


Added host keyed stream support
Peter Dinda [Thu, 7 Apr 2011 21:11:59 +0000 (16:11 -0500)]
Kconfig
palacios/include/palacios/vmm_keyed_stream.h [new file with mode: 0644]
palacios/src/palacios/Makefile
palacios/src/palacios/vmm_keyed_stream.c [new file with mode: 0644]

diff --git a/Kconfig b/Kconfig
index 28c4b09..cd0774e 100644 (file)
--- a/Kconfig
+++ b/Kconfig
@@ -131,6 +131,12 @@ config FILE
        help
          Select this if your host OS supports file operatoins and you want Palacios to be able to use them.
 
+config KEYED_STREAMS
+       bool "Host support for keyed streams"
+       default n
+       help
+         Select this if your host OS supports keyed streams
+          Palacios Checkpoint/Restore and Migration depends on this feature
 
 config CONSOLE
        bool "Host Support for VM text-mode console"
diff --git a/palacios/include/palacios/vmm_keyed_stream.h b/palacios/include/palacios/vmm_keyed_stream.h
new file mode 100644 (file)
index 0000000..b3de41c
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Peter Dinda <pdinda@northwestern.edu> 
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Peter Dinda <pdinda@northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#ifndef __VMM_KEYED_STREAM_H__
+#define __VMM_KEYED_STREAM_H__
+
+#include <palacios/vmm.h>
+
+
+/*
+  A keyed stream essentially supports this:
+
+  URL => {collection of key->stream pairs}
+
+  If you open a key for reading, you get the read pointer set to its beginning.   
+  You can then make repeated reads to advance the read pointer.  You cannot seek.
+
+  Writing works similarly.
+
+  You cannot both read and write. 
+
+*/
+
+/* A keyed stream and its components are opaque to palacios */
+typedef void * v3_keyed_stream_t;
+typedef void * v3_keyed_stream_key_t;
+
+typedef enum {V3_KS_RD_ONLY,V3_KS_WR_ONLY,V3_KS_WR_ONLY_CREATE} v3_keyed_stream_open_t;
+
+#ifdef __V3VEE__
+
+
+v3_keyed_stream_t     v3_keyed_stream_open(char *url, v3_keyed_stream_open_t open_type);
+void                  v3_keyed_stream_close(v3_keyed_stream_t stream);
+v3_keyed_stream_key_t v3_keyed_stream_open_key(v3_keyed_stream_t stream, char *key);
+void                  v3_keyed_stream_close_key(v3_keyed_stream_t stream,  char *key);
+sint64_t              v3_keyed_stream_write_key(v3_keyed_stream_t stream,  
+                                               v3_keyed_stream_key_t key,
+                                               void *buf, 
+                                               sint64_t len);
+sint64_t              v3_keyed_stream_read_key(v3_keyed_stream_t stream,
+                                              v3_keyed_stream_key_t key,
+                                              void *buf, 
+                                              sint64_t len);
+
+#define STD_SAVE(stream,ks,x)                  \
+    do { \
+       if (sizeof((x)) != v3_keyed_stream_write_key((stream), (ks), &(x), sizeof((x)))) { \
+           v3_keyed_stream_close_key((stream),(ks)); \
+           return -1;                                \
+       } \
+    } while (0)
+
+#define STD_LOAD(stream,ks,x)                  \
+    do {                                                               \
+       if (sizeof((x)) != v3_keyed_stream_read_key((stream), (ks), &(x), sizeof((x)))) { \
+           v3_keyed_stream_close_key((stream),(ks)); \
+           return -1;                                 \
+       } \
+    } while (0)
+#endif
+
+
+struct v3_keyed_stream_hooks {
+    // url is meaningful only to the host implementation
+    v3_keyed_stream_t (*open)(char *url,
+                             v3_keyed_stream_open_t open_type);
+                             
+    void (*close)(v3_keyed_stream_t stream);
+
+    v3_keyed_stream_key_t (*open_key)(v3_keyed_stream_t stream,
+                                     char *key);
+
+    void (*close_key)(v3_keyed_stream_t stream,
+                     char *key);
+    
+
+    sint64_t (*write_key)(v3_keyed_stream_t stream,
+                         v3_keyed_stream_key_t key,
+                         void *buf, 
+                         sint64_t len);
+    sint64_t (*read_key)(v3_keyed_stream_t stream,
+                        v3_keyed_stream_key_t key,
+                        void *buf, 
+                        sint64_t len);
+    
+};
+
+
+extern void V3_Init_Keyed_Streams(struct v3_keyed_stream_hooks *hooks);
+
+#endif
index c02f934..dfc16c6 100644 (file)
@@ -71,6 +71,7 @@ obj-$(CONFIG_VNET) += vmm_vnet_core.o
 obj-$(CONFIG_FILE) += vmm_file.o
 obj-$(CONFIG_CONSOLE) += vmm_console.o vmm_stream.o
 obj-$(CONFIG_GRAPHICS_CONSOLE) += vmm_graphics_console.o
+obj-$(CONFIG_KEYED_STREAM) += vmm_keyed_stream.o
 
 
 obj-$(CONFIG_SYMBIOTIC) += vmm_symbiotic.o vmm_symspy.o
diff --git a/palacios/src/palacios/vmm_keyed_stream.c b/palacios/src/palacios/vmm_keyed_stream.c
new file mode 100644 (file)
index 0000000..cbe2481
--- /dev/null
@@ -0,0 +1,96 @@
+/*
+ * This file is part of the Palacios Virtual Machine Monitor developed
+ * by the V3VEE Project with funding from the United States National 
+ * Science Foundation and the Department of Energy.  
+ *
+ * The V3VEE Project is a joint project between Northwestern University
+ * and the University of New Mexico.  You can find out more at 
+ * http://www.v3vee.org
+ *
+ * Copyright (c) 2011, Peter Dinda <pdinda@northwestern.edu>
+ * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
+ * All rights reserved.
+ *
+ * Author: Peter Dinda <pdinda@northwestern.edu>
+ *
+ * This is free software.  You are permitted to use,
+ * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
+ */
+
+
+#include <palacios/vmm_graphics_console.h>
+#include <palacios/vmm.h>
+#include <palacios/vmm_debug.h>
+#include <palacios/vmm_types.h>
+#include <palacios/vm_guest.h>
+
+struct v3_keyed_stream_hooks * keyed_stream_hooks = 0;
+
+v3_keyed_stream_t     v3_keyed_stream_open(char *url, v3_keyed_stream_open_t open_type)
+{
+    V3_ASSERT(keyed_stream_hooks != NULL);
+    V3_ASSERT(keyed_stream_hooks->open != NULL);
+
+    return keyed_stream_hooks->open(url,open_type);
+}
+
+
+       
+void                  v3_keyed_stream_close(v3_keyed_stream_t stream)
+{
+    V3_ASSERT(keyed_stream_hooks != NULL);
+    V3_ASSERT(keyed_stream_hooks->close != NULL);
+
+    return keyed_stream_hooks->close(stream);
+
+}
+
+
+v3_keyed_stream_key_t v3_keyed_stream_open_key(v3_keyed_stream_t stream, char *key)
+{
+    V3_ASSERT(keyed_stream_hooks != NULL);
+    V3_ASSERT(keyed_stream_hooks->open_key != NULL);
+
+    return keyed_stream_hooks->open_key(stream,key);
+}
+
+
+void                  v3_keyed_stream_close_key(v3_keyed_stream_t stream,  char *key)
+{
+    V3_ASSERT(keyed_stream_hooks != NULL);
+    V3_ASSERT(keyed_stream_hooks->close_key != NULL);
+
+    return keyed_stream_hooks->close_key(stream,key);
+}
+
+
+sint64_t              v3_keyed_stream_write_key(v3_keyed_stream_t stream,  
+                                               v3_keyed_stream_key_t key,
+                                               void *buf, 
+                                               sint64_t len)
+{
+    V3_ASSERT(keyed_stream_hooks != NULL);
+    V3_ASSERT(keyed_stream_hooks->write_key != NULL);
+
+    return keyed_stream_hooks->write_key(stream,key,buf,len);
+}
+
+sint64_t              v3_keyed_stream_read_key(v3_keyed_stream_t stream,
+                                              v3_keyed_stream_key_t key,
+                                              void *buf, 
+                                              sint64_t len)
+{
+    V3_ASSERT(keyed_stream_hooks != NULL);
+    V3_ASSERT(keyed_stream_hooks->read_key != NULL);
+
+    return keyed_stream_hooks->read_key(stream,key,buf,len);
+}
+
+
+
+void V3_Init_Keyed_Streams(struct v3_keyed_stream_hooks * hooks) {
+    keyed_stream_hooks = hooks;
+    PrintDebug("V3 keyed stream support inited\n");
+
+    return;
+}