Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 May 2014 00:48:06 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r266100 - user/marcel/mkimg
Message-ID:  <201405150048.s4F0m6p8054548@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Thu May 15 00:48:05 2014
New Revision: 266100
URL: http://svnweb.freebsd.org/changeset/base/266100

Log:
  Have the format resize twice. The first time is before we call
  scheme_write(). The second time is immediately before we call
  the format's write function. The first call is needed to have
  the scheme know the right image size. The second call is needed
  to compensate for the scheme adjusting the size while writing.

Modified:
  user/marcel/mkimg/format.c

Modified: user/marcel/mkimg/format.c
==============================================================================
--- user/marcel/mkimg/format.c	Thu May 15 00:24:49 2014	(r266099)
+++ user/marcel/mkimg/format.c	Thu May 15 00:48:05 2014	(r266100)
@@ -48,7 +48,7 @@ int
 format_resize(lba_t end)
 {
 
-	if (format == NULL || format->resize == NULL)
+	if (format == NULL)
 		return (ENOSYS);
 	return (format->resize(end));
 }
@@ -78,8 +78,14 @@ format_selected(void)
 int
 format_write(int fd)
 {
+	lba_t size;
+	int error;
 
-	if (format == NULL || format->write == NULL)
+	if (format == NULL)
 		return (ENOSYS);
-	return (format->write(fd));
+	size = image_get_size();
+	error = format->resize(size);
+	if (!error)
+		error = format->write(fd);
+	return (error);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405150048.s4F0m6p8054548>