Skip to main content

vmgs/
lib.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4#![forbid(unsafe_code)]
5
6//! Implementation of the VMGS file format.
7//!
8//! # Implementation Notes
9//!
10//! This particular implementation of the VMGS file format began life as a
11//! line-by-line port of the existing C++ VMGS code in Hyper-V. This kind of
12//! rote-porting was fairly common in the early days of the OpenVMM project (when
13//! folks were still getting a feel for Rust), though as time has gone on, most
14//! instances of rote-ported code have been refactored/rewritten to follow
15//! idiomatic Rust patterns.
16//!
17//! Unfortunately, the VMGS code is pretty complex, and giving it a proper "deep
18//! clean" would require a non-trivial amount of developer effort, which as is
19//! often the case - not particularly easy to come by.
20//!
21//! Sure, there's been lots of _incremental_ improvements to the code over the
22//! years, and the implementation is in _much_ better shape today than it was in
23//! its early days... but the code still has plenty of echoes from that initial
24//! C++ port, which really ought to get ironed out.
25
26#[cfg(feature = "encryption")]
27mod encrypt;
28mod error;
29mod storage;
30mod vmgs_impl;
31
32pub use error::Error;
33pub use vmgs_format::EncryptionAlgorithm;
34pub use vmgs_format::FileId;
35pub use vmgs_impl::GspType;
36pub use vmgs_impl::Vmgs;
37pub use vmgs_impl::VmgsFileInfo;
38#[cfg(feature = "save_restore")]
39pub use vmgs_impl::save_restore;
40
41/// VMGS helper functions
42pub mod vmgs_helpers {
43    pub use crate::vmgs_impl::get_active_header;
44    pub use crate::vmgs_impl::read_headers;
45    pub use crate::vmgs_impl::validate_header;
46}
47
48/// Expose the `VmgsLogger` trait
49pub mod logger;