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:
Rob Bradford
2026-03-26 08:49:29 -07:00
parent bd56214d54
commit 3e233af654

View File

@@ -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;
}