@@ -20,10 +20,16 @@ use crate::devices::virtio::{DeviceState, TYPE_BLOCK};
2020use crate :: rate_limiter:: persist:: RateLimiterState ;
2121use crate :: rate_limiter:: RateLimiter ;
2222
23- # [ derive ( Clone , Copy , Debug , PartialEq , Eq , Versionize ) ]
23+ /// Holds info about block's cache type. Gets saved in snapshot.
2424// NOTICE: Any changes to this structure require a snapshot version bump.
25+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , Versionize ) ]
2526pub enum CacheTypeState {
27+ /// Flushing mechanic will be advertised to the guest driver, but
28+ /// the operation will be a noop.
2629 Unsafe ,
30+ /// Flushing mechanic will be advertised to the guest driver and
31+ /// flush requests coming from the guest will be performed using
32+ /// `fsync`.
2733 Writeback ,
2834}
2935
@@ -45,13 +51,16 @@ impl From<CacheTypeState> for CacheType {
4551 }
4652}
4753
48- # [ derive ( Clone , Copy , Debug , Default , PartialEq , Eq , Versionize ) ]
54+ /// Holds info about block's file engine type. Gets saved in snapshot.
4955// NOTICE: Any changes to this structure require a snapshot version bump.
56+ #[ derive( Clone , Copy , Debug , Default , PartialEq , Eq , Versionize ) ]
5057pub enum FileEngineTypeState {
58+ /// Sync File Engine.
5159 // If the snap version does not contain the `FileEngineType`, it must have been snapshotted
5260 // on a VM using the Sync backend.
5361 #[ default]
5462 Sync ,
63+ /// Async File Engine.
5564 Async ,
5665}
5766
@@ -73,8 +82,9 @@ impl From<FileEngineTypeState> for FileEngineType {
7382 }
7483}
7584
76- # [ derive ( Debug , Clone , Versionize ) ]
85+ /// Holds info about the block device. Gets saved in snapshot.
7786// NOTICE: Any changes to this structure require a snapshot version bump.
87+ #[ derive( Debug , Clone , Versionize ) ]
7888pub struct BlockState {
7989 id : String ,
8090 partuuid : Option < String > ,
@@ -112,8 +122,10 @@ impl BlockState {
112122 }
113123}
114124
125+ /// Auxiliary structure for creating a device when resuming from a snapshot.
115126#[ derive( Debug ) ]
116127pub struct BlockConstructorArgs {
128+ /// Pointer to guest memory.
117129 pub mem : GuestMemoryMmap ,
118130}
119131
0 commit comments