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.


userspace changes to break apart VM lifecycle management
[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
22
23     if (argc <= 1) {
24         printf("Usage: ./v3_free <vm-dev-idx>\n");
25         return -1;
26     }
27
28
29     vm_idx = atoi(argv[1]);
30
31     printf("Freeing VM %d\n", vm_idx);
32     
33     vm_fd = open("/dev/v3vee", O_RDONLY);
34
35     if (vm_fd == -1) {
36         printf("Error opening V3Vee VM device\n");
37         return -1;
38     }
39
40     ioctl(vm_fd, V3_FREE_GUEST, vm_idx); 
41
42
43
44     /* Close the file descriptor.  */ 
45     close(vm_fd); 
46  
47
48
49     return 0; 
50
51
52