Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 May 2014 21:12:39 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r265718 - user/marcel/mkimg
Message-ID:  <201405082112.s48LCdCb006682@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Thu May  8 21:12:39 2014
New Revision: 265718
URL: http://svnweb.freebsd.org/changeset/base/265718

Log:
  Add format_write() that calls the write() function of the output
  format. Have the raw format use image_copyout() for now.

Modified:
  user/marcel/mkimg/format.c
  user/marcel/mkimg/format.h
  user/marcel/mkimg/mkimg.c
  user/marcel/mkimg/raw.c

Modified: user/marcel/mkimg/format.c
==============================================================================
--- user/marcel/mkimg/format.c	Thu May  8 21:03:31 2014	(r265717)
+++ user/marcel/mkimg/format.c	Thu May  8 21:12:39 2014	(r265718)
@@ -65,3 +65,13 @@ format_selected(void)
 
 	return (format);
 }
+
+int
+format_write(int fd)
+{
+
+	if (format == NULL)
+		return (ENOSYS);
+
+	return (format->write(fd));
+}

Modified: user/marcel/mkimg/format.h
==============================================================================
--- user/marcel/mkimg/format.h	Thu May  8 21:03:31 2014	(r265717)
+++ user/marcel/mkimg/format.h	Thu May  8 21:12:39 2014	(r265718)
@@ -42,5 +42,6 @@ SET_DECLARE(formats, struct mkimg_format
 
 int	format_select(const char *);
 struct mkimg_format *format_selected(void);
+int	format_write(int);
 
 #endif /* _MKIMG_FORMAT_H_ */

Modified: user/marcel/mkimg/mkimg.c
==============================================================================
--- user/marcel/mkimg/mkimg.c	Thu May  8 21:03:31 2014	(r265717)
+++ user/marcel/mkimg/mkimg.c	Thu May  8 21:12:39 2014	(r265718)
@@ -451,7 +451,7 @@ main(int argc, char *argv[])
 		fprintf(stderr, "Number of cylinders: %u\n", ncyls);
 	}
 
-	error = image_copyout(outfd);
+	error = format_write(outfd);
 	if (error)
 		errc(EX_IOERR, error, "writing image");
 

Modified: user/marcel/mkimg/raw.c
==============================================================================
--- user/marcel/mkimg/raw.c	Thu May  8 21:03:31 2014	(r265717)
+++ user/marcel/mkimg/raw.c	Thu May  8 21:12:39 2014	(r265718)
@@ -40,10 +40,10 @@ __FBSDID("$FreeBSD$");
 #include "mkimg.h"
 
 static int
-raw_write(int fd __unused)
+raw_write(int fd)
 {
 
-	return (ENOSYS);
+	return (image_copyout(fd));
 }
 
 static struct mkimg_format raw_format = {



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