diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-23 06:33:57 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-06-23 07:09:58 +0200 |
commit | 9c80942b4b116d54907a51ef168a9f26254e4460 (patch) | |
tree | 9b85ad663f946ef0565e877a12241e7a4c9a47d1 | |
parent | 3e1f92de4b20771298eac1d394847e0ebda53fbb (diff) | |
download | barebox-9c80942b4b116d54907a51ef168a9f26254e4460.tar.gz barebox-9c80942b4b116d54907a51ef168a9f26254e4460.tar.xz |
filetype: Add function to check if a filetype is a compressed file
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Link: https://lore.barebox.org/20210623043359.18391-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | include/filetype.h | 14 |
1 files changed, 14 insertions, 0 deletions
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 |