lanzaboote: reorganize to avoid explicit drops
This commit is contained in:
parent
702a38398f
commit
95a03d69bb
|
@ -84,35 +84,33 @@ fn main(handle: Handle, mut system_table: SystemTable<Boot>) -> Status {
|
||||||
EmbeddedConfiguration::new(&mut booted_image_file(system_table.boot_services()).unwrap())
|
EmbeddedConfiguration::new(&mut booted_image_file(system_table.boot_services()).unwrap())
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut file_system = system_table
|
let mut kernel_file;
|
||||||
.boot_services()
|
let initrd = {
|
||||||
.get_image_file_system(handle)
|
let mut file_system = system_table
|
||||||
.unwrap();
|
.boot_services()
|
||||||
let mut root = file_system.open_volume().unwrap();
|
.get_image_file_system(handle)
|
||||||
|
.unwrap();
|
||||||
|
let mut root = file_system.open_volume().unwrap();
|
||||||
|
|
||||||
let mut kernel_file = root
|
kernel_file = root
|
||||||
.open(
|
.open(
|
||||||
&config.kernel_filename,
|
&config.kernel_filename,
|
||||||
FileMode::Read,
|
FileMode::Read,
|
||||||
FileAttribute::empty(),
|
FileAttribute::empty(),
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_regular_file()
|
.into_regular_file()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let initrd = root
|
root.open(
|
||||||
.open(
|
|
||||||
&config.initrd_filename,
|
&config.initrd_filename,
|
||||||
FileMode::Read,
|
FileMode::Read,
|
||||||
FileAttribute::empty(),
|
FileAttribute::empty(),
|
||||||
)
|
)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.into_regular_file()
|
.into_regular_file()
|
||||||
.unwrap();
|
.unwrap()
|
||||||
|
};
|
||||||
// We need to manually drop those to be able to touch the system_table again.
|
|
||||||
drop(root);
|
|
||||||
drop(file_system);
|
|
||||||
|
|
||||||
let kernel_cmdline = booted_image_cmdline(system_table.boot_services()).unwrap();
|
let kernel_cmdline = booted_image_cmdline(system_table.boot_services()).unwrap();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue