diff options
-rw-r--r-- | genimage.h | 2 | ||||
-rw-r--r-- | image-hd.c | 8 | ||||
-rw-r--r-- | util.c | 3 |
3 files changed, 7 insertions, 6 deletions
@@ -159,7 +159,7 @@ int map_file_extents(struct image *image, const char *filename, int fd, int is_block_device(const char *filename); 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, +int insert_data(struct image *image, const void *data, const char *outfile, size_t size, long offset); int extend_file(struct image *image, size_t size); int reload_partitions(struct image *image); @@ -339,12 +339,12 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions) header.table_crc = htole32(crc32(table, sizeof(table))); header.header_crc = htole32(crc32(&header, sizeof(header))); - ret = insert_data(image, (char *)&header, outfile, sizeof(header), 512); + ret = insert_data(image, &header, outfile, sizeof(header), 512); if (ret) { image_error(image, "failed to write GPT\n"); return ret; } - ret = insert_data(image, (char *)&table, outfile, sizeof(table), hd->gpt_location); + ret = insert_data(image, &table, outfile, sizeof(table), hd->gpt_location); if (ret) { image_error(image, "failed to write GPT table\n"); return ret; @@ -363,13 +363,13 @@ static int hdimage_insert_gpt(struct image *image, struct list_head *partitions) header.backup_lba = htole64(1); header.starting_lba = htole64(image->size/512 - GPT_SECTORS); header.header_crc = htole32(crc32(&header, sizeof(header))); - ret = insert_data(image, (char *)&table, outfile, sizeof(table), + ret = insert_data(image, &table, outfile, sizeof(table), image->size - GPT_SECTORS*512); if (ret) { image_error(image, "failed to write backup GPT table\n"); return ret; } - ret = insert_data(image, (char *)&header, outfile, sizeof(header), + ret = insert_data(image, &header, outfile, sizeof(header), image->size - 512); if (ret) { image_error(image, "failed to write backup GPT\n"); @@ -559,9 +559,10 @@ err_out: return ret; } -int insert_data(struct image *image, const char *data, const char *outfile, +int insert_data(struct image *image, const void *_data, const char *outfile, size_t size, long offset) { + const char *data = _data; int outf = -1; int now, r; int ret = 0; |