Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 May 2014 15:33:52 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r265685 - user/marcel/mkimg
Message-ID:  <201405081533.s48FXqVj073960@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Thu May  8 15:33:52 2014
New Revision: 265685
URL: http://svnweb.freebsd.org/changeset/base/265685

Log:
  Have image_write() call sparse_write() so that we can use SEEK_HOLE
  and SEEK_DATA to "quickly" find occupied sectors. This is all short-
  lived, because the image should not be kept in a file, but in memory.
  To be precise: the image API should be both efficient and scalable
  and using a file is not efficient -- it works, which is what I need
  right now.

Modified:
  user/marcel/mkimg/image.c

Modified: user/marcel/mkimg/image.c
==============================================================================
--- user/marcel/mkimg/image.c	Thu May  8 15:24:51 2014	(r265684)
+++ user/marcel/mkimg/image.c	Thu May  8 15:33:52 2014	(r265685)
@@ -140,7 +140,7 @@ image_write(lba_t blk, void *buf, ssize_
 	if (lseek(image_fd, blk, SEEK_SET) != blk)
 		return (errno);
 	len *= secsz;
-	if (write(image_fd, buf, len) != len)
+	if (sparse_write(image_fd, buf, len) != len)
 		return (errno);
 	return (0);
 }



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