aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Weinberger <richard@nod.at>2018-10-18 16:36:44 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2018-11-01 12:37:56 +0100
commit9125b652119afb403fbedef9c9be38adf9537d66 (patch)
tree6844c7645c26964f442213ce4bbcabbfa05c948c
parent4d8c2599d463f11fd0e95de1aa30ad2e6972786f (diff)
mkfs.ubifs: Implement UBIFS_FLG_ENCRYPTION
...and set UBIFS format version Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--ubifs-utils/mkfs.ubifs/mkfs.ubifs.c13
-rw-r--r--ubifs-utils/mkfs.ubifs/ubifs.h1
2 files changed, 13 insertions, 1 deletions
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index fc1b0cb..09c28ab 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -2357,6 +2357,15 @@ static int finalize_leb_cnt(void)
return 0;
}
+static int ubifs_format_version(void)
+{
+ if (c->double_hash || c->encrypted)
+ return 5;
+
+ /* Default */
+ return 4;
+}
+
/**
* write_super - write the super block.
*/
@@ -2379,7 +2388,7 @@ static int write_super(void)
sup.jhead_cnt = cpu_to_le32(c->jhead_cnt);
sup.fanout = cpu_to_le32(c->fanout);
sup.lsave_cnt = cpu_to_le32(c->lsave_cnt);
- sup.fmt_version = cpu_to_le32(UBIFS_FORMAT_VERSION);
+ sup.fmt_version = cpu_to_le32(ubifs_format_version());
sup.default_compr = cpu_to_le16(c->default_compr);
sup.rp_size = cpu_to_le64(c->rp_size);
sup.time_gran = cpu_to_le32(DEFAULT_TIME_GRAN);
@@ -2396,6 +2405,8 @@ static int write_super(void)
sup.flags |= cpu_to_le32(UBIFS_FLG_SPACE_FIXUP);
if (c->double_hash)
sup.flags |= cpu_to_le32(UBIFS_FLG_DOUBLE_HASH);
+ if (c->encrypted)
+ sup.flags |= cpu_to_le32(UBIFS_FLG_ENCRYPTION);
return write_node(&sup, UBIFS_SB_NODE_SZ, UBIFS_SB_LNUM);
}
diff --git a/ubifs-utils/mkfs.ubifs/ubifs.h b/ubifs-utils/mkfs.ubifs/ubifs.h
index 5a4af99..c26d094 100644
--- a/ubifs-utils/mkfs.ubifs/ubifs.h
+++ b/ubifs-utils/mkfs.ubifs/ubifs.h
@@ -410,6 +410,7 @@ struct ubifs_info
int big_lpt;
int space_fixup;
int double_hash;
+ int encrypted;
long long lpt_sz;
int ltab_lnum;