Skip to content

Commit 1e648ca

Browse files
committed
nvme: fix indentation
1 parent 255dbf7 commit 1e648ca

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/drivers/nvme.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ use memory_addresses::VirtAddr;
1010
use pci_types::InterruptLine;
1111
use vroom::{Dma, IoQueuePair, IoQueuePairId, Namespace, NamespaceId, NvmeDevice};
1212

13-
use crate::arch::mm::paging::{virtual_to_physical, BasePageSize, PageSize};
13+
use crate::arch::mm::paging::{BasePageSize, PageSize, virtual_to_physical};
1414
use crate::arch::pci::PciConfigRegion;
15-
use crate::drivers::pci::PciDevice;
1615
use crate::drivers::Driver;
16+
use crate::drivers::pci::PciDevice;
1717
use crate::mm::device_alloc::DeviceAlloc;
1818
use crate::syscalls::nvme::SysNvmeError;
1919

@@ -264,7 +264,7 @@ impl vroom::Allocator for NvmeAllocator {
264264
) -> Result<*mut [T], Box<dyn core::error::Error>> {
265265
debug!("NVMe driver: allocate size {:#x}", layout.size());
266266
let Ok(memory) = self.device_allocator.allocate(layout) else {
267-
return Err("NVMe driver: Could not allocate memory with device allocator.".into());
267+
return Err("NVMe driver: Could not allocate memory with device allocator.".into());
268268
};
269269
self.allocations
270270
.lock()
@@ -301,10 +301,10 @@ impl vroom::Allocator for NvmeAllocator {
301301
debug!("NVMe driver: translate virtual address {address:#x}");
302302
let virtual_address: VirtAddr = VirtAddr::new(address as u64);
303303
let Some(physical_address) = virtual_to_physical(virtual_address) else {
304-
return Err(
305-
"NVMe driver: The given virtual address could not be mapped to a physical one."
306-
.into(),
307-
);
304+
return Err(
305+
"NVMe driver: The given virtual address could not be mapped to a physical one."
306+
.into(),
307+
);
308308
};
309309
Ok(physical_address.as_usize() as *mut T)
310310
}

src/drivers/pci.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ impl<T: ConfigRegionAccess> fmt::Display for PciDevice<T> {
242242

243243
#[cfg(not(feature = "pci-ids"))]
244244
let (class_name, vendor_name, device_name) =
245-
("Unknown Class", "Unknown Vendor", "Unknown Device");
245+
("Unknown Class", "Unknown Vendor", "Unknown Device");
246246

247247
// Output detailed readable information about this device.
248248
write!(
@@ -414,6 +414,7 @@ impl PciDriver {
414414
fn nvme_handler() {}
415415
(irq_number, nvme_handler)
416416
}
417+
_ => todo!(),
417418
}
418419
}
419420
}

src/syscalls/nvme.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ pub unsafe extern "C" fn sys_nvme_namespace_ids(
5454
if namespace_ids.len() != length as usize {
5555
return Err(SysNvmeError::BufferIncorrectlySized);
5656
}
57-
for (i, namespace_id) in namespace_ids.iter().enumerate().take(length as usize) {
58-
let pointer = unsafe { vec_pointer.add(i) };
59-
unsafe { *pointer = *namespace_id };
60-
}
57+
for (i, namespace_id) in namespace_ids.iter().enumerate().take(length as usize) {
58+
let pointer = unsafe { vec_pointer.add(i) };
59+
unsafe { *pointer = *namespace_id };
60+
}
6161
Ok(())
6262
}
6363
match inner(vec_pointer, length) {
@@ -235,7 +235,7 @@ pub unsafe extern "C" fn sys_nvme_deallocate_buffer(
235235
buffer: *mut Dma<u8>,
236236
) -> usize {
237237
fn inner(io_queue_pair_id: &IoQueuePairId, buffer: *mut Dma<u8>) -> Result<(), SysNvmeError> {
238-
let _ = buffer;
238+
let _ = buffer;
239239
let buffer: Dma<u8> = unsafe { core::ptr::read(buffer) };
240240
let driver = get_nvme_driver().ok_or(SysNvmeError::DeviceDoesNotExist)?;
241241
driver.lock().deallocate_buffer(io_queue_pair_id, buffer)

0 commit comments

Comments
 (0)