summaryrefslogtreecommitdiffstats
path: root/src/image.h
diff options
context:
space:
mode:
authorPali Rohár <pali.rohar@gmail.com>2012-07-14 10:33:15 +0200
committerPali Rohár <pali.rohar@gmail.com>2012-07-14 10:33:15 +0200
commitf8d3fa0ecd01a3164252fb1de93f4f1e1a2bf763 (patch)
tree8da2caa7c8d19cc2ed31ea964dabaaf93f839179 /src/image.h
parentf62628bf29ecd6a2fc1fe84386e1c330f39e8eb5 (diff)
download0xFFFF-f8d3fa0ecd01a3164252fb1de93f4f1e1a2bf763.tar.bz2
Prepaired new code for fiasco images
Diffstat (limited to 'src/image.h')
-rw-r--r--src/image.h54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/image.h b/src/image.h
new file mode 100644
index 0000000..60bcd58
--- /dev/null
+++ b/src/image.h
@@ -0,0 +1,54 @@
+
+enum image_type {
+ IMAGE_UNKNOWN = 0,
+ IMAGE_XLOADER,
+ IMAGE_2ND,
+ IMAGE_SECONDARY,
+ IMAGE_KERNEL,
+ IMAGE_INITFS,
+ IMAGE_ROOTFS,
+ IMAGE_OMAPNAND,
+ IMAGE_MMC,
+ IMAGE_CMT_2ND,
+ IMAGE_CMT_ALGO,
+ IMAGE_CMT_MCUSW,
+};
+
+enum device {
+ DEVICE_UNKNOWN = 0,
+ DEVICE_SU_18, /* Nokia 770 */
+ DEVICE_RX_34, /* Nokia N800 */
+ DEVICE_RX_44, /* Nokia N810 */
+ DEVICE_RX_48, /* Nokia N810 WiMax */
+ DEVICE_RX_51, /* Nokia N900 */
+};
+
+struct image {
+ enum image_type type;
+ enum device device;
+ char * hwrevs;
+ char * version;
+ char * layout;
+ uint16_t hash;
+ uint32_t size;
+
+ int fd;
+ int shared_fd;
+ off_t offset;
+ off_t cur;
+}
+
+struct image_list {
+ struct image * image;
+ struct image_list * prev;
+ 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_fiasco(struct image * image, int fd, size_t size, size_t offset, const char * type, const char * device, const char * hwrevs, const char * version, const char * layout);
+void image_free(struct image * image);
+void image_seek(struct image * image, whence);
+size_t image_read(struct image * image, void * buf, size_t count);
+size_t image_write(struct image * image, void * buf, size_t count);
+void image_list_add(struct image_list ** list, struct image * image);
+void image_list_del(struct image_list * list);