mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-08-20 15:01:16 +00:00
vm-virtio: Fix VirtioDeviceType traits
The From and Display traits were not handling some of the enum definitions. We no longer have a default case for Display so any future misses will fail at build time. Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
9d775a140f
commit
c2f6dfce88
@ -85,6 +85,7 @@ impl From<u32> for VirtioDeviceType {
|
|||||||
match t {
|
match t {
|
||||||
1 => VirtioDeviceType::TYPE_NET,
|
1 => VirtioDeviceType::TYPE_NET,
|
||||||
2 => VirtioDeviceType::TYPE_BLOCK,
|
2 => VirtioDeviceType::TYPE_BLOCK,
|
||||||
|
3 => VirtioDeviceType::TYPE_CONSOLE,
|
||||||
4 => VirtioDeviceType::TYPE_RNG,
|
4 => VirtioDeviceType::TYPE_RNG,
|
||||||
5 => VirtioDeviceType::TYPE_BALLOON,
|
5 => VirtioDeviceType::TYPE_BALLOON,
|
||||||
9 => VirtioDeviceType::TYPE_9P,
|
9 => VirtioDeviceType::TYPE_9P,
|
||||||
@ -107,14 +108,17 @@ impl fmt::Display for VirtioDeviceType {
|
|||||||
let output = match *self {
|
let output = match *self {
|
||||||
VirtioDeviceType::TYPE_NET => "net",
|
VirtioDeviceType::TYPE_NET => "net",
|
||||||
VirtioDeviceType::TYPE_BLOCK => "block",
|
VirtioDeviceType::TYPE_BLOCK => "block",
|
||||||
|
VirtioDeviceType::TYPE_CONSOLE => "console",
|
||||||
VirtioDeviceType::TYPE_RNG => "rng",
|
VirtioDeviceType::TYPE_RNG => "rng",
|
||||||
VirtioDeviceType::TYPE_BALLOON => "balloon",
|
VirtioDeviceType::TYPE_BALLOON => "balloon",
|
||||||
VirtioDeviceType::TYPE_GPU => "gpu",
|
VirtioDeviceType::TYPE_GPU => "gpu",
|
||||||
VirtioDeviceType::TYPE_9P => "9p",
|
VirtioDeviceType::TYPE_9P => "9p",
|
||||||
|
VirtioDeviceType::TYPE_INPUT => "input",
|
||||||
VirtioDeviceType::TYPE_VSOCK => "vsock",
|
VirtioDeviceType::TYPE_VSOCK => "vsock",
|
||||||
|
VirtioDeviceType::TYPE_IOMMU => "iommu",
|
||||||
VirtioDeviceType::TYPE_FS => "fs",
|
VirtioDeviceType::TYPE_FS => "fs",
|
||||||
VirtioDeviceType::TYPE_PMEM => "pmem",
|
VirtioDeviceType::TYPE_PMEM => "pmem",
|
||||||
_ => return Err(std::fmt::Error),
|
VirtioDeviceType::TYPE_UNKNOWN => "UNKNOWN",
|
||||||
};
|
};
|
||||||
write!(f, "{}", output)
|
write!(f, "{}", output)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user