Skip to content

Added function get_enabled to export vring enable status. #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions vhost-user-backend/src/vring.rs
Original file line number Diff line number Diff line change
@@ -61,6 +61,9 @@ pub trait VringT<M: GuestAddressSpace>:
/// Set vring enabled state.
fn set_enabled(&self, enabled: bool);

/// Get vring enabled state.
fn get_enabled(&self) -> bool;

/// Set queue addresses for descriptor table, available ring and used ring.
fn set_queue_info(
&self,
@@ -174,6 +177,10 @@ impl<M: GuestAddressSpace> VringState<M> {
self.enabled = enabled;
}

pub fn get_enabled(&self) -> bool {
self.enabled
}

/// Set queue addresses for descriptor table, available ring and used ring.
pub fn set_queue_info(
&mut self,
@@ -327,6 +334,10 @@ impl<M: 'static + GuestAddressSpace> VringT<M> for VringMutex<M> {
self.lock().set_enabled(enabled)
}

fn get_enabled(&self) -> bool {
self.get_ref().enabled
}

fn set_queue_info(
&self,
desc_table: u64,
@@ -442,6 +453,10 @@ impl<M: 'static + GuestAddressSpace> VringT<M> for VringRwLock<M> {
self.write_lock().set_enabled(enabled)
}

fn get_enabled(&self) -> bool {
self.get_ref().enabled
}

fn set_queue_info(
&self,
desc_table: u64,