Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions crates/trident/src/engine/storage/encryption.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use std::{
collections::BTreeMap,
fs::{self, Permissions},
os::unix::fs::PermissionsExt,
path::{Path, PathBuf},
Expand All @@ -8,7 +7,6 @@ use std::{
use anyhow::{Context, Error};
use enumflags2::BitFlags;
use log::{debug, info};
use serde::{Deserialize, Serialize};
use tempfile::NamedTempFile;

use osutils::{
Expand Down Expand Up @@ -282,29 +280,6 @@ fn encrypt_and_open_device(
Ok(())
}

/// This is an abbreviated representation of the JSON output of
/// `cryptsetup luksDump --dump-json-metadata <device_path>`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
struct LuksDump {
segments: BTreeMap<String, LuksDumpSegment>,
}

/// This is a complete representation of the segment object in the JSON
/// output of `cryptsetup luksDump --dump-json-metadata <device_path>`
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
#[serde(deny_unknown_fields)]
struct LuksDumpSegment {
#[serde(rename = "type")]
segment_type: String,
offset: String,
size: String,
iv_tweak: String,
encryption: String,
sector_size: u64,
}

/// Returns paths of UKI and bootloader binaries that `systemd-pcrlock` tool should seal to. During
/// encryption provisioning, returns binaries used for the current boot, as well as binaries that
/// will be used in the future boot, i.e. in the target OS image. During rollback validation,
Expand Down
17 changes: 0 additions & 17 deletions crates/trident/src/engine/storage/raid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ use std::{

use anyhow::{anyhow, bail, Context, Error};
use log::{debug, info, trace, warn};
use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumString};

use osutils::{block_devices, dependencies::Dependency, mdadm, udevadm};
use trident_api::{
Expand All @@ -23,21 +21,6 @@ use crate::engine::{storage::common::SetRelationship, EngineContext};

use super::common;

#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq, Display, EnumString)]
#[serde(rename_all = "kebab-case")]
#[serde(deny_unknown_fields)]
pub(super) enum RaidState {
/// in a clean, healthy state
#[strum(serialize = "clean")]
Clean,
/// active and operational
#[strum(serialize = "active")]
Active,
/// IO error
#[strum(serialize = "inactive")]
Inactive,
}

fn create(config: SoftwareRaidArray, ctx: &EngineContext) -> Result<(), Error> {
let devices = &config.devices;
let device_paths = get_device_paths(ctx, devices).context("Failed to get device paths")?;
Expand Down
4 changes: 2 additions & 2 deletions crates/trident/src/osimage/cosi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Cosi {
}

/// Returns the ESP filesystem image.
pub(super) fn esp_filesystem(&self) -> Result<OsImageFileSystem, Error> {
pub(super) fn esp_filesystem(&self) -> Result<OsImageFileSystem<'_>, Error> {
self.metadata
.get_esp_filesystem()
.map(|image| cosi_image_to_os_image_filesystem(&self.reader, image))
Expand All @@ -99,7 +99,7 @@ impl Cosi {
}

/// Returns an iterator over all images that are NOT the ESP filesystem image.
pub(super) fn filesystems(&self) -> impl Iterator<Item = OsImageFileSystem> {
pub(super) fn filesystems(&self) -> impl Iterator<Item = OsImageFileSystem<'_>> {
self.metadata
.get_regular_filesystems()
.map(|image| cosi_image_to_os_image_filesystem(&self.reader, image))
Expand Down
8 changes: 4 additions & 4 deletions crates/trident/src/osimage/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl OsImage {
}

/// Find the mount point which contains the given path.
pub(crate) fn path_to_filesystem(&self, path: &Path) -> Option<OsImageFileSystem> {
pub(crate) fn path_to_filesystem(&self, path: &Path) -> Option<OsImageFileSystem<'_>> {
self.filesystems()
.filter(|fs| path.starts_with(&fs.mount_point))
.max_by_key(|fs| fs.mount_point.components().count())
Expand All @@ -153,7 +153,7 @@ impl OsImage {
}

/// Returns the ESP filesystem image.
pub(crate) fn esp_filesystem(&self) -> Result<OsImageFileSystem, Error> {
pub(crate) fn esp_filesystem(&self) -> Result<OsImageFileSystem<'_>, Error> {
match &self.0 {
OsImageInner::Cosi(cosi) => cosi.esp_filesystem(),
#[cfg(test)]
Expand All @@ -162,7 +162,7 @@ impl OsImage {
}

/// Returns an iterator over all images that are NOT the ESP filesystem image.
pub(crate) fn filesystems(&self) -> Box<dyn Iterator<Item = OsImageFileSystem> + '_> {
pub(crate) fn filesystems(&self) -> Box<dyn Iterator<Item = OsImageFileSystem<'_>> + '_> {
match &self.0 {
OsImageInner::Cosi(cosi) => Box::new(cosi.filesystems()),
#[cfg(test)]
Expand All @@ -171,7 +171,7 @@ impl OsImage {
}

/// Returns the root filesystem image.
pub(crate) fn root_filesystem(&self) -> Option<OsImageFileSystem> {
pub(crate) fn root_filesystem(&self) -> Option<OsImageFileSystem<'_>> {
self.filesystems()
.find(|fs| fs.mount_point == Path::new(ROOT_MOUNT_POINT_PATH))
}
Expand Down
1 change: 1 addition & 0 deletions crates/trident/src/subsystems/extensions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ impl Subsystem for ExtensionsSubsystem {
}

impl ExtensionsSubsystem {
#[allow(unused)]
fn populate_extensions(
&mut self,
ctx: &EngineContext,
Expand Down
Loading