vm_resource/
kind.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! Resource kind definitions that are used by multiple devices.
5//!
6//! This exists as a convenient place to define resource kinds without creating
7//! a new crate or putting them in a crate that has a lot of unnecessary build
8//! dependencies.
9//!
10//! Not all resource kinds need to be defined here. If you are adding a new kind
11//! and there is a more natural resource crate to put the kind definition in,
12//! put it there. For example, if you are defining a resource kind for a
13//! resource kind specific to a single device, put it in the resource crate for
14//! that device.
15
16use crate::ResourceKind;
17
18/// A resource kind for chipset device handles.
19pub enum ChipsetDeviceHandleKind {}
20
21impl ResourceKind for ChipsetDeviceHandleKind {
22    const NAME: &'static str = "chipset_device_handle";
23}
24
25/// A resource kind for keyboard input source handles.
26pub enum KeyboardInputHandleKind {}
27
28impl ResourceKind for KeyboardInputHandleKind {
29    const NAME: &'static str = "keyboard_input_handle";
30}
31
32/// A resource kind for mouse input source handles.
33pub enum MouseInputHandleKind {}
34
35impl ResourceKind for MouseInputHandleKind {
36    const NAME: &'static str = "mouse_input_handle";
37}
38
39/// Resource kind for network endpoints.
40pub enum NetEndpointHandleKind {}
41
42impl ResourceKind for NetEndpointHandleKind {
43    const NAME: &'static str = "net_endpoint_handle";
44}
45
46/// A resource kind for PCI device handles.
47pub enum PciDeviceHandleKind {}
48
49impl ResourceKind for PciDeviceHandleKind {
50    const NAME: &'static str = "pci_device_handle";
51}
52
53/// A serial backend resource kind, where the underlying OS resources have
54/// already been opened in a privileged context.
55pub enum SerialBackendHandle {}
56
57impl ResourceKind for SerialBackendHandle {
58    const NAME: &'static str = "serial_handle";
59}
60
61/// A disk resource kind, where the underlying resources have already been
62/// opened in a privileged context.
63pub enum DiskHandleKind {}
64
65impl ResourceKind for DiskHandleKind {
66    const NAME: &'static str = "disk_handle";
67}
68
69/// A disk layer resource kind, where the underlying resources have already been
70/// opened in a privileged context.
71pub enum DiskLayerHandleKind {}
72
73impl ResourceKind for DiskLayerHandleKind {
74    const NAME: &'static str = "disk_layer_handle";
75}
76
77/// A resource kind for SCSI devices.
78pub enum ScsiDeviceHandleKind {}
79
80impl ResourceKind for ScsiDeviceHandleKind {
81    const NAME: &'static str = "scsi_device";
82}
83
84/// A resource kind for framebuffer memory that can be mapped into a VM.
85pub enum FramebufferHandleKind {}
86
87impl ResourceKind for FramebufferHandleKind {
88    const NAME: &'static str = "framebuffer";
89}
90
91/// A resource kind for virtio device handles.
92pub enum VirtioDeviceHandle {}
93
94impl ResourceKind for VirtioDeviceHandle {
95    const NAME: &'static str = "virtio";
96}
97
98/// Resource kind for vmbus device handles.
99pub enum VmbusDeviceHandleKind {}
100
101impl ResourceKind for VmbusDeviceHandleKind {
102    const NAME: &'static str = "vmbus_device_handle";
103}
104
105/// Resource kind for non-volatile stores.
106pub enum NonVolatileStoreKind {}
107
108impl ResourceKind for NonVolatileStoreKind {
109    const NAME: &'static str = "nvstore";
110}