static virSecurityManagerPtr virSecurityManagerNewDriver(virSecurityDriverPtr drv, const char *virtDriver, bool allowDiskFormatProbing, bool defaultConfined, bool requireConfined, bool privileged) { virSecurityManagerPtr mgr; char *privateData; if (virSecurityManagerInitialize() < 0) return NULL; VIR_DEBUG("drv=%p (%s) virtDriver=%s allowDiskFormatProbing=%d " "defaultConfined=%d requireConfined=%d privileged=%d", drv, drv->name, virtDriver, allowDiskFormatProbing, defaultConfined, requireConfined, privileged); if (VIR_ALLOC_N(privateData, drv->privateDataLen) < 0) return NULL; if (!(mgr = virObjectLockableNew(virSecurityManagerClass))) { VIR_FREE(privateData); return NULL; } mgr->drv = drv; mgr->allowDiskFormatProbing = allowDiskFormatProbing; mgr->defaultConfined = defaultConfined; mgr->requireConfined = requireConfined; mgr->privileged = privileged; mgr->virtDriver = virtDriver; mgr->privateData = privateData; if (drv->open(mgr) < 0) { virObjectUnref(mgr); return NULL; } return mgr; }
static virSecurityManagerPtr virSecurityManagerNewDriver(virSecurityDriverPtr drv, const char *virtDriver, unsigned int flags) { virSecurityManagerPtr mgr; char *privateData; if (virSecurityManagerInitialize() < 0) return NULL; VIR_DEBUG("drv=%p (%s) virtDriver=%s flags=%x", drv, drv->name, virtDriver, flags); virCheckFlags(VIR_SECURITY_MANAGER_NEW_MASK, NULL); if (VIR_ALLOC_N(privateData, drv->privateDataLen) < 0) return NULL; if (!(mgr = virObjectLockableNew(virSecurityManagerClass))) { VIR_FREE(privateData); return NULL; } mgr->drv = drv; mgr->flags = flags; mgr->virtDriver = virtDriver; mgr->privateData = privateData; if (drv->open(mgr) < 0) { virObjectUnref(mgr); return NULL; } return mgr; }