Rename the methods in the interface of VirtioTransport

This commit is contained in:
Cautreoxit
2024-11-14 21:05:38 +08:00
committed by Tate, Hongliang Tian
parent 300403e3eb
commit 3cb7f5b721
6 changed files with 23 additions and 20 deletions

View File

@ -410,7 +410,7 @@ impl DeviceInner {
/// Flushes any cached data from the guest to the persistent storage on the host.
/// This will be ignored if the device doesn't support the `VIRTIO_BLK_F_FLUSH` feature.
fn flush(&self, bio_request: BioRequest) {
if self.transport.lock().device_features() & BlockFeatures::FLUSH.bits() == 0 {
if self.transport.lock().read_device_features() & BlockFeatures::FLUSH.bits() == 0 {
bio_request.bios().for_each(|bio| {
bio.complete(BioStatus::Complete);
});

View File

@ -51,7 +51,7 @@ impl NetworkDevice {
pub fn init(mut transport: Box<dyn VirtioTransport>) -> Result<(), VirtioDeviceError> {
let virtio_net_config = VirtioNetConfig::new(transport.as_mut());
let features = NetworkFeatures::from_bits_truncate(Self::negotiate_features(
transport.device_features(),
transport.read_device_features(),
));
debug!("virtio_net_config = {:?}", virtio_net_config);
debug!("features = {:?}", features);