Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 7 May 2014 20:50:16 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r265609 - user/marcel/mkimg
Message-ID:  <201405072050.s47KoGuM080620@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Wed May  7 20:50:16 2014
New Revision: 265609
URL: http://svnweb.freebsd.org/changeset/base/265609

Log:
  Replace 2 instances of fdcopy() with image_copyin(). With this, the
  mkimg() function does not need the ofd argument and all references
  to an output file descriptor in the input phase are gone.

Modified:
  user/marcel/mkimg/mkimg.c

Modified: user/marcel/mkimg/mkimg.c
==============================================================================
--- user/marcel/mkimg/mkimg.c	Wed May  7 20:40:23 2014	(r265608)
+++ user/marcel/mkimg/mkimg.c	Wed May  7 20:50:16 2014	(r265609)
@@ -318,7 +318,7 @@ fdcopy(int src, lba_t sblk, int dst, lba
 }
 
 static void
-mkimg(int ofd, int bfd)
+mkimg(int bfd)
 {
 	FILE *fp;
 	struct part *part;
@@ -352,7 +352,7 @@ mkimg(int ofd, int bfd)
 		case PART_KIND_FILE:
 			fd = open(part->contents, O_RDONLY, 0);
 			if (fd != -1) {
-				error = fdcopy(fd, -1, ofd, block, &bytesize);
+				error = image_copyin(block, fd, &bytesize);
 				close(fd);
 			} else
 				error = errno;
@@ -361,7 +361,7 @@ mkimg(int ofd, int bfd)
 			fp = popen(part->contents, "r");
 			if (fp != NULL) {
 				fd = fileno(fp);
-				error = fdcopy(fd, -1, ofd, block, &bytesize);
+				error = image_copyin(block, fd, &bytesize);
 				pclose(fp);
 			} else
 				error = errno;
@@ -488,7 +488,7 @@ main(int argc, char *argv[])
 		fprintf(stderr, "Number of heads:     %u\n", nheads);
 	}
 
-	mkimg(tmpfd, bcfd);
+	mkimg(bcfd);
 
 	if (verbose)
 		fprintf(stderr, "Number of cylinders: %u\n", ncyls);



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