Crate crosvm_plugin
source ·Expand description
This module implements the dynamically loaded client library API used by a crosvm plugin,
defined in crosvm.h
. It implements the client half of the plugin protocol, which is defined in
the protos::plugin
module.
To implement the crosvm.h
C API, each function and struct definition is repeated here, with
concrete definitions for each struct. Most functions are thin shims to the underlying object
oriented Rust implementation method. Most methods require a request over the crosvm connection,
which is done by creating a MainRequest
or VcpuRequest
protobuf and sending it over the
connection’s socket. Then, that socket is read for a MainResponse
or VcpuResponse
, which is
translated to the appropriate return type for the C API.
Macros§
- This helper macro implements the C API’s constructor/destructor for a given type. Because they all follow the same pattern and include lots of boilerplate unsafe code, it makes sense to write it once with this helper macro.