svn commit: r266100 - user/marcel/mkimg

Marcel Moolenaar marcel at FreeBSD.org
Thu May 15 00:48:06 UTC 2014


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);
 }


More information about the svn-src-user mailing list