From: Wei Liu Date: Fri, 11 Oct 2024 18:13:05 +0000 (-0500) Subject: ch: add host device manager to driver X-Git-Tag: v10.10.0-rc1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d4f9e1bdd4ad8ed2688768e86a1b8275f642dd7;p=thirdparty%2Flibvirt.git ch: add host device manager to driver Co-authored-by: Wei Liu Signed-off-by: Praveen K Paladugu Reviewed-by: Michal Privoznik --- diff --git a/src/ch/ch_conf.h b/src/ch/ch_conf.h index a77cad7a2a..11061bc1b5 100644 --- a/src/ch/ch_conf.h +++ b/src/ch/ch_conf.h @@ -21,6 +21,7 @@ #pragma once #include "virdomainobjlist.h" +#include "virhostdev.h" #include "virthread.h" #include "ch_capabilities.h" #include "virebtables.h" @@ -80,6 +81,9 @@ struct _virCHDriver /* Immutable pointer, lockless APIs. Pointless abstraction */ ebtablesContext *ebtables; + + /* Immutable pointer to host device manager */ + virHostdevManager *hostdevMgr; }; #define CH_SAVE_MAGIC "libvirt-xml\n \0 \r" diff --git a/src/ch/ch_driver.c b/src/ch/ch_driver.c index dab025edc1..17ae488a02 100644 --- a/src/ch/ch_driver.c +++ b/src/ch/ch_driver.c @@ -1365,6 +1365,7 @@ static int chStateCleanup(void) virObjectUnref(ch_driver->xmlopt); virObjectUnref(ch_driver->caps); virObjectUnref(ch_driver->domains); + virObjectUnref(ch_driver->hostdevMgr); virMutexDestroy(&ch_driver->lock); g_clear_pointer(&ch_driver, g_free); @@ -1414,6 +1415,9 @@ chStateInitialize(bool privileged, if (!(ch_driver->config = virCHDriverConfigNew(privileged))) goto cleanup; + if (!(ch_driver->hostdevMgr = virHostdevManagerGetDefault())) + goto cleanup; + if ((rv = chExtractVersion(ch_driver)) < 0) { if (rv == -2) ret = VIR_DRV_STATE_INIT_SKIPPED;