mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2024-09-17 20:44:55 +00:00
bf059914a6
Bumps [uuid](https://github.com/uuid-rs/uuid) from 0.8.2 to 1.0.0. - [Release notes](https://github.com/uuid-rs/uuid/releases) - [Commits](https://github.com/uuid-rs/uuid/compare/0.8.2...1.0.0) --- updated-dependencies: - dependency-name: uuid dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
31 lines
769 B
Rust
31 lines
769 B
Rust
// Copyright © 2021 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
use byteorder::{BigEndian, ByteOrder};
|
|
use uuid::Uuid;
|
|
|
|
macro_rules! div_round_up {
|
|
($n:expr,$d:expr) => {
|
|
($n + $d - 1) / $d
|
|
};
|
|
}
|
|
|
|
pub mod vhdx;
|
|
mod vhdx_bat;
|
|
mod vhdx_header;
|
|
mod vhdx_io;
|
|
mod vhdx_metadata;
|
|
|
|
pub(crate) fn uuid_from_guid(buf: &[u8]) -> Uuid {
|
|
// The first 3 fields of UUID are stored in Big Endian format, and
|
|
// the last 8 bytes are stored as byte array. Therefore, we read the
|
|
// first 3 fields in Big Endian format instead of Little Endian.
|
|
Uuid::from_fields_le(
|
|
BigEndian::read_u32(&buf[0..4]),
|
|
BigEndian::read_u16(&buf[4..6]),
|
|
BigEndian::read_u16(&buf[6..8]),
|
|
buf[8..16].try_into().unwrap(),
|
|
)
|
|
}
|