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.


Extended keyed stream interface to include preallocation
[palacios.git] / palacios / src / interfaces / vmm_keyed_stream.c
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, Peter Dinda <pdinda@northwestern.edu>
11  * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Peter Dinda <pdinda@northwestern.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
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>
26
27 struct v3_keyed_stream_hooks * keyed_stream_hooks = 0;
28
29 v3_keyed_stream_t     v3_keyed_stream_open(char *url, v3_keyed_stream_open_t open_type)
30 {
31     V3_ASSERT(keyed_stream_hooks != NULL);
32     V3_ASSERT(keyed_stream_hooks->open != NULL);
33
34     return keyed_stream_hooks->open(url,open_type);
35 }
36
37
38         
39 void                  v3_keyed_stream_close(v3_keyed_stream_t stream)
40 {
41     V3_ASSERT(keyed_stream_hooks != NULL);
42     V3_ASSERT(keyed_stream_hooks->close != NULL);
43
44     return keyed_stream_hooks->close(stream);
45
46 }
47
48
49 void v3_keyed_stream_preallocate_hint_key(v3_keyed_stream_t stream, char *key, uint64_t size)
50 {
51     V3_ASSERT(keyed_stream_hooks != NULL);
52     V3_ASSERT(keyed_stream_hooks->preallocate_hint_key != NULL);
53
54     return keyed_stream_hooks->preallocate_hint_key(stream,key,size);
55 }
56
57 v3_keyed_stream_key_t v3_keyed_stream_open_key(v3_keyed_stream_t stream, char *key)
58 {
59     V3_ASSERT(keyed_stream_hooks != NULL);
60     V3_ASSERT(keyed_stream_hooks->open_key != NULL);
61
62     return keyed_stream_hooks->open_key(stream,key);
63 }
64
65
66 void                  v3_keyed_stream_close_key(v3_keyed_stream_t stream,  char *key)
67 {
68     V3_ASSERT(keyed_stream_hooks != NULL);
69     V3_ASSERT(keyed_stream_hooks->close_key != NULL);
70
71     return keyed_stream_hooks->close_key(stream,key);
72 }
73
74
75 sint64_t              v3_keyed_stream_write_key(v3_keyed_stream_t stream,  
76                                                 v3_keyed_stream_key_t key,
77                                                 void *buf, 
78                                                 sint64_t len)
79 {
80     V3_ASSERT(keyed_stream_hooks != NULL);
81     V3_ASSERT(keyed_stream_hooks->write_key != NULL);
82
83     return keyed_stream_hooks->write_key(stream,key,buf,len);
84 }
85
86 sint64_t              v3_keyed_stream_read_key(v3_keyed_stream_t stream,
87                                                v3_keyed_stream_key_t key,
88                                                void *buf, 
89                                                sint64_t len)
90 {
91     V3_ASSERT(keyed_stream_hooks != NULL);
92     V3_ASSERT(keyed_stream_hooks->read_key != NULL);
93
94     return keyed_stream_hooks->read_key(stream,key,buf,len);
95 }
96
97
98
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");
102
103     return;
104 }