misc: Fix clippy issues

Signed-off-by: Bo Chen <chen.bo@intel.com>
This commit is contained in:
Bo Chen
2022-11-01 14:52:40 -07:00
committed by Sebastien Boeuf
parent 9266ea4995
commit a9ec0f33c0
35 changed files with 78 additions and 92 deletions

View File

@@ -140,7 +140,7 @@ impl Blk {
}
let config_len = mem::size_of::<VirtioBlockConfig>();
let config_space: Vec<u8> = vec![0u8; config_len as usize];
let config_space: Vec<u8> = vec![0u8; config_len];
let (_, config_space) = vu
.socket_handle()
.get_config(

View File

@@ -232,20 +232,13 @@ impl VhostUserMasterReqHandler for SlaveReqHandler {
pwrite64(
fd.as_raw_fd(),
ptr as *const c_void,
len as usize,
len,
foffset as off64_t,
)
}
} else {
debug!("read: foffset={}, len={}", foffset, len);
unsafe {
pread64(
fd.as_raw_fd(),
ptr as *mut c_void,
len as usize,
foffset as off64_t,
)
}
unsafe { pread64(fd.as_raw_fd(), ptr as *mut c_void, len, foffset as off64_t) }
};
if ret < 0 {

View File

@@ -68,7 +68,7 @@ impl VhostUserHandle {
let vhost_user_net_reg = VhostUserMemoryRegionInfo {
guest_phys_addr: region.start_addr().raw_value(),
memory_size: region.len() as u64,
memory_size: region.len(),
userspace_addr: region.as_ptr() as u64,
mmap_offset,
mmap_handle,
@@ -92,7 +92,7 @@ impl VhostUserHandle {
let region = VhostUserMemoryRegionInfo {
guest_phys_addr: region.start_addr().raw_value(),
memory_size: region.len() as u64,
memory_size: region.len(),
userspace_addr: region.as_ptr() as u64,
mmap_offset,
mmap_handle,