mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-10-05 21:15:45 +00:00
block_util: Address Rust 1.51.0 clippy issue (upper_case_acronyms)
error: name `TYPE_UNKNOWN` contains a capitalized acronym --> vm-virtio/src/lib.rs:48:5 | 48 | TYPE_UNKNOWN = 0xFF, | ^^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `Type_Unknown` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms error: name `GetDeviceID` contains a capitalized acronym --> block_util/src/lib.rs:138:5 | 138 | GetDeviceID, | ^^^^^^^^^^^ help: consider making the acronym lowercase, except the initial letter: `GetDeviceId` | = note: `-D clippy::upper-case-acronyms` implied by `-D warnings` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#upper_case_acronyms Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
aa34d545f6
commit
6dc3d60b2d
@ -135,7 +135,7 @@ pub enum RequestType {
|
|||||||
In,
|
In,
|
||||||
Out,
|
Out,
|
||||||
Flush,
|
Flush,
|
||||||
GetDeviceID,
|
GetDeviceId,
|
||||||
Unsupported(u32),
|
Unsupported(u32),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ pub fn request_type(
|
|||||||
VIRTIO_BLK_T_IN => Ok(RequestType::In),
|
VIRTIO_BLK_T_IN => Ok(RequestType::In),
|
||||||
VIRTIO_BLK_T_OUT => Ok(RequestType::Out),
|
VIRTIO_BLK_T_OUT => Ok(RequestType::Out),
|
||||||
VIRTIO_BLK_T_FLUSH => Ok(RequestType::Flush),
|
VIRTIO_BLK_T_FLUSH => Ok(RequestType::Flush),
|
||||||
VIRTIO_BLK_T_GET_ID => Ok(RequestType::GetDeviceID),
|
VIRTIO_BLK_T_GET_ID => Ok(RequestType::GetDeviceId),
|
||||||
t => Ok(RequestType::Unsupported(t)),
|
t => Ok(RequestType::Unsupported(t)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -214,7 +214,7 @@ impl Request {
|
|||||||
if !desc.is_write_only() && req.request_type == RequestType::In {
|
if !desc.is_write_only() && req.request_type == RequestType::In {
|
||||||
return Err(Error::UnexpectedReadOnlyDescriptor);
|
return Err(Error::UnexpectedReadOnlyDescriptor);
|
||||||
}
|
}
|
||||||
if !desc.is_write_only() && req.request_type == RequestType::GetDeviceID {
|
if !desc.is_write_only() && req.request_type == RequestType::GetDeviceId {
|
||||||
return Err(Error::UnexpectedReadOnlyDescriptor);
|
return Err(Error::UnexpectedReadOnlyDescriptor);
|
||||||
}
|
}
|
||||||
req.data_descriptors.push((desc.addr, desc.len));
|
req.data_descriptors.push((desc.addr, desc.len));
|
||||||
@ -280,7 +280,7 @@ impl Request {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RequestType::Flush => disk.flush().map_err(ExecuteError::Flush)?,
|
RequestType::Flush => disk.flush().map_err(ExecuteError::Flush)?,
|
||||||
RequestType::GetDeviceID => {
|
RequestType::GetDeviceId => {
|
||||||
if (*data_len as usize) < disk_id.len() {
|
if (*data_len as usize) < disk_id.len() {
|
||||||
return Err(ExecuteError::BadRequest(Error::InvalidOffset));
|
return Err(ExecuteError::BadRequest(Error::InvalidOffset));
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ impl Request {
|
|||||||
.fsync(Some(user_data))
|
.fsync(Some(user_data))
|
||||||
.map_err(ExecuteError::AsyncFlush)?;
|
.map_err(ExecuteError::AsyncFlush)?;
|
||||||
}
|
}
|
||||||
RequestType::GetDeviceID => {
|
RequestType::GetDeviceId => {
|
||||||
let (data_addr, data_len) = if self.data_descriptors.len() == 1 {
|
let (data_addr, data_len) = if self.data_descriptors.len() == 1 {
|
||||||
(self.data_descriptors[0].0, self.data_descriptors[0].1)
|
(self.data_descriptors[0].0, self.data_descriptors[0].1)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user