Thread (6 messages) 6 messages, 2 authors, 2021-06-23
STALE1862d

[PATCH 1/3] filetype: Add function to check if a filetype is a compressed file

From: Sascha Hauer <s.hauer@pengutronix.de>
Date: 2021-06-23 04:35:46
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 include/filetype.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
diff --git a/include/filetype.h b/include/filetype.h
index fd339f9564..ae0920320e 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -70,6 +70,20 @@ enum filetype is_fat_or_mbr(const unsigned char *sector, unsigned long *bootsec)
 int is_fat_boot_sector(const void *_buf);
 bool filetype_is_barebox_image(enum filetype ft);
 
+static inline bool file_is_compressed_file(enum filetype ft)
+{
+	switch (ft) {
+	case filetype_lzo_compressed:
+	case filetype_lz4_compressed:
+	case filetype_gzip:
+	case filetype_bzip2:
+	case filetype_xz_compressed:
+		return true;
+	default:
+		return false;
+	}
+}
+
 #define ARM_HEAD_SIZE			0x30
 #define ARM_HEAD_MAGICWORD_OFFSET	0x20
 #define ARM_HEAD_SIZE_OFFSET		0x2C
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help