svn commit: r267894 - user/marcel/mkimg
Marcel Moolenaar
marcel at FreeBSD.org
Thu Jun 26 04:04:54 UTC 2014
Author: marcel
Date: Thu Jun 26 04:04:53 2014
New Revision: 267894
URL: http://svnweb.freebsd.org/changeset/base/267894
Log:
Implement vhd_resize(): we round to a multiple of the block size,
which is 4096 sectors per block or 2M bytes per block.
Modified:
user/marcel/mkimg/vhd.c
Modified: user/marcel/mkimg/vhd.c
==============================================================================
--- user/marcel/mkimg/vhd.c Thu Jun 26 03:28:47 2014 (r267893)
+++ user/marcel/mkimg/vhd.c Thu Jun 26 04:04:53 2014 (r267894)
@@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$");
* o The timestamp is seconds since 1/1/2000 12:00:00 AM UTC
*/
+#define VHD_BLOCK_SIZE 4096 /* 2MB blocks */
+
struct vhd_footer {
char cookie[8];
#define VHD_COOKIE_MICROSOFT "conectix"
@@ -114,10 +116,12 @@ struct vhd_dyn_header {
_Static_assert(sizeof(struct vhd_dyn_header) == 1024, "Wrong size for header");
static int
-vhd_resize(lba_t imgsz __unused)
+vhd_resize(lba_t imgsz)
{
- return (0);
+ /* Round to a multiple of the block size. */
+ imgsz = (imgsz + VHD_BLOCK_SIZE - 1) & ~(VHD_BLOCK_SIZE - 1);
+ return (image_set_size(imgsz));
}
static int
More information about the svn-src-user
mailing list