@@ -227,15 +227,25 @@ pub enum MediaType {
227
227
Rotational ,
228
228
/// Special loopback device
229
229
Loopback ,
230
- // Logical volume device
230
+ /// Logical volume device
231
231
LVM ,
232
- // Software raid device
232
+ /// Software raid device
233
233
MdRaid ,
234
- // NVM Express
234
+ /// NVM Express
235
235
NVME ,
236
- // Ramdisk
236
+ /// Ramdisk
237
237
Ram ,
238
+ /// Virtual disk inside a QEMU virtual machine
238
239
Virtual ,
240
+ /// Virtual disk inside a VirtualBox virtual machine
241
+ VirtualBox ,
242
+ /// Unidentified, but vendor value was ATA
243
+ OtherATA ,
244
+ /// Unidentified. While attributes were available in the identification process, none of the rules matched
245
+ Unrecognised {
246
+ vendor : Option < String > ,
247
+ } ,
248
+ /// Unidentified, because there were no attributes available for an identification process
239
249
Unknown ,
240
250
}
241
251
@@ -245,6 +255,8 @@ pub enum MediaType {
245
255
pub enum DeviceType {
246
256
Disk ,
247
257
Partition ,
258
+ #[ strum( default ) ]
259
+ Unrecognised ( String ) ,
248
260
Unknown ,
249
261
}
250
262
@@ -256,7 +268,7 @@ impl FromStr for DeviceType {
256
268
match s. as_ref ( ) {
257
269
"disk" => Ok ( DeviceType :: Disk ) ,
258
270
"partition" => Ok ( DeviceType :: Partition ) ,
259
- _ => Ok ( DeviceType :: Unknown ) ,
271
+ other => Ok ( DeviceType :: Unrecognised ( other . into ( ) ) ) ,
260
272
}
261
273
}
262
274
}
@@ -972,13 +984,19 @@ fn get_media_type(device: &udev::Device) -> MediaType {
972
984
if let Some ( vendor) = device. property_value ( "ID_VENDOR" ) {
973
985
let value = vendor. to_string_lossy ( ) ;
974
986
return match value. as_ref ( ) {
987
+ "ATA" => MediaType :: OtherATA ,
975
988
"QEMU" => MediaType :: Virtual ,
976
- _ => MediaType :: Unknown ,
989
+ "VBOX" => MediaType :: VirtualBox ,
990
+ _ => MediaType :: Unrecognised {
991
+ vendor : Some ( value. into ( ) )
992
+ } ,
977
993
} ;
978
994
}
979
995
980
996
// I give up
981
- MediaType :: Unknown
997
+ MediaType :: Unrecognised {
998
+ vendor : None
999
+ }
982
1000
}
983
1001
984
1002
#[ cfg( target_os = "linux" ) ]
0 commit comments