From 946a0f3e1925c8cc9be08e3e34758d577cbe7f31 Mon Sep 17 00:00:00 2001 From: Sami Tolvanen Date: Sun, 22 Mar 2015 12:40:05 +0000 Subject: Use structured format for verity metadata Specify the location of verity metadata in fstab, and use a type-length-value format for the metadata that allows other data to be stored in the same location in an extensible way. Change-Id: Id8711f7d51dc1e4e9a4d84f9951240f64528e69d --- fs_mgr/fs_mgr_fstab.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'fs_mgr/fs_mgr_fstab.c') diff --git a/fs_mgr/fs_mgr_fstab.c b/fs_mgr/fs_mgr_fstab.c index ab8f128ce..2c3c90dff 100644 --- a/fs_mgr/fs_mgr_fstab.c +++ b/fs_mgr/fs_mgr_fstab.c @@ -24,6 +24,7 @@ struct fs_mgr_flag_values { char *key_loc; + char *verity_loc; long long part_length; char *label; int partnum; @@ -107,6 +108,14 @@ static int parse_flags(char *flags, struct flag_list *fl, * location of the keys. Get it and return it. */ flag_vals->key_loc = strdup(strchr(p, '=') + 1); + } else if ((fl[i].flag == MF_VERIFY) && flag_vals) { + /* If the verify flag is followed by an = and the + * location for the verity state, get it and return it. + */ + char *start = strchr(p, '='); + if (start) { + flag_vals->verity_loc = strdup(start + 1); + } } else if ((fl[i].flag == MF_FORCECRYPT) && flag_vals) { /* The forceencrypt flag is followed by an = and the * location of the keys. Get it and return it. @@ -291,6 +300,7 @@ struct fstab *fs_mgr_read_fstab(const char *fstab_path) fstab->recs[cnt].fs_mgr_flags = parse_flags(p, fs_mgr_flags, &flag_vals, NULL, 0); fstab->recs[cnt].key_loc = flag_vals.key_loc; + fstab->recs[cnt].verity_loc = flag_vals.verity_loc; fstab->recs[cnt].length = flag_vals.part_length; fstab->recs[cnt].label = flag_vals.label; fstab->recs[cnt].partnum = flag_vals.partnum; -- cgit v1.2.3