From d80ac43ef12cad4871a905636f9940d7c29b6172 Mon Sep 17 00:00:00 2001 From: Sebastien Boeuf Date: Tue, 17 Sep 2019 07:35:03 -0700 Subject: [PATCH] vhost_user_backend: Remove useless started field The Queue structure already contains a field "ready" that can be used to track the status of the vrings. Signed-off-by: Sebastien Boeuf --- vhost_user_backend/src/lib.rs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/vhost_user_backend/src/lib.rs b/vhost_user_backend/src/lib.rs index e346610a6..883ca811a 100644 --- a/vhost_user_backend/src/lib.rs +++ b/vhost_user_backend/src/lib.rs @@ -210,7 +210,6 @@ struct Vring { kick: Option, call: Option, err: Option, - started: bool, enabled: bool, } @@ -221,7 +220,6 @@ impl Vring { kick: None, call: None, err: None, - started: false, enabled: false, } } @@ -711,12 +709,12 @@ impl VhostUserSlaveReqHandler for VhostUserHandler { if index as usize >= self.num_queues { return Err(VhostUserError::InvalidParam); } - // Quotation from vhost-user spec: + // Quote from vhost-user specification: // Client must start ring upon receiving a kick (that is, detecting // that file descriptor is readable) on the descriptor specified by // VHOST_USER_SET_VRING_KICK, and stop ring upon receiving // VHOST_USER_GET_VRING_BASE. - self.vrings[index as usize].write().unwrap().started = false; + self.vrings[index as usize].write().unwrap().queue.ready = false; self.vring_handler .read() .unwrap() @@ -747,14 +745,12 @@ impl VhostUserSlaveReqHandler for VhostUserHandler { self.vrings[index as usize].write().unwrap().kick = fd.map(|x| unsafe { EventFd::from_raw_fd(x) }); - // Quotation from vhost-user spec: + // Quote from vhost-user specification: // Client must start ring upon receiving a kick (that is, detecting // that file descriptor is readable) on the descriptor specified by // VHOST_USER_SET_VRING_KICK, and stop ring upon receiving // VHOST_USER_GET_VRING_BASE. - // - // So we should add fd to event monitor(select, poll, epoll) here. - self.vrings[index as usize].write().unwrap().started = true; + self.vrings[index as usize].write().unwrap().queue.ready = true; self.vring_handler .read() .unwrap()