diff options
author | Michael Olbrich <m.olbrich@pengutronix.de> | 2018-12-17 12:25:36 +0100 |
---|---|---|
committer | Michael Olbrich <m.olbrich@pengutronix.de> | 2019-03-01 12:44:01 +0100 |
commit | 1033272349805b0afdff39ec7339f583ef30daac (patch) | |
tree | 134c6489878d529e2c87fd6c020f3e8a491f40cc | |
parent | d3e2dc20d3368de38795c3fa6d1da4b11a2d593c (diff) | |
download | genimage-1033272349805b0afdff39ec7339f583ef30daac.tar.gz genimage-1033272349805b0afdff39ec7339f583ef30daac.tar.xz |
pad_file: use the imageoutfile()
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r-- | genimage.h | 2 | ||||
-rw-r--r-- | image-flash.c | 5 | ||||
-rw-r--r-- | image-hd.c | 7 | ||||
-rw-r--r-- | util.c | 3 |
4 files changed, 8 insertions, 9 deletions
@@ -135,7 +135,7 @@ enum pad_mode { MODE_OVERWRITE, }; -int pad_file(struct image *image, const char *infile, const char *outfile, +int pad_file(struct image *image, const char *infile, size_t size, unsigned char fillpattern, enum pad_mode mode); int insert_data(struct image *image, const char *data, const char *outfile, size_t size, long offset); diff --git a/image-flash.c b/image-flash.c index 79b8e31..6f6325d 100644 --- a/image-flash.c +++ b/image-flash.c @@ -33,7 +33,6 @@ static int flash_generate(struct image *image) { struct partition *part; enum pad_mode mode = MODE_OVERWRITE; - const char *outfile = imageoutfile(image); list_for_each_entry(part, &image->partitions, list) { struct image *child; @@ -43,7 +42,7 @@ static int flash_generate(struct image *image) image_info(image, "writing image partition '%s' (0x%llx@0x%llx)\n", part->name, part->size, part->offset); - ret = pad_file(image, NULL, outfile, part->offset, 0xFF, mode); + ret = pad_file(image, NULL, part->offset, 0xFF, mode); if (ret) { image_error(image, "failed to pad image to size %lld\n", part->offset); @@ -61,7 +60,7 @@ static int flash_generate(struct image *image) } infile = imageoutfile(child); - ret = pad_file(image, infile, outfile, part->size, 0xFF, mode); + ret = pad_file(image, infile, part->size, 0xFF, mode); if (ret) { image_error(image, "failed to write image partition '%s'\n", part->name); @@ -293,7 +293,7 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions) return ret; } - ret = pad_file(image, NULL, outfile, image->size, 0x0, MODE_APPEND); + ret = pad_file(image, NULL, image->size, 0x0, MODE_APPEND); if (ret) { image_error(image, "failed to pad image to size %lld\n", part->offset); @@ -331,7 +331,6 @@ static int hdimage_generate(struct image *image) struct partition *part; struct hdimage *hd = image->handler_priv; enum pad_mode mode = MODE_OVERWRITE; - const char *outfile = imageoutfile(image); int ret; list_for_each_entry(part, &image->partitions, list) { @@ -345,7 +344,7 @@ static int hdimage_generate(struct image *image) part->image ? "'" : ""); if (part->image || part->extended) { - ret = pad_file(image, NULL, outfile, part->offset, 0x0, mode); + ret = pad_file(image, NULL, part->offset, 0x0, mode); if (ret) { image_error(image, "failed to pad image to size %lld\n", part->offset); @@ -368,7 +367,7 @@ static int hdimage_generate(struct image *image) child = image_get(part->image); infile = imageoutfile(child); - ret = pad_file(image, infile, outfile, child->size, 0x0, MODE_APPEND); + ret = pad_file(image, infile, child->size, 0x0, MODE_APPEND); if (ret) { image_error(image, "failed to write image partition '%s'\n", @@ -285,9 +285,10 @@ static size_t min(size_t a, size_t b) return a < b ? a : b; } -int pad_file(struct image *image, const char *infile, const char *outfile, +int pad_file(struct image *image, const char *infile, size_t size, unsigned char fillpattern, enum pad_mode mode) { + const char *outfile = imageoutfile(image); int f = -1, outf = -1; void *buf = NULL; int now, r, w; |