filetype: Add detection for barebox environment
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
e9241844a8
commit
0de5aae341
|
@ -23,6 +23,7 @@
|
||||||
#include <fs.h>
|
#include <fs.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <envfs.h>
|
||||||
|
|
||||||
struct filetype_str {
|
struct filetype_str {
|
||||||
const char *name; /* human readable filetype */
|
const char *name; /* human readable filetype */
|
||||||
|
@ -51,6 +52,7 @@ static const struct filetype_str filetype_str[] = {
|
||||||
[filetype_ext] = { "ext filesystem", "ext" },
|
[filetype_ext] = { "ext filesystem", "ext" },
|
||||||
[filetype_gpt] = { "GUID Partition Table", "gpt" },
|
[filetype_gpt] = { "GUID Partition Table", "gpt" },
|
||||||
[filetype_bpk] = { "Binary PacKage", "bpk" },
|
[filetype_bpk] = { "Binary PacKage", "bpk" },
|
||||||
|
[filetype_barebox_env] = { "barebox environment file", "bbenv" },
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *file_type_to_string(enum filetype f)
|
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)
|
if (strncmp(buf8, "#!/bin/sh", 9) == 0)
|
||||||
return filetype_sh;
|
return filetype_sh;
|
||||||
|
if (buf[0] == ENVFS_32(ENVFS_MAGIC))
|
||||||
|
return filetype_barebox_env;
|
||||||
|
|
||||||
if (bufsize < 32)
|
if (bufsize < 32)
|
||||||
return filetype_unknown;
|
return filetype_unknown;
|
||||||
|
|
|
@ -29,6 +29,7 @@ enum filetype {
|
||||||
filetype_gpt,
|
filetype_gpt,
|
||||||
filetype_ubifs,
|
filetype_ubifs,
|
||||||
filetype_bpk,
|
filetype_bpk,
|
||||||
|
filetype_barebox_env,
|
||||||
filetype_max,
|
filetype_max,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue