Skip to content

Commit caf306d

Browse files
committed
move get/set_status from the VhostVdpa implementations
I can't figure out where these move to but weirdly things compile when everything is commented out so what gives?
1 parent 427d844 commit caf306d

File tree

1 file changed

+19
-16
lines changed

1 file changed

+19
-16
lines changed

crates/vhost/src/vhost_kern/vdpa.rs

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,25 @@ impl<AS: GuestAddressSpace> VhostKernVdpa<AS> {
9191
}
9292
}
9393

94+
//impl<T: VhostKernBackend> VhostBackend for T {
95+
// impl<AS: GuestAddressSpace> VhostBackend for VhostKernVdpa<AS> {
96+
// fn get_status(&self) -> Result<u8> {
97+
// let mut status: u8 = 0;
98+
99+
// // SAFETY: This ioctl is called on a valid vhost-vdpa fd and has its
100+
// // return value checked.
101+
// let ret = unsafe { ioctl_with_mut_ref(self, VHOST_VDPA_GET_STATUS(), &mut status) };
102+
// ioctl_result(ret, status)
103+
// }
104+
105+
// fn set_status(&self, status: u8) -> Result<()> {
106+
// // SAFETY: This ioctl is called on a valid vhost-vdpa fd and has its
107+
// // return value checked.
108+
// let ret = unsafe { ioctl_with_ref(self, VHOST_VDPA_SET_STATUS(), &status) };
109+
// ioctl_result(ret, ())
110+
// }
111+
// }
112+
94113
impl<AS: GuestAddressSpace> VhostVdpa for VhostKernVdpa<AS> {
95114
fn get_device_id(&self) -> Result<u32> {
96115
let mut device_id: u32 = 0;
@@ -101,22 +120,6 @@ impl<AS: GuestAddressSpace> VhostVdpa for VhostKernVdpa<AS> {
101120
ioctl_result(ret, device_id)
102121
}
103122

104-
fn get_status(&self) -> Result<u8> {
105-
let mut status: u8 = 0;
106-
107-
// SAFETY: This ioctl is called on a valid vhost-vdpa fd and has its
108-
// return value checked.
109-
let ret = unsafe { ioctl_with_mut_ref(self, VHOST_VDPA_GET_STATUS(), &mut status) };
110-
ioctl_result(ret, status)
111-
}
112-
113-
fn set_status(&self, status: u8) -> Result<()> {
114-
// SAFETY: This ioctl is called on a valid vhost-vdpa fd and has its
115-
// return value checked.
116-
let ret = unsafe { ioctl_with_ref(self, VHOST_VDPA_SET_STATUS(), &status) };
117-
ioctl_result(ret, ())
118-
}
119-
120123
fn get_config(&self, offset: u32, buffer: &mut [u8]) -> Result<()> {
121124
let mut config = VhostVdpaConfig::new(buffer.len())
122125
.map_err(|_| Error::IoctlError(IOError::from_raw_os_error(libc::ENOMEM)))?;

0 commit comments

Comments
 (0)