mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
domain_conf: cleanup virDomainGraphicsGetListen
Removes the check for graphics type, it's not a public API and developer know what he's doing and this check makes no sense. It also removes the ability to allocate a new array if there is none. This was used by the virDomainGraphicsListenAdd* functions and isn't used anymore. This is now a simple getter with simple check for listens array presence and whether the index in out of bounds. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
d6d17226ff
commit
37b1f45066
@ -23700,26 +23700,13 @@ virDomainNetGetActualTrustGuestRxFilters(virDomainNetDefPtr iface)
|
|||||||
* type, or NULL if this is an unsuitable type, or the index is out of
|
* type, or NULL if this is an unsuitable type, or the index is out of
|
||||||
* bounds. If force0 is TRUE, i == 0, and there is no listen array,
|
* bounds. If force0 is TRUE, i == 0, and there is no listen array,
|
||||||
* allocate one with a single item. */
|
* allocate one with a single item. */
|
||||||
static virDomainGraphicsListenDefPtr
|
virDomainGraphicsListenDefPtr
|
||||||
virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i, bool force0)
|
virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i)
|
||||||
{
|
{
|
||||||
if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC ||
|
if (!def->listens || (def->nListens <= i))
|
||||||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_RDP ||
|
return NULL;
|
||||||
def->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
|
|
||||||
|
|
||||||
if (!def->listens && (i == 0) && force0) {
|
return &def->listens[i];
|
||||||
if (VIR_ALLOC(def->listens) >= 0)
|
|
||||||
def->nListens = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!def->listens || (def->nListens <= i))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return &def->listens[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* it's a type that has no listens array */
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -23740,7 +23727,7 @@ int
|
|||||||
virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
|
virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
|
||||||
{
|
{
|
||||||
virDomainGraphicsListenDefPtr listenInfo
|
virDomainGraphicsListenDefPtr listenInfo
|
||||||
= virDomainGraphicsGetListen(def, i, false);
|
= virDomainGraphicsGetListen(def, i);
|
||||||
|
|
||||||
if (!listenInfo)
|
if (!listenInfo)
|
||||||
return VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE;
|
return VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NONE;
|
||||||
@ -23752,7 +23739,7 @@ const char *
|
|||||||
virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t i)
|
virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def, size_t i)
|
||||||
{
|
{
|
||||||
virDomainGraphicsListenDefPtr listenInfo
|
virDomainGraphicsListenDefPtr listenInfo
|
||||||
= virDomainGraphicsGetListen(def, i, false);
|
= virDomainGraphicsGetListen(def, i);
|
||||||
|
|
||||||
/* even a network can have a listen address */
|
/* even a network can have a listen address */
|
||||||
if (!listenInfo ||
|
if (!listenInfo ||
|
||||||
@ -23790,7 +23777,7 @@ const char *
|
|||||||
virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t i)
|
virDomainGraphicsListenGetNetwork(virDomainGraphicsDefPtr def, size_t i)
|
||||||
{
|
{
|
||||||
virDomainGraphicsListenDefPtr listenInfo
|
virDomainGraphicsListenDefPtr listenInfo
|
||||||
= virDomainGraphicsGetListen(def, i, false);
|
= virDomainGraphicsGetListen(def, i);
|
||||||
|
|
||||||
if (!listenInfo ||
|
if (!listenInfo ||
|
||||||
(listenInfo->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK))
|
(listenInfo->type != VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK))
|
||||||
|
@ -2812,6 +2812,8 @@ virDomainHostdevRemove(virDomainDefPtr def, size_t i);
|
|||||||
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
|
int virDomainHostdevFind(virDomainDefPtr def, virDomainHostdevDefPtr match,
|
||||||
virDomainHostdevDefPtr *found);
|
virDomainHostdevDefPtr *found);
|
||||||
|
|
||||||
|
virDomainGraphicsListenDefPtr
|
||||||
|
virDomainGraphicsGetListen(virDomainGraphicsDefPtr def, size_t i);
|
||||||
int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
|
int virDomainGraphicsListenGetType(virDomainGraphicsDefPtr def, size_t i)
|
||||||
ATTRIBUTE_NONNULL(1);
|
ATTRIBUTE_NONNULL(1);
|
||||||
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
|
const char *virDomainGraphicsListenGetAddress(virDomainGraphicsDefPtr def,
|
||||||
|
@ -300,6 +300,7 @@ virDomainGetFilesystemForTarget;
|
|||||||
virDomainGraphicsAuthConnectedTypeFromString;
|
virDomainGraphicsAuthConnectedTypeFromString;
|
||||||
virDomainGraphicsAuthConnectedTypeToString;
|
virDomainGraphicsAuthConnectedTypeToString;
|
||||||
virDomainGraphicsDefFree;
|
virDomainGraphicsDefFree;
|
||||||
|
virDomainGraphicsGetListen;
|
||||||
virDomainGraphicsListenAppendAddress;
|
virDomainGraphicsListenAppendAddress;
|
||||||
virDomainGraphicsListenGetAddress;
|
virDomainGraphicsListenGetAddress;
|
||||||
virDomainGraphicsListenGetNetwork;
|
virDomainGraphicsListenGetNetwork;
|
||||||
|
Loading…
Reference in New Issue
Block a user