From owner-svn-src-user@FreeBSD.ORG Thu May 8 15:33:53 2014 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CB12590; Thu, 8 May 2014 15:33:53 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id EED6FE17; Thu, 8 May 2014 15:33:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s48FXqZn073961; Thu, 8 May 2014 15:33:52 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s48FXqVj073960; Thu, 8 May 2014 15:33:52 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201405081533.s48FXqVj073960@svn.freebsd.org> From: Marcel Moolenaar Date: Thu, 8 May 2014 15:33:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r265685 - user/marcel/mkimg X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2014 15:33:53 -0000 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); }