X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_usr%2Fv3_stop.c;h=86e5752479b8413cc64ca964fda00e7fbd3b1235;hb=4e43946f01f687361197dc9571b7df02ae20de30;hp=adb69b1ce23852972a87573cce4db10dadca3717;hpb=035ac752dc4e0eda744205896a9c7c92689bea42;p=palacios.git diff --git a/linux_usr/v3_stop.c b/linux_usr/v3_stop.c index adb69b1..86e5752 100644 --- a/linux_usr/v3_stop.c +++ b/linux_usr/v3_stop.c @@ -2,46 +2,19 @@ * V3 Control utility * (c) Jack lange, 2010 */ - - -#include -#include -#include -#include -#include -#include -#include -#include - #include "v3_ctrl.h" int main(int argc, char* argv[]) { - int vm_fd = 0; char * filename = argv[1]; - if (argc <= 1) { - printf("usage: v3_stop \n"); - return -1; - } + if (argc <= 1) + v3_usage("\n"); - printf("Stopping VM (%s)\n", filename); - - vm_fd = open(filename, O_RDONLY); - - 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; }