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.


Merge branch 'devel' of palacios@newskysaw.cs.northwestern.edu:/home/palacios/palacio...
[palacios.git] / palacios / src / palacios / vmm_file.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) 2010, Peter Dinda <pdinda@northwestern.edu> 
11  * Copyright (c) 2010, 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 <palacios/vmm_file.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 static struct v3_file_hooks * file_hooks = NULL;
28
29 void V3_Init_File(struct v3_file_hooks * hooks) {
30     file_hooks = hooks;
31     PrintDebug("V3 file access inited\n");
32
33     return;
34 }
35
36
37 v3_file_t v3_file_open(struct v3_vm_info * vm, char * path, uint8_t mode) {
38     void * priv_data = NULL;
39     V3_ASSERT(file_hooks);
40     V3_ASSERT(file_hooks->open);
41     
42     if (vm) {
43         priv_data = vm->host_priv_data;
44     }
45
46     return file_hooks->open(path, mode, priv_data);
47 }
48
49 int v3_file_close(v3_file_t file) {
50     V3_ASSERT(file_hooks);
51     V3_ASSERT(file_hooks->open);
52     
53     return file_hooks->close(file);
54 }
55
56 uint64_t v3_file_size(v3_file_t file) {
57     V3_ASSERT(file_hooks);
58     V3_ASSERT(file_hooks->size);
59     
60     return file_hooks->size(file);
61 }
62
63 uint64_t v3_file_read(v3_file_t file, uint8_t * buf, uint64_t len, uint64_t off) {
64     V3_ASSERT(file_hooks);
65     V3_ASSERT(file_hooks->read);
66     
67     return file_hooks->read(file, buf, len, off);
68 }
69
70
71 uint64_t v3_file_write(v3_file_t file, uint8_t * buf, uint64_t len, uint64_t off) {
72     V3_ASSERT(file_hooks);
73     V3_ASSERT(file_hooks->write);
74     
75     return file_hooks->write(file, buf, len, off);
76 }