diff options
author | Pali Rohár <pali.rohar@gmail.com> | 2021-05-02 17:01:48 +0200 |
---|---|---|
committer | Pali Rohár <pali.rohar@gmail.com> | 2021-05-02 17:01:48 +0200 |
commit | df8e50a8243ad7003988efca3e4840d15030977c (patch) | |
tree | 3ac8406f04efcf327ad9bb9bea37eb4dda428de6 /src/image.h | |
parent | 4f45b045c305efdb216a24912aedceba0cd23670 (diff) | |
download | 0xFFFF-df8e50a8243ad7003988efca3e4840d15030977c.tar.bz2 |
fiasco: Add support for unpacking multiple parts of one image
Fiasco mmc image contains layout and two parts in one data section. First
part is FAT32 partition (MyDocs) and second part is tar archive for second
ext3 partition (/home). This change extends fiasco parser to load all parts
from one data section and correctly unpack all parts.
Diffstat (limited to 'src/image.h')
-rw-r--r-- | src/image.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/image.h b/src/image.h index 42111bf..2535a14 100644 --- a/src/image.h +++ b/src/image.h @@ -40,6 +40,13 @@ enum image_type { IMAGE_COUNT, }; +struct image_part { + struct image_part * next; + uint32_t offset; + uint32_t size; + char * name; +}; + struct image { enum image_type type; struct device_list * devices; @@ -47,6 +54,7 @@ struct image { char * layout; uint16_t hash; uint32_t size; + struct image_part * parts; int fd; int is_shared_fd; @@ -63,9 +71,9 @@ struct image_list { struct image_list * next; }; -struct image * image_alloc_from_file(const char * file, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout); -struct image * image_alloc_from_fd(int fd, const char * orig_filename, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout); -struct image * image_alloc_from_shared_fd(int fd, size_t size, size_t offset, uint16_t hash, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout); +struct image * image_alloc_from_file(const char * file, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout, struct image_part * parts); +struct image * image_alloc_from_fd(int fd, const char * orig_filename, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout, struct image_part * parts); +struct image * image_alloc_from_shared_fd(int fd, size_t size, size_t offset, uint16_t hash, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout, struct image_part * parts); void image_free(struct image * image); void image_seek(struct image * image, size_t whence); size_t image_read(struct image * image, void * buf, size_t count); @@ -76,7 +84,7 @@ void image_list_unlink(struct image_list * list); uint16_t image_hash_from_data(struct image * image); enum image_type image_type_from_data(struct image * image); -char * image_name_alloc_from_values(struct image * image); +char * image_name_alloc_from_values(struct image * image, int part_num); enum image_type image_type_from_string(const char * type); const char * image_type_to_string(enum image_type type); int image_hwrev_is_valid(struct image * image, int16_t hwrev); |