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.


3e8fe1d8dcd86947ca565fb65232881f46a1309d
[palacios.git] / palacios / src / palacios / vmm_chkpt_stores.h
1 /*
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2011, Jack Lange <jacklange@cs.pitt.edu> 
11  * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jacklange@cs.pitt.edu> 
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #ifndef __VMM_CHKPT_STORES_H__
21 #define __VMM_CHKPT_STORES_H__
22
23
24 /*
25  * This is a place holder to ensure that the _v3_extensions section gets created by gcc
26  */
27 static struct {} null_store __attribute__((__used__))                   \
28     __attribute__((unused, __section__ ("_v3_chkpt_stores"),            \
29                    aligned(sizeof(addr_t))));
30
31
32 #define register_chkpt_store(store)                                     \
33     static struct v3_chkpt_interface * _v3_store_#store                 \
34     __attribute__((used))                                               \
35         __attribute__((unused, __section__("_v3_chkpt_stores"),         \
36                        aligned(sizeof(addr_t))))                        \
37         = store;
38
39
40
41
42 #ifdef V3_CONFIG_KEYED_STREAMS
43 #include <palacios/vmm_keyed_stream.h>
44
45 static void * keyed_stream_open_chkpt(char * url) {
46     return v3_keyed_stream_open(url, V3_KS_WR_ONLY_CREATE);
47 }
48
49
50
51 static int keyed_stream_close_chkpt(void * store_data) {
52     v3_keyed_stream_t stream = store_data;
53
54     v3_keyed_stream_close(stream);
55
56     return 0;
57 }
58
59 static void * keyed_stream_open_ctx(void * store_data, 
60                                     void * parent_ctx, 
61                                     char * name) {
62     v3_keyed_stream_t stream = store_data;
63
64     return v3_keyed_stream_open_key(stream, name);
65 }
66
67 static int keyed_stream_close_ctx(void * store_data, void * ctx) {
68     v3_keyed_stream_t stream = store_data;
69
70     v3_keyed_stream_close_key(stream, ctx);
71
72     return 0;
73 }
74
75 static uint64_t keyed_stream_save(void * store_data, void * ctx, 
76                                   char * tag, uint64_t len, void * buf) {
77     return v3_keyed_stream_write_key(store_data, ctx, buf, len);
78 }
79
80 static uint64_t keyed_stream_load(void * store_data, void * ctx, 
81                                   char * tag, uint64_t len, void * buf) {
82     return v3_keyed_stream_read_key(store_data, ctx, buf, len);
83 }
84
85
86 static struct chkpt_interface keyed_stream_store = {
87     .name = "KEYED_STREAM",
88     .open_chkpt = keyed_stream_open_chkpt,
89     .close_chkpt = keyed_stream_close_chkpt,
90     .open_ctx = keyed_stream_open_ctx, 
91     .close_ctx = keyed_stream_close_ctx,
92     .save = keyed_stream_save,
93     .load = keyed_stream_load
94 };
95
96 register_chkpt_store(&keyed_stream_store);
97
98
99
100 #endif
101
102
103
104
105
106
107 #endif