2 * V3 checkpoint save utility
11 #include <sys/types.h>
17 #include<linux/unistd.h>
24 #define MAX_STORE_LEN 128
25 #define MAX_URL_LEN 256
28 struct v3_chkpt_info chkpt;
30 int main(int argc, char* argv[]) {
37 printf("usage: v3_save <vm_device> <store> <url> [optionmask]\n");
38 printf(" optionmask consists of the sum of any of the following\n");
40 printf(" 1 skip memory\n");
41 printf(" 2 skip devices\n");
42 printf(" 4 skip cores\n");
43 printf(" 8 skip architecture-specific core state\n");
49 if (strlen(argv[2]) >= MAX_STORE_LEN) {
50 printf("ERROR: Checkpoint store name longer than maximum size (%d)\n", MAX_STORE_LEN);
54 strncpy(chkpt.store, argv[2], MAX_STORE_LEN);
56 if (strlen(argv[3]) >= MAX_URL_LEN) {
57 printf("ERROR: Checkpoint URL longer than maximum size (%d)\n", MAX_URL_LEN);
61 strncpy(chkpt.url, argv[3], MAX_URL_LEN);
64 chkpt.opts = atoll(argv[4]);
66 chkpt.opts = V3_CHKPT_OPT_NONE;
70 vm_fd = open(vm_dev, O_RDONLY);
72 printf("Error opening VM device: %s\n", vm_dev);
76 ioctl(vm_fd, V3_VM_SAVE, &chkpt);
78 /* Close the file descriptor. */