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.


hooked checkpoint code up to the linux module and added user space tools
[palacios.git] / linux_usr / v3_save.c
1 /* 
2  * V3 checkpoint save utility
3  */
4
5
6 #include <stdio.h>
7 #include <stdlib.h>
8 #include <fcntl.h> 
9 #include <sys/ioctl.h> 
10 #include <sys/stat.h> 
11 #include <sys/types.h> 
12 #include <unistd.h>
13 #include <string.h>
14 #include <fcntl.h>
15 #include <pthread.h>
16 #include <errno.h>
17 #include<linux/unistd.h>
18 #include <curses.h>
19
20
21 #include "v3_ctrl.h"
22
23
24 #define MAX_STORE_LEN 128
25 #define MAX_URL_LEN 256
26
27
28 struct v3_chkpt_info chkpt;
29
30 int main(int argc, char* argv[]) {
31     int vm_fd;
32     char * vm_dev = NULL;
33
34     if (argc < 4) {
35         printf("Usage: ./v3_save <vm_device> <store> <url>\n");
36         return -1;
37     }
38
39     vm_dev = argv[1];
40
41     if (strlen(argv[2]) >= MAX_STORE_LEN) {
42         printf("ERROR: Checkpoint store name longer than maximum size (%d)\n", MAX_STORE_LEN);
43         return -1;
44     }
45
46     strncpy(chkpt.store, argv[2], MAX_STORE_LEN);
47
48
49     if (strlen(argv[3]) >= MAX_URL_LEN) {
50         printf("ERROR: Checkpoint URL longer than maximum size (%d)\n", MAX_URL_LEN);
51         return -1;
52     }
53
54     strncpy(chkpt.url, argv[3], MAX_URL_LEN);
55
56     vm_fd = open(vm_dev, O_RDONLY);
57     if (vm_fd == -1) {
58         printf("Error opening VM device: %s\n", vm_dev);
59         return -1;
60     }
61
62     ioctl(vm_fd, V3_VM_SAVE, &chkpt); 
63
64     /* Close the file descriptor.  */ 
65     close(vm_fd);
66  
67     return 0; 
68 }
69
70