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.


Small fixes in v3_free.c
[palacios.git] / linux_usr / v3_free.c
1 /* 
2  * V3 Control utility
3  * (c) Jack lange, 2011
4  */
5
6
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <fcntl.h> 
10 #include <sys/ioctl.h> 
11 #include <sys/stat.h> 
12 #include <sys/types.h> 
13 #include <unistd.h> 
14 #include <string.h>
15  
16 #include "v3_ctrl.h"
17
18 int main(int argc, char* argv[]) {
19     int vm_fd = 0;
20     unsigned long vm_idx = 0;
21     int ret;
22
23
24     if (argc <= 1) {
25         printf("usage: v3_free <vm-dev-idx>\n");
26         return -1;
27     }
28
29
30     vm_idx = strtol(argv[1], NULL, 0);
31
32     printf("Freeing VM %d\n", vm_idx);
33     
34     vm_fd = open("/dev/v3vee", O_RDONLY);
35
36     if (vm_fd == -1) {
37         printf("Error opening V3Vee VM device\n");
38         return -1;
39     }
40
41     ret = ioctl(vm_fd, V3_FREE_GUEST, vm_idx); 
42     if (ret < 0) {
43         printf("Error freeing VM %d\n", vm_idx);
44         return -1;
45     }
46
47     /* Close the file descriptor.  */ 
48     close(vm_fd); 
49
50     return 0; 
51
52
53