summaryrefslogtreecommitdiffstats
path: root/include/filetype.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-11-25 18:49:14 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-11-29 21:12:42 +0100
commitb6996039f622ccc8488176e211bf41315f9691c6 (patch)
tree8eb8573833d98fe93b8db036acdf677fd74a30f6 /include/filetype.h
parent32daa5509a68f58fe365fadafdb5b1ec5d72fff5 (diff)
downloadbarebox-b6996039f622ccc8488176e211bf41315f9691c6.tar.gz
add file detection support
Several filetypes can be autodetected. Barebox could make use of this in several ways: - Add a command to detect filetypes - detect arm zImages and uImages to unify the different boot commands - maybe detect UBI or JFFS2 images to construct parts of the kernel command line - select correct uncompression function based on filetype This patch adds basic support to detect filetypes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/filetype.h')
-rw-r--r--include/filetype.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/filetype.h b/include/filetype.h
new file mode 100644
index 0000000..64d32ef
--- /dev/null
+++ b/include/filetype.h
@@ -0,0 +1,23 @@
+#ifndef __FILE_TYPE_H
+#define __FILE_TYPE_H
+
+/*
+ * List of file types we know
+ */
+enum filetype {
+ filetype_unknown,
+ filetype_arm_zimage,
+ filetype_lzo_compressed,
+ filetype_arm_barebox,
+ filetype_uimage,
+ filetype_ubi,
+ filetype_jffs2,
+ filetype_gzip,
+ filetype_bzip2,
+};
+
+const char *file_type_to_string(enum filetype f);
+enum filetype file_detect_type(void *_buf);
+enum filetype file_name_detect_type(const char *filename);
+
+#endif /* __FILE_TYPE_H */