X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_stop.c;h=86e5752479b8413cc64ca964fda00e7fbd3b1235;hb=2cb41f7db5b9f89113432d6b3daff4807ba8e5f2;hp=061cd2809fd27e5f516542490e96d66e8526df1a;hpb=401f28c04132e4f5ccafc145dcb69b6dee4afe4e;p=palacios.git diff --git a/linux_usr/v3_stop.c b/linux_usr/v3_stop.c index 061cd28..86e5752 100644 --- a/linux_usr/v3_stop.c +++ b/linux_usr/v3_stop.c @@ -2,52 +2,19 @@ * V3 Control utility * (c) Jack lange, 2010 */ - - -#include -#include -#include -#include -#include -#include -#include -#include - #include "v3_ctrl.h" -int read_file(int fd, int size, unsigned char * buf); - int main(int argc, char* argv[]) { - int vm_fd = 0; - unsigned long vm_idx = 0; + char * filename = argv[1]; + if (argc <= 1) + v3_usage("\n"); - if (argc <= 1) { - printf("Usage: ./v3_stop \n"); - return -1; + if (stop_vm(filename) < 0) { + fprintf(stderr, "Error stopping VM (%s)\n", filename); + return -1; } - - vm_idx = atoi(argv[1]); - - printf("Stopping VM\n"); - - vm_fd = open("/dev/v3vee", O_RDONLY); - - if (vm_fd == -1) { - printf("Error opening V3Vee VM device\n"); - return -1; - } - - ioctl(vm_fd, V3_STOP_GUEST, vm_idx); - - - - /* Close the file descriptor. */ - close(vm_fd); - - - return 0; }