vmm_host: remove default implementation of protocol()

Having a default protocol implementation is dangerous, as implementors
can just ignore this method and return an erroneous type.

BUG=None
TEST=cargo build

Change-Id: Iee7dbcf563be1e5b15903b0fd7bdfb7ff5823545
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3565619
Reviewed-by: Keiichi Watanabe <keiichiw@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Noah Gold <nkgold@google.com>
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
This commit is contained in:
Alexandre Courbot 2022-03-30 15:22:11 +09:00 committed by Chromeos LUCI
parent 89f97d8178
commit f9eb7f26ea
2 changed files with 5 additions and 3 deletions

View file

@ -38,6 +38,10 @@ impl DummySlaveReqHandler {
}
impl VhostUserSlaveReqHandlerMut for DummySlaveReqHandler {
fn protocol(&self) -> Protocol {
Protocol::Regular
}
fn set_owner(&mut self) -> Result<()> {
if self.owned {
return Err(Error::InvalidOperation);

View file

@ -90,9 +90,7 @@ pub trait VhostUserSlaveReqHandler {
#[allow(missing_docs)]
pub trait VhostUserSlaveReqHandlerMut {
/// Returns the type of vhost-user protocol that the handler support.
fn protocol(&self) -> Protocol {
Protocol::Regular
}
fn protocol(&self) -> Protocol;
fn set_owner(&mut self) -> Result<()>;
fn reset_owner(&mut self) -> Result<()>;