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, Peter Dinda <pdinda@northwestern.edu>
11 * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Peter Dinda <pdinda@northwestern.edu>
16 * This is free software. You are permitted to use,
17 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21 #include <interfaces/vmm_keyed_stream.h>
22 #include <palacios/vmm.h>
23 #include <palacios/vmm_debug.h>
24 #include <palacios/vmm_types.h>
25 #include <palacios/vm_guest.h>
27 struct v3_keyed_stream_hooks * keyed_stream_hooks = 0;
29 v3_keyed_stream_t v3_keyed_stream_open(char *url, v3_keyed_stream_open_t open_type)
31 V3_ASSERT(keyed_stream_hooks != NULL);
32 V3_ASSERT(keyed_stream_hooks->open != NULL);
34 return keyed_stream_hooks->open(url,open_type);
39 void v3_keyed_stream_close(v3_keyed_stream_t stream)
41 V3_ASSERT(keyed_stream_hooks != NULL);
42 V3_ASSERT(keyed_stream_hooks->close != NULL);
44 return keyed_stream_hooks->close(stream);
49 void v3_keyed_stream_preallocate_hint_key(v3_keyed_stream_t stream, char *key, uint64_t size)
51 V3_ASSERT(keyed_stream_hooks != NULL);
52 V3_ASSERT(keyed_stream_hooks->preallocate_hint_key != NULL);
54 return keyed_stream_hooks->preallocate_hint_key(stream,key,size);
57 v3_keyed_stream_key_t v3_keyed_stream_open_key(v3_keyed_stream_t stream, char *key)
59 V3_ASSERT(keyed_stream_hooks != NULL);
60 V3_ASSERT(keyed_stream_hooks->open_key != NULL);
62 return keyed_stream_hooks->open_key(stream,key);
66 void v3_keyed_stream_close_key(v3_keyed_stream_t stream, char *key)
68 V3_ASSERT(keyed_stream_hooks != NULL);
69 V3_ASSERT(keyed_stream_hooks->close_key != NULL);
71 return keyed_stream_hooks->close_key(stream,key);
75 sint64_t v3_keyed_stream_write_key(v3_keyed_stream_t stream,
76 v3_keyed_stream_key_t key,
80 V3_ASSERT(keyed_stream_hooks != NULL);
81 V3_ASSERT(keyed_stream_hooks->write_key != NULL);
83 return keyed_stream_hooks->write_key(stream,key,buf,len);
86 sint64_t v3_keyed_stream_read_key(v3_keyed_stream_t stream,
87 v3_keyed_stream_key_t key,
91 V3_ASSERT(keyed_stream_hooks != NULL);
92 V3_ASSERT(keyed_stream_hooks->read_key != NULL);
94 return keyed_stream_hooks->read_key(stream,key,buf,len);
99 void V3_Init_Keyed_Streams(struct v3_keyed_stream_hooks * hooks) {
100 keyed_stream_hooks = hooks;
101 PrintDebug("V3 keyed stream support inited\n");