Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 235219 | Differences between
and this patch

Collapse All | Expand All

(-)file_not_specified_in_diff (-13 / +64 lines)
Line  Link Here
0
-- qemu-0.9.0/monitor.c
0
++ qemu-0.9.0/monitor.c
Lines 362-370 static void do_eject(int force, const char *filename) Link Here
362
    eject_device(bs, force);
362
    eject_device(bs, force);
363
}
363
}
364
364
365
static void do_change(const char *device, const char *filename)
365
static void do_change(const char *device, const char *filename, const char *fmt)
366
{
366
{
367
    BlockDriverState *bs;
367
    BlockDriverState *bs;
368
    BlockDriver *drv = NULL;
368
    int i;
369
    int i;
369
    char password[256];
370
    char password[256];
370
371
Lines 373-381 static void do_change(const char *device, const char *filename) Link Here
373
        term_printf("device not found\n");
374
        term_printf("device not found\n");
374
        return;
375
        return;
375
    }
376
    }
377
    if (fmt) {
378
        drv = bdrv_find_format(fmt);
379
        if (!drv) {
380
            term_printf("invalid format %s\n", fmt);
381
            return;
382
        }
383
    }
376
    if (eject_device(bs, 0) < 0)
384
    if (eject_device(bs, 0) < 0)
377
        return;
385
        return;
378
    bdrv_open(bs, filename, 0);
386
    bdrv_open2(bs, filename, 0, drv);
