9
0
Fork 0

filetype: Add detection for barebox environment

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Sascha Hauer 2014-02-19 18:06:29 +01:00
parent e9241844a8
commit 0de5aae341
2 changed files with 5 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include <fs.h>
#include <malloc.h>
#include <errno.h>
#include <envfs.h>
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;

View File

@ -29,6 +29,7 @@ enum filetype {
filetype_gpt,
filetype_ubifs,
filetype_bpk,
filetype_barebox_env,
filetype_max,
};