]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu_hotplug: standardize the names/args/calling of qemuDomainDetach*()
authorLaine Stump <laine@laine.org>
Wed, 20 Mar 2019 18:32:53 +0000 (14:32 -0400)
committerLaine Stump <laine@laine.org>
Tue, 26 Mar 2019 15:05:03 +0000 (11:05 -0400)
commitb6a53bf9079bc9ef2dc3f8b85ff5c84da14b9a0a
tree5ef990108ff3f78c2d5fe685a97cbe06b5e1bd43
parent2ec6faea798b2a7d8986b7a958e781b54d8a8070
qemu_hotplug: standardize the names/args/calling of qemuDomainDetach*()

Most of these functions will soon contain only some setup for
detaching the device, not the detach code proper (since that code is
identical for these devices). Their device specific functions are all
being renamed to qemuDomainDetachPrep*(), where * is the
name of that device's data member in the virDomainDeviceDef
object.

Since there will be other code in qemuDomainDetachDeviceLive() after
the calls to qemuDomainDetachPrep*() that could still fail, we no
longer directly set "ret" with the return code from
qemuDomainDetachPrep*() functions, but simply return -1 on
failure, and wait until the end of qemuDomainDetachDeviceLive() to set
ret = 0.

Along with the rename, qemuDomainDetachPrep*() functions are also
given similar arglists, including an arg called "match" that points to
the proto-object of the device we want to delete, and another arg
"detach" that is used to return a pointer to the actual object that
will be (for now *has been*) detached. To make sure these new args
aren't confused with existing local pointers that sometimes had the
same name (detach), the local pointer to the device is now named after
the device type ("controller", "disk", etc). These point to the same
place as (*detach)->data.blah, it's just easier on the eyes to have,
e.g., "disk->dst" rather than "(*detach)->data.disk-dst".

Signed-off-by: Laine Stump <laine@laine.org>
ACKed-by: Peter Krempa <pkrempa@redhat.com>
src/qemu/qemu_hotplug.c