Revision 20caf0f7

b/qemu-img.c
1567 1567
    const char *filename, *fmt, *size;
1568 1568
    int64_t n, total_size;
1569 1569
    BlockDriverState *bs = NULL;
1570
    QEMUOptionParameter *param;
1571
    QEMUOptionParameter resize_options[] = {
1572
        {
1573
            .name = BLOCK_OPT_SIZE,
1574
            .type = OPT_SIZE,
1575
            .help = "Virtual disk size"
1570
    QemuOpts *param;
1571
    static QemuOptsList resize_options = {
1572
        .name = "resize_options",
1573
        .head = QTAILQ_HEAD_INITIALIZER(resize_options.head),
1574
        .desc = {
1575
            {
1576
                .name = BLOCK_OPT_SIZE,
1577
                .type = QEMU_OPT_SIZE,
1578
                .help = "Virtual disk size"
1579
            }, {
1580
                /* end of list */
1581
            }
1576 1582
        },
1577
        { NULL }
1578 1583
    };
1579 1584

  
1580 1585
    /* Remove size from argv manually so that negative numbers are not treated
......
1624 1629
    }
1625 1630

  
1626 1631
    /* Parse size */
1627
    param = parse_option_parameters("", resize_options, NULL);
1628
    if (set_option_parameter(param, BLOCK_OPT_SIZE, size)) {
1632
    param = qemu_opts_create(&resize_options, NULL, 0, NULL);
1633
    if (qemu_opt_set(param, BLOCK_OPT_SIZE, size)) {
1629 1634
        /* Error message already printed when size parsing fails */
1630 1635
        ret = -1;
1636
        qemu_opts_del(param);
1631 1637
        goto out;
1632 1638
    }
1633
    n = get_option_parameter(param, BLOCK_OPT_SIZE)->value.n;
1634
    free_option_parameters(param);
1639
    n = qemu_opt_get_size(param, BLOCK_OPT_SIZE, 0);
1640
    qemu_opts_del(param);
1635 1641

  
1636 1642
    bs = bdrv_new_open(filename, fmt, BDRV_O_FLAGS | BDRV_O_RDWR);
1637 1643
    if (!bs) {

Also available in: Unified diff