]> git.ipfire.org Git - thirdparty/systemd.git/commit
vmspawn-qmp: convert DriveInfo to a refcounted object
authorChristian Brauner <brauner@kernel.org>
Tue, 21 Apr 2026 22:23:02 +0000 (00:23 +0200)
committerChristian Brauner <brauner@kernel.org>
Fri, 24 Apr 2026 12:39:25 +0000 (14:39 +0200)
commitf0c1dc50ef0fcc38af438f445ceaed3cefb242d1
treead8c4b26d8cc2d77cf24831a87029fd4f5b99a4b
parent06816dfee39d8419b9200448d8cc7656405a818f
vmspawn-qmp: convert DriveInfo to a refcounted object

In preparation for runtime block-device hotplug, where in-flight QMP
callbacks need to keep a slot reference on the DriveInfo while the bridge
also holds it in its block-device registry. Today each DriveInfo has
exactly one owner; switch the API from drive_info_free() /
drive_info_freep to drive_info_ref() / drive_info_unref() /
drive_info_unrefp so future code can take additional refs without the
caller losing track of ownership.

drive_info_new() initialises n_ref to 1 (one ref for the caller). The
existing drive_infos_done() and the prepare_*_drive() callers in
vmspawn.c are switched to the unref form. No behaviour change: each
DriveInfo still has exactly one ref at every point in this commit.

Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
src/vmspawn/vmspawn-qmp.c
src/vmspawn/vmspawn-qmp.h
src/vmspawn/vmspawn.c