Skip to content

Crate Addition Request: vmm-serde to build serde instrastructure for rust-vmm #76

@jiangliu

Description

@jiangliu

vmm-serde

Short Description

Build serde infrastructure to support snapshot, live migration and live upgrade

Why is this crate relevant to the rust-vmm project?

A common requirement for virtual machine snapshot, live migration and live upgrading is to serialize
and deserialize VMM internal objects and data structures. The rust community has the excellent
serde/serde_derive framework for data serialization/deserialization. But the serde/serde_derive
framework have very heavy dependency chain, and it's a common concern of the rust-vmm project to
reduce dependency chain as small as possible. So this helper crate uses rust features to
opt-in/opt-out data serialization/deserialization code and dependencies.

Currently following features are supported:

  • Feature export_as_pub. The data serializer often needs to access private data structures or
    private fields in data structures. But rust has no support for friend visibility yet, though
    there's proposals for C++ like friend relationship. So a proc macro export_as_pub() is
    introduced to rewrite private data structs/fields as pub on demand when the feature
    export_as_pub is enabled. Otherwise export_as_pub() becomes a null operation.

  • Feature serde_derive. When this feature is enabled, the proc_macro_derive for De/Serialize
    is reexported from the serde_derive crate, otherwise #[derive(Serialize, Deserialize)] becomes
    a null operation.

  • Feature serde_derive_ffi. Often the bindgen utiltily is used to auto-generate FFI bindings for
    Linux syscalls and system libraries. And data structures with flexible array member are often used
    for input and/or output parameters. So three derive macros, SerializeFfi, DeserializeFfi and
    DeserializeFfiFam, are introduced to serialize data structures generated by bindgen.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions