From 0de5aae341bf0b46b859417c946793c72be14aae Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 19 Feb 2014 18:06:29 +0100 Subject: filetype: Add detection for barebox environment Signed-off-by: Sascha Hauer --- common/filetype.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'common/filetype.c') diff --git a/common/filetype.c b/common/filetype.c index 8cdf82741a..0b5da3042a 100644 --- a/common/filetype.c +++ b/common/filetype.c @@ -23,6 +23,7 @@ #include #include #include +#include struct filetype_str { const char *name; /* human readable filetype */ @@ -51,6 +52,7 @@ static const struct filetype_str filetype_str[] = { [filetype_ext] = { "ext filesystem", "ext" }, [filetype_gpt] = { "GUID Partition Table", "gpt" }, [filetype_bpk] = { "Binary PacKage", "bpk" }, + [filetype_barebox_env] = { "barebox environment file", "bbenv" }, }; const char *file_type_to_string(enum filetype f) @@ -188,6 +190,8 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize) if (strncmp(buf8, "#!/bin/sh", 9) == 0) return filetype_sh; + if (buf[0] == ENVFS_32(ENVFS_MAGIC)) + return filetype_barebox_env; if (bufsize < 32) return filetype_unknown; -- cgit v1.2.3