MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / build_device_id

Function build_device_id

block/src/lib.rs:109–122  ·  view source on GitHub ↗
(disk_path: &Path)

Source from the content-addressed store, hash-verified

107}
108
109fn build_device_id(disk_path: &Path) -> result::Result<String, Error> {
110 let blk_metadata = match disk_path.metadata() {
111 Err(e) => return Err(Error::GetFileMetadata(e)),
112 Ok(m) => m,
113 };
114 // This is how kvmtool does it.
115 let device_id = format!(
116 "{}{}{}",
117 blk_metadata.st_dev(),
118 blk_metadata.st_rdev(),
119 blk_metadata.st_ino()
120 );
121 Ok(device_id)
122}
123
124pub fn build_serial(disk_path: &Path) -> Vec<u8> {
125 let mut default_serial = vec![0; VIRTIO_BLK_ID_BYTES as usize];

Callers 1

build_serialFunction · 0.85

Calls 1

metadataMethod · 0.80

Tested by

no test coverage detected