Skip to content

Commit a3a9e0a

Browse files
committed
Change import styling
1 parent 5c64bf9 commit a3a9e0a

20 files changed

Lines changed: 164 additions & 178 deletions

pixie-uefi/src/export_cov.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use crate::os::{disk::Disk, UefiOS};
1+
use crate::os::disk::Disk;
2+
use crate::os::UefiOS;
23

34
pub async fn export(os: UefiOS) {
45
let mut disk = Disk::open_with_size(os, 500 << 20);

pixie-uefi/src/flash.rs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
1-
use crate::{
2-
os::{
3-
error::{Error, Result},
4-
memory, TcpStream, UefiOS, PACKET_SIZE,
5-
},
6-
MIN_MEMORY,
7-
};
8-
use alloc::{boxed::Box, collections::BTreeMap, rc::Rc, vec::Vec};
9-
use core::{cell::RefCell, mem, net::SocketAddrV4};
1+
use alloc::boxed::Box;
2+
use alloc::collections::BTreeMap;
3+
use alloc::rc::Rc;
4+
use alloc::vec::Vec;
5+
use core::cell::RefCell;
6+
use core::mem;
7+
use core::net::SocketAddrV4;
8+
109
use futures::future::{select, Either};
1110
use log::info;
1211
use lz4_flex::decompress;
13-
use pixie_shared::{
14-
chunk_codec::Decoder, util::BytesFmt, ChunkHash, Image, TcpRequest, UdpRequest, CHUNKS_PORT,
15-
MAX_CHUNK_SIZE,
16-
};
12+
use pixie_shared::chunk_codec::Decoder;
13+
use pixie_shared::util::BytesFmt;
14+
use pixie_shared::{ChunkHash, Image, TcpRequest, UdpRequest, CHUNKS_PORT, MAX_CHUNK_SIZE};
1715
use uefi::proto::console::text::Color;
1816

17+
use crate::os::error::{Error, Result};
18+
use crate::os::{memory, TcpStream, UefiOS, PACKET_SIZE};
19+
use crate::MIN_MEMORY;
20+
1921
async fn fetch_image(stream: &TcpStream) -> Result<Image> {
2022
let req = TcpRequest::GetImage;
2123
let mut buf = postcard::to_allocvec(&req)?;

pixie-uefi/src/main.rs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,20 @@
55
#[macro_use]
66
extern crate alloc;
77

8-
use crate::{
9-
flash::flash,
10-
os::{
11-
error::{Error, Result},
12-
TcpStream, UefiOS, PACKET_SIZE,
13-
},
14-
reboot_to_os::reboot_to_os,
15-
register::register,
16-
store::store,
17-
};
188
use alloc::boxed::Box;
199
use core::net::{Ipv4Addr, SocketAddrV4};
10+
2011
use futures::future::{self, Either};
2112
use pixie_shared::{Action, TcpRequest, UdpRequest, ACTION_PORT, PING_PORT};
2213
use uefi::{entry, Status};
2314

15+
use crate::flash::flash;
16+
use crate::os::error::{Error, Result};
17+
use crate::os::{TcpStream, UefiOS, PACKET_SIZE};
18+
use crate::reboot_to_os::reboot_to_os;
19+
use crate::register::register;
20+
use crate::store::store;
21+
2422
mod flash;
2523
mod os;
2624
mod parse_disk;

pixie-uefi/src/os/boot_options.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1+
use alloc::string::{String, ToString};
2+
use alloc::vec::Vec;
3+
4+
use uefi::proto::device_path::DevicePath;
5+
use uefi::runtime::{VariableAttributes, VariableVendor};
6+
use uefi::CString16;
7+
18
use super::UefiOS;
2-
use alloc::{
3-
string::{String, ToString},
4-
vec::Vec,
5-
};
6-
use uefi::{
7-
proto::device_path::DevicePath,
8-
runtime::{VariableAttributes, VariableVendor},
9-
CString16,
10-
};
119

1210
pub struct BootOptions {
1311
pub(super) os: UefiOS,

pixie-uefi/src/os/disk.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
use super::{error::Result, UefiOS};
2-
use alloc::{
3-
string::{String, ToString},
4-
vec::Vec,
5-
};
6-
use gpt_disk_io::{
7-
gpt_disk_types::{BlockSize, Lba},
8-
BlockIo,
9-
};
10-
use uefi::{
11-
boot::{OpenProtocolParams, ScopedProtocol},
12-
proto::media::block::BlockIO,
13-
Handle,
14-
};
1+
use alloc::string::{String, ToString};
2+
use alloc::vec::Vec;
3+
4+
use gpt_disk_io::gpt_disk_types::{BlockSize, Lba};
5+
use gpt_disk_io::BlockIo;
6+
use uefi::boot::{OpenProtocolParams, ScopedProtocol};
7+
use uefi::proto::media::block::BlockIO;
8+
use uefi::Handle;
9+
10+
use super::error::Result;
11+
use super::UefiOS;
1512

1613
fn open_disk(handle: Handle) -> Result<ScopedProtocol<BlockIO>> {
1714
let image_handle = uefi::boot::image_handle();

pixie-uefi/src/os/error.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
use alloc::{borrow::ToOwned, string::String};
1+
use alloc::borrow::ToOwned;
2+
use alloc::string::String;
23
use core::fmt::{Display, Formatter};
4+
35
use gpt_disk_io::gpt_disk_types;
46

57
pub type Result<T, E = Error> = core::result::Result<T, E>;

pixie-uefi/src/os/executor.rs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
use crate::os::timer::Timer;
1+
use alloc::boxed::Box;
2+
use alloc::collections::VecDeque;
3+
use alloc::sync::Arc;
4+
use alloc::task::Wake;
5+
use core::cell::RefCell;
6+
use core::future::Future;
7+
use core::pin::Pin;
8+
use core::task::{Context, Waker};
29

310
use super::sync::SyncRefCell;
4-
use alloc::{boxed::Box, collections::VecDeque, sync::Arc, task::Wake};
5-
use core::{
6-
cell::RefCell,
7-
future::Future,
8-
pin::Pin,
9-
task::{Context, Waker},
10-
};
11+
use crate::os::timer::Timer;
1112

1213
pub(super) type BoxFuture<T = ()> = Pin<Box<dyn Future<Output = T> + 'static>>;
1314

pixie-uefi/src/os/memory.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
use uefi::{boot::MemoryType, mem::memory_map::MemoryMap};
1+
use uefi::boot::MemoryType;
2+
use uefi::mem::memory_map::MemoryMap;
23

34
#[derive(Debug)]
45
pub struct MemoryStats {

pixie-uefi/src/os/mod.rs

Lines changed: 30 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,34 @@
1-
use self::{
2-
boot_options::BootOptions,
3-
disk::Disk,
4-
error::{Error, Result},
5-
executor::{Executor, Task},
6-
net::NetworkInterface,
7-
sync::SyncRefCell,
8-
timer::Timer,
9-
};
10-
use alloc::{
11-
boxed::Box,
12-
collections::VecDeque,
13-
string::{String, ToString},
14-
sync::Arc,
15-
vec::Vec,
16-
};
17-
use core::{
18-
cell::{Ref, RefMut},
19-
ffi::c_void,
20-
fmt::Write,
21-
future::{poll_fn, Future},
22-
net::SocketAddrV4,
23-
ptr::NonNull,
24-
task::Poll,
25-
};
1+
use alloc::boxed::Box;
2+
use alloc::collections::VecDeque;
3+
use alloc::string::{String, ToString};
4+
use alloc::sync::Arc;
5+
use alloc::vec::Vec;
6+
use core::cell::{Ref, RefMut};
7+
use core::ffi::c_void;
8+
use core::fmt::Write;
9+
use core::future::{poll_fn, Future};
10+
use core::net::SocketAddrV4;
11+
use core::ptr::NonNull;
12+
use core::task::Poll;
13+
2614
use pixie_shared::util::BytesFmt;
27-
use uefi::{
28-
boot::{EventType, ScopedProtocol, TimerTrigger, Tpl},
29-
proto::{
30-
console::{
31-
serial::Serial,
32-
text::{Color, Input, Key, Output},
33-
},
34-
device_path::{
35-
build::DevicePathBuilder,
36-
text::{AllowShortcuts, DevicePathToText, DisplayOnly},
37-
DevicePath,
38-
},
39-
Protocol,
40-
},
41-
runtime::{VariableAttributes, VariableVendor},
42-
CStr16, Event, Handle, Status,
43-
};
15+
use uefi::boot::{EventType, ScopedProtocol, TimerTrigger, Tpl};
16+
use uefi::proto::console::serial::Serial;
17+
use uefi::proto::console::text::{Color, Input, Key, Output};
18+
use uefi::proto::device_path::build::DevicePathBuilder;
19+
use uefi::proto::device_path::text::{AllowShortcuts, DevicePathToText, DisplayOnly};
20+
use uefi::proto::device_path::DevicePath;
21+
use uefi::proto::Protocol;
22+
use uefi::runtime::{VariableAttributes, VariableVendor};
23+
use uefi::{CStr16, Event, Handle, Status};
24+
25+
use self::boot_options::BootOptions;
26+
use self::disk::Disk;
27+
use self::error::{Error, Result};
28+
use self::executor::{Executor, Task};
29+
use self::net::NetworkInterface;
30+
use self::sync::SyncRefCell;
31+
use self::timer::Timer;
4432

4533
mod boot_options;
4634
pub mod disk;

pixie-uefi/src/os/net.rs

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,25 @@
1-
use crate::os::timer::rdtsc;
2-
3-
use super::{
4-
error::{Error, Result},
5-
timer::Timer,
6-
UefiOS,
7-
};
81
use alloc::boxed::Box;
9-
use core::{
10-
future::poll_fn,
11-
net::{IpAddr, Ipv4Addr, SocketAddrV4},
12-
task::Poll,
13-
};
2+
use core::future::poll_fn;
3+
use core::net::{IpAddr, Ipv4Addr, SocketAddrV4};
4+
use core::task::Poll;
5+
146
use futures::future::select;
15-
use smoltcp::{
16-
iface::{Config, Interface, PollResult, SocketHandle, SocketSet},
17-
phy::{Device, DeviceCapabilities, Medium, RxToken, TxToken},
18-
socket::{
19-
dhcpv4::{Event, Socket as Dhcpv4Socket},
20-
tcp::{Socket as TcpSocket, State},
21-
udp::{self, Socket as UdpSocket},
22-
},
23-
storage::RingBuffer,
24-
time::{Duration, Instant},
25-
wire::{DhcpOption, HardwareAddress, IpCidr, IpEndpoint},
26-
};
27-
use uefi::{
28-
boot::ScopedProtocol,
29-
proto::network::snp::{ReceiveFlags, SimpleNetwork},
30-
Status,
31-
};
7+
use smoltcp::iface::{Config, Interface, PollResult, SocketHandle, SocketSet};
8+
use smoltcp::phy::{Device, DeviceCapabilities, Medium, RxToken, TxToken};
9+
use smoltcp::socket::dhcpv4::{Event, Socket as Dhcpv4Socket};
10+
use smoltcp::socket::tcp::{Socket as TcpSocket, State};
11+
use smoltcp::socket::udp::{self, Socket as UdpSocket};
12+
use smoltcp::storage::RingBuffer;
13+
use smoltcp::time::{Duration, Instant};
14+
use smoltcp::wire::{DhcpOption, HardwareAddress, IpCidr, IpEndpoint};
15+
use uefi::boot::ScopedProtocol;
16+
use uefi::proto::network::snp::{ReceiveFlags, SimpleNetwork};
17+
use uefi::Status;
18+
19+
use super::error::{Error, Result};
20+
use super::timer::Timer;
21+
use super::UefiOS;
22+
use crate::os::timer::rdtsc;
3223

3324
pub const PACKET_SIZE: usize = 1514;
3425

0 commit comments

Comments
 (0)