From e7e75061a1348f605670b4462fa6aa7feb165396 Mon Sep 17 00:00:00 2001 From: Bruce Leidl Date: Tue, 29 Jan 2019 13:53:22 -0500 Subject: [PATCH] Everything optional except 'image-type' now. Also removed a couple fields. When a RealmFS image is not sealed it has a very simple header and doesn't use most of the metainfo fields. --- libcitadel/src/header.rs | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/libcitadel/src/header.rs b/libcitadel/src/header.rs index 9df4bcc..e8d7935 100644 --- a/libcitadel/src/header.rs +++ b/libcitadel/src/header.rs @@ -297,24 +297,35 @@ pub struct MetaInfo { struct MetaInfoToml { #[serde(rename = "image-type")] image_type: String, + + #[serde(default)] channel: String, + #[serde(rename = "kernel-version")] kernel_version: Option, + #[serde(rename = "kernel-id")] kernel_id: Option, + #[serde(rename = "realmfs-name")] realmfs_name: Option, + + #[serde(default)] version: u32, + + #[serde(default)] timestamp: String, - #[serde(rename = "base-version")] - base_version: Option, - date: Option, - gitrev: Option, + + #[serde(default)] nblocks: u32, + + #[serde(default)] shasum: String, - #[serde(rename = "verity-salt")] + + #[serde(default, rename = "verity-salt")] verity_salt: String, - #[serde(rename = "verity-root")] + + #[serde(default, rename = "verity-root")] verity_root: String, } @@ -363,14 +374,6 @@ impl MetaInfo { &self.toml().timestamp } - pub fn date(&self) -> Option<&str> { - self.toml().date.as_ref().map(|s| s.as_str()) - } - - pub fn gitrev(&self) -> Option<&str> { - self.toml().gitrev.as_ref().map(|s| s.as_str()) - } - pub fn nblocks(&self) -> usize { self.toml().nblocks as usize }