vdi.c (353a5d84b25c335b259f37c4f43dad96e6d60ba8) | vdi.c (a9262f551eba44d4d0f9e396d7124c059a93e204) |
---|---|
1/* 2 * Block driver for the Virtual Disk Image (VDI) format 3 * 4 * Copyright (c) 2009, 2012 Stefan Weil 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 2 of the License, or --- 831 unchanged lines hidden (view full) --- 840 header.uuid_image = uuid; 841 qemu_uuid_generate(&uuid); 842 header.uuid_last_snap = uuid; 843 /* There is no need to set header.uuid_link or header.uuid_parent here. */ 844 if (VDI_DEBUG) { 845 vdi_header_print(&header); 846 } 847 vdi_header_to_le(&header); | 1/* 2 * Block driver for the Virtual Disk Image (VDI) format 3 * 4 * Copyright (c) 2009, 2012 Stefan Weil 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 2 of the License, or --- 831 unchanged lines hidden (view full) --- 840 header.uuid_image = uuid; 841 qemu_uuid_generate(&uuid); 842 header.uuid_last_snap = uuid; 843 /* There is no need to set header.uuid_link or header.uuid_parent here. */ 844 if (VDI_DEBUG) { 845 vdi_header_print(&header); 846 } 847 vdi_header_to_le(&header); |
848 ret = blk_pwrite(blk, offset, &header, sizeof(header), 0); | 848 ret = blk_pwrite(blk, offset, sizeof(header), &header, 0); |
849 if (ret < 0) { 850 error_setg(errp, "Error writing header"); 851 goto exit; 852 } 853 offset += sizeof(header); 854 855 if (bmap_size > 0) { 856 bmap = g_try_malloc0(bmap_size); --- 4 unchanged lines hidden (view full) --- 861 } 862 for (i = 0; i < blocks; i++) { 863 if (image_type == VDI_TYPE_STATIC) { 864 bmap[i] = i; 865 } else { 866 bmap[i] = VDI_UNALLOCATED; 867 } 868 } | 849 if (ret < 0) { 850 error_setg(errp, "Error writing header"); 851 goto exit; 852 } 853 offset += sizeof(header); 854 855 if (bmap_size > 0) { 856 bmap = g_try_malloc0(bmap_size); --- 4 unchanged lines hidden (view full) --- 861 } 862 for (i = 0; i < blocks; i++) { 863 if (image_type == VDI_TYPE_STATIC) { 864 bmap[i] = i; 865 } else { 866 bmap[i] = VDI_UNALLOCATED; 867 } 868 } |
869 ret = blk_pwrite(blk, offset, bmap, bmap_size, 0); | 869 ret = blk_pwrite(blk, offset, bmap_size, bmap, 0); |
870 if (ret < 0) { 871 error_setg(errp, "Error writing bmap"); 872 goto exit; 873 } 874 offset += bmap_size; 875 } 876 877 if (image_type == VDI_TYPE_STATIC) { --- 188 unchanged lines hidden --- | 870 if (ret < 0) { 871 error_setg(errp, "Error writing bmap"); 872 goto exit; 873 } 874 offset += bmap_size; 875 } 876 877 if (image_type == VDI_TYPE_STATIC) { --- 188 unchanged lines hidden --- |