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.


Avoid strict-aliasing related issues when compiling with optimization
[palacios.git] / linux_usr / v3_stop.c
index b47347d..86e5752 100644 (file)
@@ -2,49 +2,19 @@
  * V3 Control utility
  * (c) Jack lange, 2010
  */
-
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h> 
-#include <sys/ioctl.h> 
-#include <sys/stat.h> 
-#include <sys/types.h> 
-#include <unistd.h> 
-#include <string.h>
 #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 <vm-dev>\n");
-       return -1;
-    }
 
-    printf("Stopping VM\n");
-    
-    vm_fd = open(filename, O_RDONLY);
+    if (argc <= 1)
+        v3_usage("<vm-device>\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; 
 }