diff --git a/common/src/dma.rs b/common/src/dma.rs index fef60d04e0..fbeb74bf96 100644 --- a/common/src/dma.rs +++ b/common/src/dma.rs @@ -3,7 +3,7 @@ use std::ops::{Deref, DerefMut}; use std::ptr; use libredox::call::MmapArgs; -use libredox::{flag, error::Result, Fd}; +use libredox::{error::Result, flag, Fd}; use syscall::PAGE_SIZE; use crate::MemoryType; @@ -34,7 +34,7 @@ fn alloc_and_map(length: usize) -> Result<(usize, *mut ())> { let fd = phys_contiguous_fd()?; let virt = libredox::call::mmap(MmapArgs { fd: fd.raw(), - offset: 0, // ignored + offset: 0, // ignored addr: core::ptr::null_mut(), // ignored length, flags: flag::MAP_PRIVATE, @@ -42,7 +42,11 @@ fn alloc_and_map(length: usize) -> Result<(usize, *mut ())> { })?; let phys = syscall::virttophys(virt as usize)?; for i in 1..length.div_ceil(PAGE_SIZE) { - debug_assert_eq!(syscall::virttophys(virt as usize + i * PAGE_SIZE), Ok(phys + i * PAGE_SIZE), "NOT CONTIGUOUS"); + debug_assert_eq!( + syscall::virttophys(virt as usize + i * PAGE_SIZE), + Ok(phys + i * PAGE_SIZE), + "NOT CONTIGUOUS" + ); } Ok((phys, virt as *mut ())) } diff --git a/common/src/lib.rs b/common/src/lib.rs index c96e3e8c4e..7403ce4793 100644 --- a/common/src/lib.rs +++ b/common/src/lib.rs @@ -1,8 +1,8 @@ #![feature(int_roundings)] use libredox::call::MmapArgs; -use libredox::{Fd, error::*, errno::EINVAL}; use libredox::flag::{self, O_CLOEXEC, O_RDONLY, O_RDWR, O_WRONLY}; +use libredox::{errno::EINVAL, error::*, Fd}; use syscall::PAGE_SIZE; pub mod dma; diff --git a/common/src/sgl.rs b/common/src/sgl.rs index 236ab85a05..cdd043415c 100644 --- a/common/src/sgl.rs +++ b/common/src/sgl.rs @@ -35,7 +35,8 @@ impl Sgl { offset: 0, fd: !0, addr: core::ptr::null_mut(), - })?.cast::(); + })? + .cast::(); let mut this = Self { virt, @@ -51,7 +52,9 @@ impl Sgl { let mut offset = 0; while offset < unaligned_length.get() { - let chunk_length = (aligned_length - offset).min(MAX_ALLOC_SIZE).next_power_of_two(); + let chunk_length = (aligned_length - offset) + .min(MAX_ALLOC_SIZE) + .next_power_of_two(); libredox::call::mmap(MmapArgs { addr: virt.add(offset).cast(), flags: MAP_PRIVATE | (MAP_FIXED.bits() as u32), @@ -62,7 +65,12 @@ impl Sgl { offset: 0, })?; let phys = syscall::virttophys(virt as usize + offset)?; - this.chunks.push(Chunk { offset, phys, length: (unaligned_length.get() - offset).min(chunk_length), virt: virt.add(offset) }); + this.chunks.push(Chunk { + offset, + phys, + length: (unaligned_length.get() - offset).min(chunk_length), + virt: virt.add(offset), + }); offset += chunk_length; } diff --git a/fmt.sh b/fmt.sh index f62b954766..597ef30965 100755 --- a/fmt.sh +++ b/fmt.sh @@ -16,7 +16,8 @@ function fmt() { done } -fmt graphics/bgad \ +fmt common \ + graphics/bgad \ graphics/fbcond \ graphics/vesad \ graphics/virtio-gpud \