Implement AsRawFd for VringEpollHandler
In order to let the consumer of the crate access directly the file descriptor related to the VringEpollHandler, we implement the AsRawFd trait. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
9517235567
commit
1c4ee49a89
2 changed files with 9 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"coverage_score": 85.0,
|
||||
"coverage_score": 85.1,
|
||||
"exclude_path": "",
|
||||
"crate_features": ""
|
||||
}
|
||||
|
|
|
|||
|
|
@ -226,6 +226,12 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
impl<S, V, B> AsRawFd for VringEpollHandler<S, V, B> {
|
||||
fn as_raw_fd(&self) -> RawFd {
|
||||
self.epoll.as_raw_fd()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::super::backend::tests::MockVhostBackend;
|
||||
|
|
@ -269,5 +275,7 @@ mod tests {
|
|||
handler
|
||||
.unregister_listener(eventfd.as_raw_fd(), EventSet::IN, 1)
|
||||
.unwrap_err();
|
||||
// Check we retrieve the correct file descriptor
|
||||
assert_eq!(handler.as_raw_fd(), handler.epoll.as_raw_fd());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue