From 0de5aae341bf0b46b859417c946793c72be14aae Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Wed, 19 Feb 2014 18:06:29 +0100 Subject: [PATCH] filetype: Add detection for barebox environment Signed-off-by: Sascha Hauer --- common/filetype.c | 4 ++++ include/filetype.h | 1 + 2 files changed, 5 insertions(+) diff --git a/common/filetype.c b/common/filetype.c index 8cdf82741..0b5da3042 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; diff --git a/include/filetype.h b/include/filetype.h index ffefe1c90..c20a4f939 100644 --- a/include/filetype.h +++ b/include/filetype.h @@ -29,6 +29,7 @@ enum filetype { filetype_gpt, filetype_ubifs, filetype_bpk, + filetype_barebox_env, filetype_max, };