]> git.proxmox.com Git - qemu.git/blobdiff - qemu-io.c
osdep, kvm: rename low-level RAM allocation functions
[qemu.git] / qemu-io.c
index 163777330263b4d263052db98d33f0f4b3d8c1ed..475a8bd0347a1c037d8b7c33b7beb672ce520dc7 100644 (file)
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -15,8 +15,8 @@
 #include <libgen.h>
 
 #include "qemu-common.h"
-#include "main-loop.h"
-#include "block_int.h"
+#include "qemu/main-loop.h"
+#include "block/block_int.h"
 #include "cmd.h"
 #include "trace/control.h"
 
@@ -1766,14 +1766,14 @@ static int openfile(char *name, int flags, int growable)
     }
 
     if (growable) {
-        if (bdrv_file_open(&bs, name, flags)) {
+        if (bdrv_file_open(&bs, name, NULL, flags)) {
             fprintf(stderr, "%s: can't open device %s\n", progname, name);
             return 1;
         }
     } else {
         bs = bdrv_new("hda");
 
-        if (bdrv_open(bs, name, flags, NULL) < 0) {
+        if (bdrv_open(bs, name, NULL, flags, NULL) < 0) {
             fprintf(stderr, "%s: can't open device %s\n", progname, name);
             bdrv_delete(bs);
             bs = NULL;
@@ -1899,7 +1899,7 @@ int main(int argc, char **argv)
 {
     int readonly = 0;
     int growable = 0;
-    const char *sopt = "hVc:rsnmgkt:T:";
+    const char *sopt = "hVc:d:rsnmgkt:T:";
     const struct option lopt[] = {
         { "help", 0, NULL, 'h' },
         { "version", 0, NULL, 'V' },
@@ -1911,13 +1911,14 @@ int main(int argc, char **argv)
         { "misalign", 0, NULL, 'm' },
         { "growable", 0, NULL, 'g' },
         { "native-aio", 0, NULL, 'k' },
+        { "discard", 1, NULL, 'd' },
         { "cache", 1, NULL, 't' },
         { "trace", 1, NULL, 'T' },
         { NULL, 0, NULL, 0 }
     };
     int c;
     int opt_index = 0;
-    int flags = 0;
+    int flags = BDRV_O_UNMAP;
 
     progname = basename(argv[0]);
 
@@ -1929,6 +1930,12 @@ int main(int argc, char **argv)
         case 'n':
             flags |= BDRV_O_NOCACHE | BDRV_O_CACHE_WB;
             break;
+        case 'd':
+            if (bdrv_parse_discard_flags(optarg, &flags) < 0) {
+                error_report("Invalid discard option: %s", optarg);
+                exit(1);
+            }
+            break;
         case 'c':
             add_user_command(optarg);
             break;