block.c (a5c2a235103ab366ad5318636ec138e52c6dcfa4) block.c (f6dc1c31d3801dcbdf0c56574f9ff4f05180810c)
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 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

--- 5737 unchanged lines hidden (view full) ---

5746 }
5747
5748 if (!proto_drv->create_opts) {
5749 error_setg(errp, "Protocol driver '%s' does not support image creation",
5750 proto_drv->format_name);
5751 return;
5752 }
5753
1/*
2 * QEMU System Emulator block driver
3 *
4 * Copyright (c) 2003 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

--- 5737 unchanged lines hidden (view full) ---

5746 }
5747
5748 if (!proto_drv->create_opts) {
5749 error_setg(errp, "Protocol driver '%s' does not support image creation",
5750 proto_drv->format_name);
5751 return;
5752 }
5753
5754 /* Create parameter list */
5754 create_opts = qemu_opts_append(create_opts, drv->create_opts);
5755 create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
5756
5755 create_opts = qemu_opts_append(create_opts, drv->create_opts);
5756 create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);
5757
5757 /* Create parameter list with default values */
5758 opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
5758 opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
5759 qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort);
5760
5761 /* Parse -o options */
5762 if (options) {
5763 qemu_opts_do_parse(opts, options, NULL, &local_err);
5764 if (local_err) {
5765 goto out;
5766 }
5767 }
5768
5759
5760 /* Parse -o options */
5761 if (options) {
5762 qemu_opts_do_parse(opts, options, NULL, &local_err);
5763 if (local_err) {
5764 goto out;
5765 }
5766 }
5767
5768 if (!qemu_opt_get(opts, BLOCK_OPT_SIZE)) {
5769 qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort);
5770 } else if (img_size != UINT64_C(-1)) {
5771 error_setg(errp, "The image size must be specified only once");
5772 goto out;
5773 }
5774
5769 if (base_filename) {
5770 qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &local_err);
5771 if (local_err) {
5772 error_setg(errp, "Backing file not supported for file format '%s'",
5773 fmt);
5774 goto out;
5775 }
5776 }

--- 795 unchanged lines hidden ---
5775 if (base_filename) {
5776 qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &local_err);
5777 if (local_err) {
5778 error_setg(errp, "Backing file not supported for file format '%s'",
5779 fmt);
5780 goto out;
5781 }
5782 }

--- 795 unchanged lines hidden ---