Date: Thu, 26 Jun 2014 04:04:53 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r267894 - user/marcel/mkimg Message-ID: <201406260404.s5Q44sfZ033724@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406260404.s5Q44sfZ033724>