As it appears the image must be rounded to the nearest megabyte,

This commit is contained in:
marcel 2014-05-15 03:18:22 +00:00
parent 20d78d563e
commit 2257ed47a7

3
vmdk.c
View File

@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
#include "format.h" #include "format.h"
#include "mkimg.h" #include "mkimg.h"
#define VMDK_IMAGE_ROUND 1048576
#define VMDK_MIN_GRAIN_SIZE 8192 #define VMDK_MIN_GRAIN_SIZE 8192
#define VMDK_SECTOR_SIZE 512 #define VMDK_SECTOR_SIZE 512
@ -95,8 +96,8 @@ vmdk_resize(lba_t imgsz)
uint64_t imagesz; uint64_t imagesz;
imagesz = imgsz * secsz; imagesz = imgsz * secsz;
imagesz = (imagesz + VMDK_IMAGE_ROUND - 1) & ~(VMDK_IMAGE_ROUND - 1);
grainsz = (blksz < VMDK_MIN_GRAIN_SIZE) ? VMDK_MIN_GRAIN_SIZE : blksz; grainsz = (blksz < VMDK_MIN_GRAIN_SIZE) ? VMDK_MIN_GRAIN_SIZE : blksz;
imagesz = (imagesz + grainsz - 1) & ~(grainsz - 1);
if (verbose) if (verbose)
fprintf(stderr, "VMDK: image size = %ju, grain size = %ju\n", fprintf(stderr, "VMDK: image size = %ju, grain size = %ju\n",