From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] filetype: Add detection for barebox environment
Date: Thu, 20 Feb 2014 14:49:26 +0100 [thread overview]
Message-ID: <1392904169-786-1-git-send-email-s.hauer@pengutronix.de> (raw)
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/filetype.c | 4 ++++
include/filetype.h | 1 +
2 files changed, 5 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index 8cdf827..0b5da30 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -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;
diff --git a/include/filetype.h b/include/filetype.h
index ffefe1c..c20a4f9 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,
};
--
1.8.5.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2014-02-20 13:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-20 13:49 Sascha Hauer [this message]
2014-02-20 13:49 ` [PATCH 2/4] environment: constify arguments Sascha Hauer
2014-02-20 13:49 ` [PATCH 3/4] environment: Add function to load envfs from buffer Sascha Hauer
2014-02-20 15:16 ` Alexander Aring
2014-02-22 18:28 ` Sascha Hauer
2014-02-22 19:40 ` Alexander Aring
2014-02-20 13:49 ` [PATCH 4/4] defaultenv: Align defaultenv array Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1392904169-786-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox