Revision 334c0241

b/hw/usb-msd.c
517 517
{
518 518
    MSDState *s;
519 519
    BlockDriverState *bdrv;
520
    BlockDriver *drv = NULL;
521
    const char *p1;
522
    char fmt[32];
523

  
524
    p1 = strchr(filename, ':');
525
    if (p1++) {
526
        const char *p2;
527

  
528
        if (strstart(filename, "format=", &p2)) {
529
            int len = MIN(p1 - p2, sizeof(fmt));
530
            pstrcpy(fmt, len, p2);
531

  
532
            drv = bdrv_find_format(fmt);
533
            if (!drv) {
534
                printf("invalid format %s\n", fmt);
535
                return NULL;
536
            }
537
        } else if (*filename != ':') {
538
            printf("unrecognized USB mass-storage option %s\n", filename);
539
            return NULL;
540
        }
541

  
542
        filename = p1;
543
    }
544

  
545
    if (!*filename) {
546
        printf("block device specification needed\n");
547
        return NULL;
548
    }
520 549

  
521 550
    s = qemu_mallocz(sizeof(MSDState));
522 551
    if (!s)
523 552
        return NULL;
524 553

  
525 554
    bdrv = bdrv_new("usb");
526
    if (bdrv_open(bdrv, filename, 0) < 0)
555
    if (bdrv_open2(bdrv, filename, 0, drv) < 0)
527 556
        goto fail;
528 557
    if (qemu_key_check(bdrv, filename))
529 558
        goto fail;
b/qemu-doc.texi
550 550
means qemu is able to report the mouse position without having to grab the
551 551
mouse. Also overrides the PS/2 mouse emulation when activated.
552 552

  
553
@item disk:file
554
Mass storage device based on file
553
@item disk:[format=@var{format}]:file
554
Mass storage device based on file. The optional @var{format} argument
555
will be used rather than detecting the format. Can be used to specifiy
556
format=raw to avoid interpreting an untrusted format header.
555 557

  
556 558
@item host:bus.addr
557 559
Pass through the host device identified by bus.addr (Linux only).

Also available in: Unified diff