mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
virtio-devices: vhost_user: Access acked_protocol_features directly
In GenericVhostUser's read_config and write_config, access vu_common.acked_protocol_features directly instead of going through the state() method which creates a struct. This removes creating the struct just to access two fields that are already directly accessible. Signed-off-by: Rob Bradford <rbradford@meta.com>
This commit is contained in:
@@ -213,7 +213,8 @@ impl VirtioDevice for GenericVhostUser {
|
||||
}
|
||||
|
||||
fn read_config(&self, offset: u64, data: &mut [u8]) {
|
||||
if (VhostUserProtocolFeatures::CONFIG.bits() & self.state().acked_protocol_features) == 0 {
|
||||
if (VhostUserProtocolFeatures::CONFIG.bits() & self.vu_common.acked_protocol_features) == 0
|
||||
{
|
||||
self.warn_no_config_access();
|
||||
|
||||
data.fill(0xFF);
|
||||
@@ -240,7 +241,8 @@ impl VirtioDevice for GenericVhostUser {
|
||||
}
|
||||
|
||||
fn write_config(&mut self, offset: u64, data: &[u8]) {
|
||||
if (VhostUserProtocolFeatures::CONFIG.bits() & self.state().acked_protocol_features) == 0 {
|
||||
if (VhostUserProtocolFeatures::CONFIG.bits() & self.vu_common.acked_protocol_features) == 0
|
||||
{
|
||||
self.warn_no_config_access();
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user