mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 09:53:10 +00:00
conf: Rename and expose virDomainChrSourceDefPath
It comes very handy to have source path for chardevs. We already have such function: virDomainAuditChardevPath() but it's static and has name not suitable for exposing. Moreover, while exposing it change its name slightly to virDomainChrSourceDefGetPath. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
parent
a1ac4c880b
commit
37ef8763c4
@ -68,38 +68,6 @@ virDomainAuditGetRdev(const char *path ATTRIBUTE_UNUSED)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
virDomainAuditChardevPath(virDomainChrSourceDefPtr chr)
|
|
||||||
{
|
|
||||||
if (!chr)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
switch ((virDomainChrType) chr->type) {
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_PTY:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_DEV:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_FILE:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_PIPE:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
|
||||||
return chr->data.file.path;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_UNIX:
|
|
||||||
return chr->data.nix.path;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_TCP:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_UDP:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_NULL:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_VC:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
|
||||||
case VIR_DOMAIN_CHR_TYPE_LAST:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
virDomainAuditGenericDev(virDomainObjPtr vm,
|
virDomainAuditGenericDev(virDomainObjPtr vm,
|
||||||
const char *type,
|
const char *type,
|
||||||
@ -178,8 +146,8 @@ virDomainAuditChardev(virDomainObjPtr vm,
|
|||||||
newsrc = newDef->source;
|
newsrc = newDef->source;
|
||||||
|
|
||||||
virDomainAuditGenericDev(vm, "chardev",
|
virDomainAuditGenericDev(vm, "chardev",
|
||||||
virDomainAuditChardevPath(oldsrc),
|
virDomainChrSourceDefGetPath(oldsrc),
|
||||||
virDomainAuditChardevPath(newsrc),
|
virDomainChrSourceDefGetPath(newsrc),
|
||||||
reason, success);
|
reason, success);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +186,7 @@ virDomainAuditSmartcard(virDomainObjPtr vm,
|
|||||||
|
|
||||||
case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
|
case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
|
||||||
virDomainAuditGenericDev(vm, "smartcard", NULL,
|
virDomainAuditGenericDev(vm, "smartcard", NULL,
|
||||||
virDomainAuditChardevPath(def->data.passthru),
|
virDomainChrSourceDefGetPath(def->data.passthru),
|
||||||
reason, success);
|
reason, success);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -264,7 +232,7 @@ virDomainAuditRNG(virDomainObjPtr vm,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_RNG_BACKEND_EGD:
|
case VIR_DOMAIN_RNG_BACKEND_EGD:
|
||||||
newsrcpath = virDomainAuditChardevPath(newDef->source.chardev);
|
newsrcpath = virDomainChrSourceDefGetPath(newDef->source.chardev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_RNG_BACKEND_LAST:
|
case VIR_DOMAIN_RNG_BACKEND_LAST:
|
||||||
@ -279,7 +247,7 @@ virDomainAuditRNG(virDomainObjPtr vm,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_RNG_BACKEND_EGD:
|
case VIR_DOMAIN_RNG_BACKEND_EGD:
|
||||||
oldsrcpath = virDomainAuditChardevPath(oldDef->source.chardev);
|
oldsrcpath = virDomainChrSourceDefGetPath(oldDef->source.chardev);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VIR_DOMAIN_RNG_BACKEND_LAST:
|
case VIR_DOMAIN_RNG_BACKEND_LAST:
|
||||||
@ -982,7 +950,7 @@ virDomainAuditShmem(virDomainObjPtr vm,
|
|||||||
{
|
{
|
||||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||||
char *vmname = virAuditEncode("vm", vm->def->name);
|
char *vmname = virAuditEncode("vm", vm->def->name);
|
||||||
const char *srcpath = virDomainAuditChardevPath(&def->server.chr);
|
const char *srcpath = virDomainChrSourceDefGetPath(&def->server.chr);
|
||||||
const char *virt = virDomainVirtTypeToString(vm->def->virtType);
|
const char *virt = virDomainVirtTypeToString(vm->def->virtType);
|
||||||
char *shmpath = NULL;
|
char *shmpath = NULL;
|
||||||
|
|
||||||
|
@ -2039,6 +2039,39 @@ virDomainNetDefFree(virDomainNetDefPtr def)
|
|||||||
VIR_FREE(def);
|
VIR_FREE(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const char *
|
||||||
|
virDomainChrSourceDefGetPath(virDomainChrSourceDefPtr chr)
|
||||||
|
{
|
||||||
|
if (!chr)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
switch ((virDomainChrType) chr->type) {
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_PTY:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_DEV:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_FILE:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_PIPE:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_NMDM:
|
||||||
|
return chr->data.file.path;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_UNIX:
|
||||||
|
return chr->data.nix.path;
|
||||||
|
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_TCP:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_UDP:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_NULL:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_VC:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_STDIO:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_SPICEPORT:
|
||||||
|
case VIR_DOMAIN_CHR_TYPE_LAST:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void ATTRIBUTE_NONNULL(1)
|
void ATTRIBUTE_NONNULL(1)
|
||||||
virDomainChrSourceDefClear(virDomainChrSourceDefPtr def)
|
virDomainChrSourceDefClear(virDomainChrSourceDefPtr def)
|
||||||
{
|
{
|
||||||
|
@ -3284,6 +3284,8 @@ int virDomainDefFindDevice(virDomainDefPtr def,
|
|||||||
virDomainDeviceDefPtr dev,
|
virDomainDeviceDefPtr dev,
|
||||||
bool reportError);
|
bool reportError);
|
||||||
|
|
||||||
|
const char *virDomainChrSourceDefGetPath(virDomainChrSourceDefPtr chr);
|
||||||
|
|
||||||
void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);
|
void virDomainChrSourceDefClear(virDomainChrSourceDefPtr def);
|
||||||
|
|
||||||
char *virDomainObjGetMetadata(virDomainObjPtr vm,
|
char *virDomainObjGetMetadata(virDomainObjPtr vm,
|
||||||
|
@ -208,6 +208,7 @@ virDomainChrSerialTargetTypeToString;
|
|||||||
virDomainChrSourceDefClear;
|
virDomainChrSourceDefClear;
|
||||||
virDomainChrSourceDefCopy;
|
virDomainChrSourceDefCopy;
|
||||||
virDomainChrSourceDefFree;
|
virDomainChrSourceDefFree;
|
||||||
|
virDomainChrSourceDefGetPath;
|
||||||
virDomainChrSpicevmcTypeFromString;
|
virDomainChrSpicevmcTypeFromString;
|
||||||
virDomainChrSpicevmcTypeToString;
|
virDomainChrSpicevmcTypeToString;
|
||||||
virDomainChrTcpProtocolTypeFromString;
|
virDomainChrTcpProtocolTypeFromString;
|
||||||
|
Loading…
Reference in New Issue
Block a user