Files
s390-tools/rust/pvsecret/src/cmd.rs
Steffen Eiden 7c2ae3d2e8 rust/pvsecret: Streamline arch dependend code
Get rid of all arch barriers in main.rs. cmd.rs handles the arch
barriers for the individual commands. Simplifies main.rs & cmd.rs and
makes it easier to read and understand the code.

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Reviewed-by: Julian Ruess <julianr@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
2024-04-26 15:07:19 +02:00

47 lines
1.1 KiB
Rust

// SPDX-License-Identifier: MIT
//
// Copyright IBM Corp. 2023
mod create;
pub use create::create;
mod verify;
pub use verify::verify;
pub const CMD_FN: &[&str] = &["+create", "+verify"];
#[cfg(target_arch = "s390x")]
mod add;
#[cfg(target_arch = "s390x")]
mod list;
#[cfg(target_arch = "s390x")]
mod lock;
// Commands (directly) related to UVCs are only available on s389x
#[cfg(target_arch = "s390x")]
mod uv_cmd {
pub use super::*;
pub use add::add;
pub use list::list;
pub use lock::lock;
pub const UV_CMD_FN: &[&str] = &["+add", "+lock", "+list"];
}
#[cfg(not(target_arch = "s390x"))]
mod uv_cmd {
use crate::cli::{AddSecretOpt, ListSecretOpt};
use anyhow::{bail, Result};
macro_rules! not_supp {
($name: ident $( ,$opt: ty )?) => {
pub fn $name($(_: &$opt)?) -> Result<()> {
bail!("Command only available on s390x")
}
};
}
not_supp!(add, AddSecretOpt);
not_supp!(list, ListSecretOpt);
not_supp!(lock);
pub const UV_CMD_FN: &[&str] = &[];
}
pub use uv_cmd::*;