config: reuse reserved label and GPT name constants
This commit is contained in:
@@ -128,43 +128,50 @@ pub fn validate(cfg: &Config) -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reserved GPT names
|
// Reserved GPT names
|
||||||
if cfg.partitioning.esp.gpt_name != "zosboot" {
|
if cfg.partitioning.esp.gpt_name != GPT_NAME_ZOSBOOT {
|
||||||
return Err(Error::Validation(
|
return Err(Error::Validation(format!(
|
||||||
"partitioning.esp.gpt_name must be 'zosboot'".into(),
|
"partitioning.esp.gpt_name must be '{}'",
|
||||||
));
|
GPT_NAME_ZOSBOOT
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
if cfg.partitioning.data.gpt_name != "zosdata" {
|
if cfg.partitioning.data.gpt_name != GPT_NAME_ZOSDATA {
|
||||||
return Err(Error::Validation(
|
return Err(Error::Validation(format!(
|
||||||
"partitioning.data.gpt_name must be 'zosdata'".into(),
|
"partitioning.data.gpt_name must be '{}'",
|
||||||
));
|
GPT_NAME_ZOSDATA
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
if cfg.partitioning.cache.gpt_name != "zoscache" {
|
if cfg.partitioning.cache.gpt_name != GPT_NAME_ZOSCACHE {
|
||||||
return Err(Error::Validation(
|
return Err(Error::Validation(format!(
|
||||||
"partitioning.cache.gpt_name must be 'zoscache'".into(),
|
"partitioning.cache.gpt_name must be '{}'",
|
||||||
));
|
GPT_NAME_ZOSCACHE
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
// BIOS boot name is also 'zosboot' per current assumption
|
// BIOS boot name is also 'zosboot' per current assumption
|
||||||
if cfg.partitioning.bios_boot.gpt_name != "zosboot" {
|
if cfg.partitioning.bios_boot.gpt_name != GPT_NAME_ZOSBOOT {
|
||||||
return Err(Error::Validation(
|
return Err(Error::Validation(format!(
|
||||||
"partitioning.bios_boot.gpt_name must be 'zosboot'".into(),
|
"partitioning.bios_boot.gpt_name must be '{}'",
|
||||||
));
|
GPT_NAME_ZOSBOOT
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reserved filesystem labels
|
// Reserved filesystem labels
|
||||||
if cfg.filesystem.vfat.label != "ZOSBOOT" {
|
if cfg.filesystem.vfat.label != LABEL_ZOSBOOT {
|
||||||
return Err(Error::Validation(
|
return Err(Error::Validation(format!(
|
||||||
"filesystem.vfat.label must be 'ZOSBOOT'".into(),
|
"filesystem.vfat.label must be '{}'",
|
||||||
));
|
LABEL_ZOSBOOT
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
if cfg.filesystem.btrfs.label != "ZOSDATA" {
|
if cfg.filesystem.btrfs.label != LABEL_ZOSDATA {
|
||||||
return Err(Error::Validation(
|
return Err(Error::Validation(format!(
|
||||||
"filesystem.btrfs.label must be 'ZOSDATA'".into(),
|
"filesystem.btrfs.label must be '{}'",
|
||||||
));
|
LABEL_ZOSDATA
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
if cfg.filesystem.bcachefs.label != "ZOSDATA" {
|
if cfg.filesystem.bcachefs.label != LABEL_ZOSDATA {
|
||||||
return Err(Error::Validation(
|
return Err(Error::Validation(format!(
|
||||||
"filesystem.bcachefs.label must be 'ZOSDATA'".into(),
|
"filesystem.bcachefs.label must be '{}'",
|
||||||
));
|
LABEL_ZOSDATA
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mount scheme
|
// Mount scheme
|
||||||
|
|||||||
10
src/types.rs
10
src/types.rs
@@ -18,6 +18,16 @@
|
|||||||
use clap::ValueEnum;
|
use clap::ValueEnum;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
/// Reserved filesystem labels.
|
||||||
|
pub const LABEL_ZOSBOOT: &str = "ZOSBOOT";
|
||||||
|
pub const LABEL_ZOSDATA: &str = "ZOSDATA";
|
||||||
|
pub const LABEL_ZOSCACHE: &str = "ZOSCACHE";
|
||||||
|
|
||||||
|
/// Reserved GPT partition names.
|
||||||
|
pub const GPT_NAME_ZOSBOOT: &str = "zosboot";
|
||||||
|
pub const GPT_NAME_ZOSDATA: &str = "zosdata";
|
||||||
|
pub const GPT_NAME_ZOSCACHE: &str = "zoscache";
|
||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct LoggingConfig {
|
pub struct LoggingConfig {
|
||||||
/// Log level: "error" | "warn" | "info" | "debug"
|
/// Log level: "error" | "warn" | "info" | "debug"
|
||||||
|
|||||||
Reference in New Issue
Block a user