[PATCH 1/3] envfs: provide an intentional way to ignore an existing external environment

Juergen Borleis jbe at pengutronix.de
Wed Jul 30 03:20:04 PDT 2014


Add a simple flag to envfs to be able to mark an external environment as
"not to be used".
This change should not affect existing systems, because the current envfs
implementation ensures the 'flags' member in the envfs master block is always
zeroed.

Signed-off-by: Juergen Borleis <jbe at pengutronix.de>
---
 common/environment.c | 5 +++++
 include/envfs.h      | 1 +
 2 files changed, 6 insertions(+)

diff --git a/common/environment.c b/common/environment.c
index 2d1edf8..a38e966 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -272,6 +272,11 @@ static int envfs_check_super(struct envfs_super *super, size_t *size)
 		return -EIO;
 	}
 
+	if (super->flags & ENVFS_FLAGS_PLACEHOLDER) {
+		printf("envfs: content is to be ignored\n");
+		return -EIO;
+	}
+
 	if (super->major < ENVFS_MAJOR)
 		printf("envfs version %d.%d loaded into %d.%d\n",
 			super->major, super->minor,
diff --git a/include/envfs.h b/include/envfs.h
index 9b86398..edb559f 100644
--- a/include/envfs.h
+++ b/include/envfs.h
@@ -43,6 +43,7 @@ struct envfs_super {
 	uint8_t minor;			/* minor */
 	uint16_t future;		/* reserved for future use */
 	uint32_t flags;			/* feature flags */
+#define ENVFS_FLAGS_PLACEHOLDER	(1 << 0)
 	uint32_t sb_crc;		/* crc for the superblock */
 };
 
-- 
2.0.1




More information about the barebox mailing list