Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Aug 2015 01:24:48 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r286215 - head/usr.bin/mkimg
Message-ID:  <201508030124.t731Om1f056435@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Mon Aug  3 01:24:48 2015
New Revision: 286215
URL: https://svnweb.freebsd.org/changeset/base/286215

Log:
  Make image_copyout_zeroes() an interface function.

Modified:
  head/usr.bin/mkimg/image.c
  head/usr.bin/mkimg/image.h

Modified: head/usr.bin/mkimg/image.c
==============================================================================
--- head/usr.bin/mkimg/image.c	Mon Aug  3 01:22:49 2015	(r286214)
+++ head/usr.bin/mkimg/image.c	Mon Aug  3 01:24:48 2015	(r286215)
@@ -517,14 +517,14 @@ image_copyout_memory(int fd, size_t size
 	return (0);
 }
 
-static int
-image_copyout_zeroes(int fd, size_t size)
+int
+image_copyout_zeroes(int fd, size_t count)
 {
 	static uint8_t *zeroes = NULL;
 	size_t sz;
 	int error;
 
-	if (lseek(fd, (off_t)size, SEEK_CUR) != -1)
+	if (lseek(fd, (off_t)count, SEEK_CUR) != -1)
 		return (0);
 
 	/*
@@ -537,12 +537,12 @@ image_copyout_zeroes(int fd, size_t size
 			return (ENOMEM);
 	}
 
-	while (size > 0) {
-		sz = (size > secsz) ? secsz : size;
+	while (count > 0) {
+		sz = (count > secsz) ? secsz : count;
 		error = image_copyout_memory(fd, sz, zeroes);
 		if (error)
 			return (error);
-		size -= sz;
+		count -= sz;
 	}
 	return (0);
 }

Modified: head/usr.bin/mkimg/image.h
==============================================================================
--- head/usr.bin/mkimg/image.h	Mon Aug  3 01:22:49 2015	(r286214)
+++ head/usr.bin/mkimg/image.h	Mon Aug  3 01:24:48 2015	(r286215)
@@ -35,6 +35,7 @@ int image_copyin(lba_t blk, int fd, uint
 int image_copyout(int fd);
 int image_copyout_done(int fd);
 int image_copyout_region(int fd, lba_t blk, lba_t size);
+int image_copyout_zeroes(int fd, size_t count);
 int image_data(lba_t blk, lba_t size);
 lba_t image_get_size(void);
 int image_init(void);



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