svn commit: r265609 - user/marcel/mkimg

Marcel Moolenaar marcel at FreeBSD.org
Wed May 7 20:50:17 UTC 2014


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


More information about the svn-src-user mailing list