Skip to content

Commit

Permalink
Merge pull request #1515 from hermit-os/virtqueue-len-u32
Browse files Browse the repository at this point in the history
fix(virtqueue): make `BufferElem::{len,capacity}` return `u32`
  • Loading branch information
mkroening authored Dec 18, 2024
2 parents be6c4dd + 1516d63 commit 135f0b2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/drivers/virtio/virtqueue/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ trait VirtqPrivate {
paging::virt_to_phys(VirtAddr::from_ptr(mem_descr.addr()))
.as_u64()
.into(),
u32::from(len).into(),
len.into(),
incomplete_flags | virtq::DescF::NEXT,
)
});
Expand Down Expand Up @@ -356,7 +356,7 @@ impl BufferElem {
// should be only relevant for read buffer elements, which should not be uninit.
// If the element belongs to a write buffer, it is likely that [Self::capacity]
// is more appropriate.
pub fn len(&self) -> u16 {
pub fn len(&self) -> u32 {
match self {
BufferElem::Sized(sized) => mem::size_of_val(sized.as_ref()),
BufferElem::Vector(vec) => vec.len(),
Expand All @@ -365,7 +365,7 @@ impl BufferElem {
.unwrap()
}

pub fn capacity(&self) -> u16 {
pub fn capacity(&self) -> u32 {
match self {
BufferElem::Sized(sized) => mem::size_of_val(sized.as_ref()),
BufferElem::Vector(vec) => vec.capacity(),
Expand Down

0 comments on commit 135f0b2

Please sign in to comment.