qcow2.c (72daa72eeecb6b2ee06ab7d836ac3aa01ad7e6df) qcow2.c (d34682cd4a06efe9ee3fc8cb7e8a0ea445299989)
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 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

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

713 /* overlap-check defines a template bitmask, but every flag may be
714 * overwritten through the associated boolean option */
715 s->overlap_check |=
716 qemu_opt_get_bool(opts, overlap_bool_option_names[i],
717 overlap_check_template & (1 << i)) << i;
718 }
719
720 qemu_opts_del(opts);
1/*
2 * Block driver for the QCOW version 2 format
3 *
4 * Copyright (c) 2004-2006 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

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

713 /* overlap-check defines a template bitmask, but every flag may be
714 * overwritten through the associated boolean option */
715 s->overlap_check |=
716 qemu_opt_get_bool(opts, overlap_bool_option_names[i],
717 overlap_check_template & (1 << i)) << i;
718 }
719
720 qemu_opts_del(opts);
721 bs->bl.write_zeroes_alignment = s->cluster_sectors;
722
723 if (s->use_lazy_refcounts && s->qcow_version < 3) {
724 error_setg(errp, "Lazy refcounts require a qcow2 image with at least "
725 "qemu 1.1 compatibility level");
726 ret = -EINVAL;
727 goto fail;
728 }
729

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

746 if (s->l2_table_cache) {
747 qcow2_cache_destroy(bs, s->l2_table_cache);
748 }
749 g_free(s->cluster_cache);
750 qemu_vfree(s->cluster_data);
751 return ret;
752}
753
721
722 if (s->use_lazy_refcounts && s->qcow_version < 3) {
723 error_setg(errp, "Lazy refcounts require a qcow2 image with at least "
724 "qemu 1.1 compatibility level");
725 ret = -EINVAL;
726 goto fail;
727 }
728

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

745 if (s->l2_table_cache) {
746 qcow2_cache_destroy(bs, s->l2_table_cache);
747 }
748 g_free(s->cluster_cache);
749 qemu_vfree(s->cluster_data);
750 return ret;
751}
752
753static int qcow2_refresh_limits(BlockDriverState *bs)
754{
755 BDRVQcowState *s = bs->opaque;
756
757 bs->bl.write_zeroes_alignment = s->cluster_sectors;
758
759 return 0;
760}
761
754static int qcow2_set_key(BlockDriverState *bs, const char *key)
755{
756 BDRVQcowState *s = bs->opaque;
757 uint8_t keybuf[16];
758 int len, i;
759
760 memset(keybuf, 0, 16);
761 len = strlen(key);

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

2263 .bdrv_get_info = qcow2_get_info,
2264 .bdrv_get_specific_info = qcow2_get_specific_info,
2265
2266 .bdrv_save_vmstate = qcow2_save_vmstate,
2267 .bdrv_load_vmstate = qcow2_load_vmstate,
2268
2269 .bdrv_change_backing_file = qcow2_change_backing_file,
2270
762static int qcow2_set_key(BlockDriverState *bs, const char *key)
763{
764 BDRVQcowState *s = bs->opaque;
765 uint8_t keybuf[16];
766 int len, i;
767
768 memset(keybuf, 0, 16);
769 len = strlen(key);

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

2271 .bdrv_get_info = qcow2_get_info,
2272 .bdrv_get_specific_info = qcow2_get_specific_info,
2273
2274 .bdrv_save_vmstate = qcow2_save_vmstate,
2275 .bdrv_load_vmstate = qcow2_load_vmstate,
2276
2277 .bdrv_change_backing_file = qcow2_change_backing_file,
2278
2279 .bdrv_refresh_limits = qcow2_refresh_limits,
2271 .bdrv_invalidate_cache = qcow2_invalidate_cache,
2272
2273 .create_options = qcow2_create_options,
2274 .bdrv_check = qcow2_check,
2275 .bdrv_amend_options = qcow2_amend_options,
2276};
2277
2278static void bdrv_qcow2_init(void)
2279{
2280 bdrv_register(&bdrv_qcow2);
2281}
2282
2283block_init(bdrv_qcow2_init);
2280 .bdrv_invalidate_cache = qcow2_invalidate_cache,
2281
2282 .create_options = qcow2_create_options,
2283 .bdrv_check = qcow2_check,
2284 .bdrv_amend_options = qcow2_amend_options,
2285};
2286
2287static void bdrv_qcow2_init(void)
2288{
2289 bdrv_register(&bdrv_qcow2);
2290}
2291
2292block_init(bdrv_qcow2_init);