qemu-img.c (83d0521a1e35989b0cb7235aef48455fedda3ca4) | qemu-img.c (c282e1fdf7ec9659c7f320123be397477a359d01) |
---|---|
1/* 2 * QEMU disk image utility 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 266 unchanged lines hidden (view full) --- 275 276 /* Find driver and parse its options */ 277 drv = bdrv_find_format(fmt); 278 if (!drv) { 279 error_report("Unknown file format '%s'", fmt); 280 return 1; 281 } 282 | 1/* 2 * QEMU disk image utility 3 * 4 * Copyright (c) 2003-2008 Fabrice Bellard 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to deal 8 * in the Software without restriction, including without limitation the rights --- 266 unchanged lines hidden (view full) --- 275 276 /* Find driver and parse its options */ 277 drv = bdrv_find_format(fmt); 278 if (!drv) { 279 error_report("Unknown file format '%s'", fmt); 280 return 1; 281 } 282 |
283 create_opts = qemu_opts_append(create_opts, drv->create_opts, 284 drv->create_options); | 283 create_opts = qemu_opts_append(create_opts, drv->create_opts); |
285 if (filename) { 286 proto_drv = bdrv_find_protocol(filename, true); 287 if (!proto_drv) { 288 error_report("Unknown protocol '%s'", filename); 289 qemu_opts_free(create_opts); 290 return 1; 291 } | 284 if (filename) { 285 proto_drv = bdrv_find_protocol(filename, true); 286 if (!proto_drv) { 287 error_report("Unknown protocol '%s'", filename); 288 qemu_opts_free(create_opts); 289 return 1; 290 } |
292 create_opts = qemu_opts_append(create_opts, proto_drv->create_opts, 293 proto_drv->create_options); | 291 create_opts = qemu_opts_append(create_opts, proto_drv->create_opts); |
294 } 295 296 qemu_opts_print_help(create_opts); 297 qemu_opts_free(create_opts); 298 return 0; 299} 300 301static BlockDriverState *bdrv_new_open(const char *id, --- 1074 unchanged lines hidden (view full) --- 1376 1377 proto_drv = bdrv_find_protocol(out_filename, true); 1378 if (!proto_drv) { 1379 error_report("Unknown protocol '%s'", out_filename); 1380 ret = -1; 1381 goto out; 1382 } 1383 | 292 } 293 294 qemu_opts_print_help(create_opts); 295 qemu_opts_free(create_opts); 296 return 0; 297} 298 299static BlockDriverState *bdrv_new_open(const char *id, --- 1074 unchanged lines hidden (view full) --- 1374 1375 proto_drv = bdrv_find_protocol(out_filename, true); 1376 if (!proto_drv) { 1377 error_report("Unknown protocol '%s'", out_filename); 1378 ret = -1; 1379 goto out; 1380 } 1381 |
1384 create_opts = qemu_opts_append(create_opts, drv->create_opts, 1385 drv->create_options); 1386 create_opts = qemu_opts_append(create_opts, proto_drv->create_opts, 1387 proto_drv->create_options); | 1382 create_opts = qemu_opts_append(create_opts, drv->create_opts); 1383 create_opts = qemu_opts_append(create_opts, proto_drv->create_opts); |
1388 1389 opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); 1390 if (options && qemu_opts_do_parse(opts, options, NULL)) { 1391 error_report("Invalid options for file format '%s'", out_fmt); 1392 ret = -1; 1393 goto out; 1394 } 1395 --- 36 unchanged lines hidden (view full) --- 1432 "the same time"); 1433 ret = -1; 1434 goto out; 1435 } 1436 } 1437 1438 if (!skip_create) { 1439 /* Create the new image */ | 1384 1385 opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); 1386 if (options && qemu_opts_do_parse(opts, options, NULL)) { 1387 error_report("Invalid options for file format '%s'", out_fmt); 1388 ret = -1; 1389 goto out; 1390 } 1391 --- 36 unchanged lines hidden (view full) --- 1428 "the same time"); 1429 ret = -1; 1430 goto out; 1431 } 1432 } 1433 1434 if (!skip_create) { 1435 /* Create the new image */ |
1440 ret = bdrv_create(drv, out_filename, NULL, opts, &local_err); | 1436 ret = bdrv_create(drv, out_filename, opts, &local_err); |
1441 if (ret < 0) { 1442 error_report("%s: error while converting %s: %s", 1443 out_filename, out_fmt, error_get_pretty(local_err)); 1444 error_free(local_err); 1445 goto out; 1446 } 1447 } 1448 --- 1312 unchanged lines hidden (view full) --- 2761 fmt = bs->drv->format_name; 2762 2763 if (has_help_option(options)) { 2764 /* If the format was auto-detected, print option help here */ 2765 ret = print_block_option_help(filename, fmt); 2766 goto out; 2767 } 2768 | 1437 if (ret < 0) { 1438 error_report("%s: error while converting %s: %s", 1439 out_filename, out_fmt, error_get_pretty(local_err)); 1440 error_free(local_err); 1441 goto out; 1442 } 1443 } 1444 --- 1312 unchanged lines hidden (view full) --- 2757 fmt = bs->drv->format_name; 2758 2759 if (has_help_option(options)) { 2760 /* If the format was auto-detected, print option help here */ 2761 ret = print_block_option_help(filename, fmt); 2762 goto out; 2763 } 2764 |
2769 create_opts = qemu_opts_append(create_opts, bs->drv->create_opts, 2770 bs->drv->create_options); | 2765 create_opts = qemu_opts_append(create_opts, bs->drv->create_opts); |
2771 opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); 2772 if (options && qemu_opts_do_parse(opts, options, NULL)) { 2773 error_report("Invalid options for file format '%s'", fmt); 2774 ret = -1; 2775 goto out; 2776 } 2777 | 2766 opts = qemu_opts_create(create_opts, NULL, 0, &error_abort); 2767 if (options && qemu_opts_do_parse(opts, options, NULL)) { 2768 error_report("Invalid options for file format '%s'", fmt); 2769 ret = -1; 2770 goto out; 2771 } 2772 |
2778 ret = bdrv_amend_options(bs, NULL, opts); | 2773 ret = bdrv_amend_options(bs, opts); |
2779 if (ret < 0) { 2780 error_report("Error while amending options: %s", strerror(-ret)); 2781 goto out; 2782 } 2783 2784out: 2785 if (bs) { 2786 bdrv_unref(bs); --- 65 unchanged lines hidden --- | 2774 if (ret < 0) { 2775 error_report("Error while amending options: %s", strerror(-ret)); 2776 goto out; 2777 } 2778 2779out: 2780 if (bs) { 2781 bdrv_unref(bs); --- 65 unchanged lines hidden --- |