Skip to content

Commit 566de7b

Browse files
committed
refactor(queue): make structs/fields public
Make some structs/fields public as following commits will need this. Signed-off-by: Egor Lazarchuk <[email protected]>
1 parent 49783e8 commit 566de7b

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/vmm/src/devices/virtio/queue.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ unsafe impl ByteValued for Descriptor {}
5959
/// https://docs.oasis-open.org/virtio/virtio/v1.1/csprd01/virtio-v1.1-csprd01.html#x1-430008
6060
/// 2.6.8 The Virtqueue Used Ring
6161
#[repr(C)]
62-
#[derive(Default, Clone, Copy)]
63-
struct UsedElement {
64-
id: u32,
65-
len: u32,
62+
#[derive(Default, Debug, Clone, Copy)]
63+
pub struct UsedElement {
64+
pub id: u32,
65+
pub len: u32,
6666
}
6767

6868
// SAFETY: `UsedElement` is a POD and contains no padding.
@@ -391,7 +391,7 @@ impl Queue {
391391
/// # Important
392392
/// This is an internal method that ASSUMES THAT THERE ARE AVAILABLE DESCRIPTORS. Otherwise it
393393
/// will retrieve a descriptor that contains garbage data (obsolete/empty).
394-
fn do_pop_unchecked<'b, M: GuestMemory>(
394+
pub fn do_pop_unchecked<'b, M: GuestMemory>(
395395
&mut self,
396396
mem: &'b M,
397397
) -> Option<DescriptorChain<'b, M>> {
@@ -485,7 +485,7 @@ impl Queue {
485485

486486
/// Read used element to the used ring at specified index.
487487
#[inline(always)]
488-
fn write_used_ring<M: GuestMemory>(
488+
pub fn write_used_ring<M: GuestMemory>(
489489
&self,
490490
mem: &M,
491491
index: u16,
@@ -575,7 +575,7 @@ impl Queue {
575575

576576
/// Helper method that writes to the `avail_event` field of the used ring.
577577
#[inline(always)]
578-
fn set_used_ring_avail_event<M: GuestMemory>(&mut self, avail_event: u16, mem: &M) {
578+
pub fn set_used_ring_avail_event<M: GuestMemory>(&mut self, avail_event: u16, mem: &M) {
579579
debug_assert!(self.is_layout_valid(mem));
580580

581581
// Used ring has layout:
@@ -598,7 +598,7 @@ impl Queue {
598598

599599
/// Helper method that writes to the `idx` field of the used ring.
600600
#[inline(always)]
601-
fn set_used_ring_idx<M: GuestMemory>(&mut self, next_used: u16, mem: &M) {
601+
pub fn set_used_ring_idx<M: GuestMemory>(&mut self, next_used: u16, mem: &M) {
602602
debug_assert!(self.is_layout_valid(mem));
603603

604604
// Used ring has layout:

0 commit comments

Comments
 (0)