1
0
forked from brl/citadel-tools

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.
This commit is contained in:
Bruce Leidl 2019-01-29 13:53:22 -05:00
parent d23e488aaa
commit e7e75061a1

View File

@ -297,24 +297,35 @@ pub struct MetaInfo {
struct MetaInfoToml { struct MetaInfoToml {
#[serde(rename = "image-type")] #[serde(rename = "image-type")]
image_type: String, image_type: String,
#[serde(default)]
channel: String, channel: String,
#[serde(rename = "kernel-version")] #[serde(rename = "kernel-version")]
kernel_version: Option<String>, kernel_version: Option<String>,
#[serde(rename = "kernel-id")] #[serde(rename = "kernel-id")]
kernel_id: Option<String>, kernel_id: Option<String>,
#[serde(rename = "realmfs-name")] #[serde(rename = "realmfs-name")]
realmfs_name: Option<String>, realmfs_name: Option<String>,
#[serde(default)]
version: u32, version: u32,
#[serde(default)]
timestamp: String, timestamp: String,
#[serde(rename = "base-version")]
base_version: Option<u32>, #[serde(default)]
date: Option<String>,
gitrev: Option<String>,
nblocks: u32, nblocks: u32,
#[serde(default)]
shasum: String, shasum: String,
#[serde(rename = "verity-salt")]
#[serde(default, rename = "verity-salt")]
verity_salt: String, verity_salt: String,
#[serde(rename = "verity-root")]
#[serde(default, rename = "verity-root")]
verity_root: String, verity_root: String,
} }
@ -363,14 +374,6 @@ impl MetaInfo {
&self.toml().timestamp &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 { pub fn nblocks(&self) -> usize {
self.toml().nblocks as usize self.toml().nblocks as usize
} }