Skip to content

Commit

Permalink
Run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
mysteriouslyseeing committed Oct 17, 2023
1 parent 69596a1 commit 8be2588
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 20 deletions.
16 changes: 3 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,8 @@ impl DiskImageBuilder {
let stage_3 = FileDataSource::Data(BIOS_STAGE_3.to_vec());
let stage_4 = FileDataSource::Data(BIOS_STAGE_4.to_vec());
let mut internal_files = BTreeMap::new();
internal_files.insert(
BIOS_STAGE_3_NAME,
stage_3,
);
internal_files.insert(
BIOS_STAGE_4_NAME,
stage_4,
);
internal_files.insert(BIOS_STAGE_3_NAME, stage_3);
internal_files.insert(BIOS_STAGE_4_NAME, stage_4);
let fat_partition = self
.create_fat_filesystem_image(internal_files)
.context("failed to create FAT partition")?;
Expand Down Expand Up @@ -192,10 +186,7 @@ impl DiskImageBuilder {
}

let mut internal_files = BTreeMap::new();
internal_files.insert(
UEFI_BOOT_FILENAME,
get_uefi_bootloader(),
);
internal_files.insert(UEFI_BOOT_FILENAME, get_uefi_bootloader());
let fat_partition = self
.create_fat_filesystem_image(internal_files)
.context("failed to create FAT partition")?;
Expand Down Expand Up @@ -240,7 +231,6 @@ impl DiskImageBuilder {

let to = tftp_path.join(UEFI_TFTP_BOOT_FILENAME);
write_uefi_bootloader(&to)?;


for f in &self.files {
let to = tftp_path.join(f.0.deref());
Expand Down
16 changes: 9 additions & 7 deletions src/mbr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,19 @@ pub fn create_mbr_disk(
boot_partition_path: &Path,
out_mbr_path: &Path,
) -> anyhow::Result<()> {
let second_stage = File::open(second_stage_path).context("failed to open second stage binary")?;
let second_stage =
File::open(second_stage_path).context("failed to open second stage binary")?;
create_mbr_disk_with_readers(
File::open(bootsector_path).context("failed to open boot sector")?,
SecondStageData {
size: second_stage.metadata()
.context("failed to read file metadata of second stage")?
.len(),
reader: second_stage
size: second_stage
.metadata()
.context("failed to read file metadata of second stage")?
.len(),
reader: second_stage,
},
boot_partition_path,
out_mbr_path
out_mbr_path,
)
}

Expand All @@ -44,7 +46,7 @@ pub fn create_mbr_disk(
reader: Cursor::new(second_stage_binary),
},
boot_partition_path,
out_mbr_path
out_mbr_path,
)
}

Expand Down

0 comments on commit 8be2588

Please sign in to comment.