379
    if (bdrv_is_encrypted(bs)) {
387
    if (bdrv_is_encrypted(bs)) {
380
        term_printf("%s is encrypted.\n", device);
388
        term_printf("%s is encrypted.\n", device);
381
        for(i = 0; i < 3; i++) {
389
        for(i = 0; i < 3; i++) {
Lines 1195-1202 static term_cmd_t term_cmds[] = { Link Here
1195
      "", "quit the emulator" },
1203
      "", "quit the emulator" },
1196
    { "eject", "-fB", do_eject,
1204
    { "eject", "-fB", do_eject,
1197
      "[-f] device", "eject a removable media (use -f to force it)" },
1205
      "[-f] device", "eject a removable media (use -f to force it)" },
1198
    { "change", "BF", do_change,
1206
    { "change", "BFs?", do_change,
1199
      "device filename", "change a removable media" },
1207
      "device filename [format]", "change a removable media, optional format" },
1200
    { "screendump", "F", do_screen_dump, 
1208
    { "screendump", "F", do_screen_dump, 
1201
      "filename", "save screen into PPM image 'filename'" },
1209
      "filename", "save screen into PPM image 'filename'" },
1202
    { "log", "s", do_log,
1210
    { "log", "s", do_log,
1203
-- qemu-0.9.0/hw/usb-msd.c
1211
++ qemu-0.9.0/hw/usb-msd.c
Lines 510-526 static void usb_msd_handle_destroy(USBDevice *dev) Link Here
510
    qemu_free(s);
510
    qemu_free(s);
511
}
511
}
512
512
513
USBDevice *usb_msd_init(const char *filename)
513
USBDevice *usb_msd_init(const char *filename, const char *fmt)
514
{
514
{
515
    MSDState *s;
515
    MSDState *s;
516
    BlockDriverState *bdrv;
516
    BlockDriverState *bdrv;
517
    BlockDriver *drv = NULL;
517
518
519
    if (fmt) {
520
        drv = bdrv_find_format(fmt);
521
        if (!drv) {
522
            fprintf(stderr, "%s: '%s' invalid format\n", __func__, fmt);
523
            return NULL;
524
        }
525
    }
518
    s = qemu_mallocz(sizeof(MSDState));
526
    s = qemu_mallocz(sizeof(MSDState));
519
    if (!s)
527
    if (!s)
520
        return NULL;
528
        return NULL;
521
529
522
    bdrv = bdrv_new("usb");
530
    bdrv = bdrv_new("usb");
523
    if (bdrv_open(bdrv, filename, 0) < 0)
531
    if (bdrv_open2(bdrv, filename, 0, drv) < 0)
524
        goto fail;
532
        goto fail;
525
    s->bs = bdrv;
533
    s->bs = bdrv;
526
534
527
-- qemu-0.9.0/hw/usb.h
535
++ qemu-0.9.0/hw/usb.h
Lines 217-220 USBDevice *usb_mouse_init(void); Link Here
217
USBDevice *usb_tablet_init(void);
217
USBDevice *usb_tablet_init(void);
218
218
219
/* usb-msd.c */
219
/* usb-msd.c */
220
USBDevice *usb_msd_init(const char *filename);
220
USBDevice *usb_msd_init(const char *filename, const char *fmt);
221
-- qemu-0.9.0/qemu-doc.texi
221
++ qemu-0.9.0/qemu-doc.texi
Lines 1306-1311 This means qemu is able to report the mouse position without having Link Here
1306
to grab the mouse.  Also overrides the PS/2 mouse emulation when activated.
1306
to grab the mouse.  Also overrides the PS/2 mouse emulation when activated.
1307
@item @code{disk:file}
1307
@item @code{disk:file}
1308
Mass storage device based on @var{file} (@pxref{disk_images})
1308
Mass storage device based on @var{file} (@pxref{disk_images})
1309
@item diskformat:file,format=@var{format}
1310
Mass storage device based on file with specified image @var{format}.
1311
See -format for more information.
1309
@item @code{host:bus.addr}
1312
@item @code{host:bus.addr}
1310
Pass through the host device identified by @var{bus.addr}
1313
Pass through the host device identified by @var{bus.addr}
1311
(Linux only)
1314
(Linux only)
1312
-- qemu-0.9.0/vl.c
1315
++ qemu-0.9.0/vl.c
Lines 3951-3956 void qemu_register_usb_port(USBPort *port, void *opaque, int index, Link Here
3951
    free_usb_ports = port;
3951
    free_usb_ports = port;
3952
}
3952
}
3953
3953
3954
static const char *get_opt_value(char *buf, int buf_size, const char *p)
3955
{
3956
    char *q;
3957
3958
    q = buf;
3959
    while (*p != '\0') {
3960
        if (*p == ',') {
3961
            if (*(p + 1) != ',')
3962
                break;
3963
            p++;
3964
        }
3965
        if (q && (q - buf) < buf_size - 1)
3966
            *q++ = *p;
3967
        p++;
3968
    }
3969
    if (q)
3970
        *q = '\0';
3971
3972
    return p;
3973
}
3974
3954
static int usb_device_add(const char *devname)
3975
static int usb_device_add(const char *devname)
3955
{
3976
{
3956
    const char *p;
3977
    const char *p;
Lines 3967-3973 static int usb_device_add(const char *devname) Link Here
3967
    } else if (!strcmp(devname, "tablet")) {
3967
    } else if (!strcmp(devname, "tablet")) {
3968
	dev = usb_tablet_init();
3968
	dev = usb_tablet_init();
3969
    } else if (strstart(devname, "disk:", &p)) {
3969
    } else if (strstart(devname, "disk:", &p)) {
3970
        dev = usb_msd_init(p);
3970
        dev = usb_msd_init(p, NULL);
3971
    } else if (strstart(devname, "diskformat:", &p)) {
3972
        char file[1024];
3973
        char buf[128];
3974
        char *fmt = NULL;
3975
        p = get_opt_value(file, sizeof(file), p);
3976
        if (*p == ',') {
3977
            p++;
3978
            if (get_param_value(buf, sizeof(buf), "format", p))
3979
                fmt = buf;
3980
        }
3981
        dev = usb_msd_init(file, fmt);
3971
    } else {
3982
    } else {
3972
        return -1;
3983
        return -1;
3973
    }
3984
    }

Return to bug 235219