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.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
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.
14 * Author: Jack Lange <jacklange@cs.pitt.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
20 #ifndef __VMM_CHKPT_STORES_H__
21 #define __VMM_CHKPT_STORES_H__
25 * This is a place holder to ensure that the _v3_extensions section gets created by gcc
27 static struct {} null_store __attribute__((__used__)) \
28 __attribute__((unused, __section__ ("_v3_chkpt_stores"), \
29 aligned(sizeof(addr_t))));
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)))) \
42 #ifdef V3_CONFIG_KEYED_STREAMS
43 #include <palacios/vmm_keyed_stream.h>
45 static void * keyed_stream_open_chkpt(char * url) {
46 return v3_keyed_stream_open(url, V3_KS_WR_ONLY_CREATE);
51 static int keyed_stream_close_chkpt(void * store_data) {
52 v3_keyed_stream_t stream = store_data;
54 v3_keyed_stream_close(stream);
59 static void * keyed_stream_open_ctx(void * store_data,
62 v3_keyed_stream_t stream = store_data;
64 return v3_keyed_stream_open_key(stream, name);
67 static int keyed_stream_close_ctx(void * store_data, void * ctx) {
68 v3_keyed_stream_t stream = store_data;
70 v3_keyed_stream_close_key(stream, ctx);
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);
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);
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
96 register_chkpt_store(&keyed_stream_store);