X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_stop.c;h=86e5752479b8413cc64ca964fda00e7fbd3b1235;hb=85d6d460b40c389b0b1b619313d596ab57323829;hp=b47347d6c5c17f76d131feca78983b953eb2015a;hpb=4801e692b7344051eb94fff6faf1be53f621d422;p=palacios.git diff --git a/linux_usr/v3_stop.c b/linux_usr/v3_stop.c index b47347d..86e5752 100644 --- a/linux_usr/v3_stop.c +++ b/linux_usr/v3_stop.c @@ -2,49 +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[]) { char * filename = argv[1]; - int vm_fd = 0; - - - if (argc <= 1) { - printf("Usage: ./v3_stop \n"); - return -1; - } - printf("Stopping VM\n"); - - vm_fd = open(filename, O_RDONLY); + if (argc <= 1) + v3_usage("\n"); - if (vm_fd == -1) { - printf("Error opening V3Vee VM device\n"); - return -1; + if (stop_vm(filename) < 0) { + fprintf(stderr, "Error stopping VM (%s)\n", filename); + return -1; } - ioctl(vm_fd, V3_VM_STOP, NULL); - - - - /* Close the file descriptor. */ - close(vm_fd); - - - return 0; }