parallels.c (229c0372cf3ca201c41d2bb121627e6752e776ad) | parallels.c (7fb1cf1606c78c9d5b538f29176fd5a101726a9d) |
---|---|
1/* 2 * Block driver for Parallels disk image format 3 * 4 * Copyright (c) 2007 Alex Beregszaszi 5 * Copyright (c) 2015 Denis V. Lunev <den@openvz.org> 6 * 7 * This code was originally based on comparing different disk images created 8 * by Parallels. Currently it is based on opened OpenVZ sources --- 47 unchanged lines hidden (view full) --- 56 uint32_t data_off; 57 char padding[12]; 58} QEMU_PACKED ParallelsHeader; 59 60 61typedef enum ParallelsPreallocMode { 62 PRL_PREALLOC_MODE_FALLOCATE = 0, 63 PRL_PREALLOC_MODE_TRUNCATE = 1, | 1/* 2 * Block driver for Parallels disk image format 3 * 4 * Copyright (c) 2007 Alex Beregszaszi 5 * Copyright (c) 2015 Denis V. Lunev <den@openvz.org> 6 * 7 * This code was originally based on comparing different disk images created 8 * by Parallels. Currently it is based on opened OpenVZ sources --- 47 unchanged lines hidden (view full) --- 56 uint32_t data_off; 57 char padding[12]; 58} QEMU_PACKED ParallelsHeader; 59 60 61typedef enum ParallelsPreallocMode { 62 PRL_PREALLOC_MODE_FALLOCATE = 0, 63 PRL_PREALLOC_MODE_TRUNCATE = 1, |
64 PRL_PREALLOC_MODE_MAX = 2, | 64 PRL_PREALLOC_MODE__MAX = 2, |
65} ParallelsPreallocMode; 66 67static const char *prealloc_mode_lookup[] = { 68 "falloc", 69 "truncate", 70 NULL, 71}; 72 --- 582 unchanged lines hidden (view full) --- 655 goto fail_options; 656 } 657 658 s->prealloc_size = 659 qemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0); 660 s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS); 661 buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE); 662 s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf, | 65} ParallelsPreallocMode; 66 67static const char *prealloc_mode_lookup[] = { 68 "falloc", 69 "truncate", 70 NULL, 71}; 72 --- 582 unchanged lines hidden (view full) --- 655 goto fail_options; 656 } 657 658 s->prealloc_size = 659 qemu_opt_get_size_del(opts, PARALLELS_OPT_PREALLOC_SIZE, 0); 660 s->prealloc_size = MAX(s->tracks, s->prealloc_size >> BDRV_SECTOR_BITS); 661 buf = qemu_opt_get_del(opts, PARALLELS_OPT_PREALLOC_MODE); 662 s->prealloc_mode = qapi_enum_parse(prealloc_mode_lookup, buf, |
663 PRL_PREALLOC_MODE_MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err); | 663 PRL_PREALLOC_MODE__MAX, PRL_PREALLOC_MODE_FALLOCATE, &local_err); |
664 g_free(buf); 665 if (local_err != NULL) { 666 goto fail_options; 667 } 668 if (!bdrv_has_zero_init(bs->file->bs) || 669 bdrv_truncate(bs->file->bs, bdrv_getlength(bs->file->bs)) != 0) { 670 s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE; 671 } --- 89 unchanged lines hidden --- | 664 g_free(buf); 665 if (local_err != NULL) { 666 goto fail_options; 667 } 668 if (!bdrv_has_zero_init(bs->file->bs) || 669 bdrv_truncate(bs->file->bs, bdrv_getlength(bs->file->bs)) != 0) { 670 s->prealloc_mode = PRL_PREALLOC_MODE_FALLOCATE; 671 } --- 89 unchanged lines hidden --- |