block.c (c1e667d2598b9b3ce62b8e89ed22dd38dfe9f57f) block.c (eeea1faa099f82328f5831cf252f8ce0a59a9287)
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

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

595
596 return 0;
597}
598
599static int bdrv_create_file_fallback(const char *filename, BlockDriver *drv,
600 QemuOpts *opts, Error **errp)
601{
602 BlockBackend *blk;
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

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

595
596 return 0;
597}
598
599static int bdrv_create_file_fallback(const char *filename, BlockDriver *drv,
600 QemuOpts *opts, Error **errp)
601{
602 BlockBackend *blk;
603 QDict *options = qdict_new();
603 QDict *options;
604 int64_t size = 0;
605 char *buf = NULL;
606 PreallocMode prealloc;
607 Error *local_err = NULL;
608 int ret;
609
610 size = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0);
611 buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);

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

618 }
619
620 if (prealloc != PREALLOC_MODE_OFF) {
621 error_setg(errp, "Unsupported preallocation mode '%s'",
622 PreallocMode_str(prealloc));
623 return -ENOTSUP;
624 }
625
604 int64_t size = 0;
605 char *buf = NULL;
606 PreallocMode prealloc;
607 Error *local_err = NULL;
608 int ret;
609
610 size = qemu_opt_get_size_del(opts, BLOCK_OPT_SIZE, 0);
611 buf = qemu_opt_get_del(opts, BLOCK_OPT_PREALLOC);

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

618 }
619
620 if (prealloc != PREALLOC_MODE_OFF) {
621 error_setg(errp, "Unsupported preallocation mode '%s'",
622 PreallocMode_str(prealloc));
623 return -ENOTSUP;
624 }
625
626 options = qdict_new();
626 qdict_put_str(options, "driver", drv->format_name);
627
628 blk = blk_new_open(filename, NULL, options,
629 BDRV_O_RDWR | BDRV_O_RESIZE, errp);
630 if (!blk) {
631 error_prepend(errp, "Protocol driver '%s' does not support image "
632 "creation, and opening the image failed: ",
633 drv->format_name);

--- 6097 unchanged lines hidden ---
627 qdict_put_str(options, "driver", drv->format_name);
628
629 blk = blk_new_open(filename, NULL, options,
630 BDRV_O_RDWR | BDRV_O_RESIZE, errp);
631 if (!blk) {
632 error_prepend(errp, "Protocol driver '%s' does not support image "
633 "creation, and opening the image failed: ",
634 drv->format_name);

--- 6097 unchanged lines hidden ---