Revision 9230eaf6

b/qemu-img.c
25 25
#include "osdep.h"
26 26
#include "block_int.h"
27 27
#include <assert.h>
28
#include <stdio.h>
28 29

  
29 30
#ifdef _WIN32
30 31
#include <windows.h>
......
57 58
           "QEMU disk image utility\n"
58 59
           "\n"
59 60
           "Command syntax:\n"
60
           "  create [-e] [-6] [-b base_image] [-f fmt] filename [size]\n"
61
           "  create [-e] [-6] [-F fmt] [-b base_image] [-f fmt] filename [size]\n"
61 62
           "  commit [-f fmt] filename\n"
62 63
           "  convert [-c] [-e] [-6] [-f fmt] [-O output_fmt] [-B output_base_image] filename [filename2 [...]] output_filename\n"
63 64
           "  info [-f fmt] filename\n"
......
217 218
{
218 219
    int c, ret, flags;
219 220
    const char *fmt = "raw";
221
    const char *base_fmt = NULL;
220 222
    const char *filename;
221 223
    const char *base_filename = NULL;
222 224
    uint64_t size;
......
226 228

  
227 229
    flags = 0;
228 230
    for(;;) {
229
        c = getopt(argc, argv, "b:f:he6");
231
        c = getopt(argc, argv, "F:b:f:he6");
230 232
        if (c == -1)
231 233
            break;
232 234
        switch(c) {
233 235
        case 'h':
234 236
            help();
235 237
            break;
238
        case 'F':
239
            base_fmt = optarg;
240
            break;
236 241
        case 'b':
237 242
            base_filename = optarg;
238 243
            break;
......
253 258
    size = 0;
254 259
    if (base_filename) {
255 260
        BlockDriverState *bs;
256
        bs = bdrv_new_open(base_filename, NULL);
261
        BlockDriver *base_drv = NULL;
262

  
263
        if (base_fmt) {
264
            base_drv = bdrv_find_format(base_fmt);
265
            if (base_drv == NULL)
266
                error("Unknown basefile format '%s'", base_fmt);
267
        }
268

  
269
        bs = bdrv_new_open(base_filename, base_fmt);
257 270
        bdrv_get_geometry(bs, &size);
258 271
        size *= 512;
259 272
        bdrv_delete(bs);
......
284 297
    if (base_filename) {
285 298
        printf(", backing_file=%s",
286 299
               base_filename);
300
         if (base_fmt)
301
             printf(", backing_fmt=%s",
302
                    base_fmt);
287 303
    }
288 304
    printf(", size=%" PRIu64 " kB\n", size / 1024);
289
    ret = bdrv_create(drv, filename, size / 512, base_filename, flags);
305
    ret = bdrv_create2(drv, filename, size / 512, base_filename, base_fmt, flags);
290 306
    if (ret < 0) {
291 307
        if (ret == -ENOTSUP) {
292 308
            error("Formatting or formatting option not supported for file format '%s'", fmt);
b/qemu-img.texi
8 8

  
9 9
The following commands are supported:
10 10
@table @option
11
@item create [-e] [-6] [-b @var{base_image}] [-f @var{fmt}] @var{filename} [@var{size}]
11
@item create [-e] [-6] [-F @var{base_fmt}] [-b @var{base_image}] [-f @var{fmt}] @var{filename} [@var{size}]
12 12
@item commit [-f @var{fmt}] @var{filename}
13 13
@item convert [-c] [-e] [-6] [-f @var{fmt}] [-O @var{output_fmt}] [-B @var{output_base_image}] @var{filename} [@var{filename2} [...]] @var{output_filename}
14 14
@item info [-f @var{fmt}] @var{filename}
......
27 27
image of the specified base image; @code{output_base_image} should have the same
28 28
content as the input's base image, however the path, image format, etc may
29 29
differ
30
@item base_fmt
31
is the disk image format of @var{base_image}. for more information look at @var{fmt}
30 32
@item fmt
31 33
is the disk image format. It is guessed automatically in most cases. The following formats are supported:
32 34

  

Also available in: Unified diff