crosvm/crosvm_cli/src
Daniel Verkamp 809b1a718c devices: vfio: make global container state explicit
The vfio code previously managed singleton instances of VfioContainer
using thread-local variables hidden inside the implementation of
vfio_get_container().

Make the caller hold onto a VfioContainerManager rather than implicitly
mutating global state inside a library function in the vfio crate. This
also removes the possibility of accidentally creating new VfioContainer
instances by calling from a different thread, since the containers were
previously thread-local rather than truly global for some reason.

This requires threading the vfio_container_manager variable through a
few function calls, but this also helps clarify ownership and lifetime
of the objects involved.

BUG=None
TEST=tools/dev_container tools/presubmit

Change-Id: I2ba1be561c48143ff14e391c23bad1c6783b73ec
Reviewed-on: https://chromium-review.googlesource.com/c/crosvm/crosvm/+/5601348
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Reviewed-by: Frederick Mayle <fmayle@google.com>
Reviewed-by: Pierre-Clément Tosi <ptosi@google.com>
2024-06-06 23:31:16 +00:00
..
sys devices: vfio: make global container state explicit 2024-06-06 23:31:16 +00:00
lib.rs src: move exit module to new crosvm_cli crate. 2022-10-20 20:27:58 +00:00
sys.rs src: move exit module to new crosvm_cli crate. 2022-10-20 20:27:58 +00:00