Add format_write() that calls the write() function of the output

format. Have the raw format use image_copyout() for now.
This commit is contained in:
marcel 2014-05-08 21:12:39 +00:00
parent fdd67dad26
commit bd79c282bb
4 changed files with 14 additions and 3 deletions

View File

@ -65,3 +65,13 @@ format_selected(void)
return (format);
}
int
format_write(int fd)
{
if (format == NULL)
return (ENOSYS);
return (format->write(fd));
}

View File

@ -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_ */

View File

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

4
raw.c
View File

@ -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 = {