mirror of
https://github.com/pengutronix/genimage.git
synced 2024-11-23 17:53:52 +08:00
pad_file: use the imageoutfile()
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
This commit is contained in:
parent
d3e2dc20d3
commit
1033272349
@ -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);
|
||||
|
@ -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",
|
||||
|
3
util.c
3
util.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user