build: fix build on RHEL-6

GCC in RHEL-6 complains about listen:

../../src/conf/domain_conf.c:23718: error: declaration of 'listen' shadows a global declaration [-Wshadow]
/usr/include/sys/socket.h:204: error: shadowed declaration is here [-Wshadow]

This renames all the listen to gListen.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2016-04-13 17:26:17 +02:00
parent 500f23767a
commit 6e76738e54
10 changed files with 63 additions and 63 deletions

View File

@ -23715,21 +23715,21 @@ int
virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def, virDomainGraphicsListenAppendAddress(virDomainGraphicsDefPtr def,
const char *address) const char *address)
{ {
virDomainGraphicsListenDef listen; virDomainGraphicsListenDef gListen;
memset(&listen, 0, sizeof(listen)); memset(&gListen, 0, sizeof(gListen));
listen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS; gListen.type = VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS;
if (VIR_STRDUP(listen.address, address) < 0) if (VIR_STRDUP(gListen.address, address) < 0)
goto error; goto error;
if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, listen) < 0) if (VIR_APPEND_ELEMENT_COPY(def->listens, def->nListens, gListen) < 0)
goto error; goto error;
return 0; return 0;
error: error:
VIR_FREE(listen.address); VIR_FREE(gListen.address);
return -1; return -1;
} }

View File

@ -1424,7 +1424,7 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
libxl_device_vfb *x_vfb) libxl_device_vfb *x_vfb)
{ {
unsigned short port; unsigned short port;
virDomainGraphicsListenDefPtr listen = NULL; virDomainGraphicsListenDefPtr gListen = NULL;
libxl_device_vfb_init(x_vfb); libxl_device_vfb_init(x_vfb);
@ -1451,11 +1451,11 @@ libxlMakeVfb(virPortAllocatorPtr graphicsports,
} }
x_vfb->vnc.display = l_vfb->data.vnc.port - LIBXL_VNC_PORT_MIN; x_vfb->vnc.display = l_vfb->data.vnc.port - LIBXL_VNC_PORT_MIN;
if ((listen = virDomainGraphicsGetListen(l_vfb, 0)) && if ((gListen = virDomainGraphicsGetListen(l_vfb, 0)) &&
listen->address) { gListen->address) {
/* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */ /* libxl_device_vfb_init() does VIR_STRDUP("127.0.0.1") */
VIR_FREE(x_vfb->vnc.listen); VIR_FREE(x_vfb->vnc.listen);
if (VIR_STRDUP(x_vfb->vnc.listen, listen->address) < 0) if (VIR_STRDUP(x_vfb->vnc.listen, gListen->address) < 0)
return -1; return -1;
} }
if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd) < 0) if (VIR_STRDUP(x_vfb->vnc.passwd, l_vfb->data.vnc.auth.passwd) < 0)
@ -1539,7 +1539,7 @@ libxlMakeBuildInfoVfb(virPortAllocatorPtr graphicsports,
for (i = 0; i < def->ngraphics; i++) { for (i = 0; i < def->ngraphics; i++) {
virDomainGraphicsDefPtr l_vfb = def->graphics[i]; virDomainGraphicsDefPtr l_vfb = def->graphics[i];
unsigned short port; unsigned short port;
virDomainGraphicsListenDefPtr listen = NULL; virDomainGraphicsListenDefPtr gListen = NULL;
if (l_vfb->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE) if (l_vfb->type != VIR_DOMAIN_GRAPHICS_TYPE_SPICE)
continue; continue;
@ -1553,9 +1553,9 @@ libxlMakeBuildInfoVfb(virPortAllocatorPtr graphicsports,
} }
b_info->u.hvm.spice.port = l_vfb->data.spice.port; b_info->u.hvm.spice.port = l_vfb->data.spice.port;
if ((listen = virDomainGraphicsGetListen(l_vfb, 0)) && if ((gListen = virDomainGraphicsGetListen(l_vfb, 0)) &&
listen->address && gListen->address &&
VIR_STRDUP(b_info->u.hvm.spice.host, listen->address) < 0) VIR_STRDUP(b_info->u.hvm.spice.host, gListen->address) < 0)
return -1; return -1;
if (VIR_STRDUP(b_info->u.hvm.keymap, l_vfb->data.spice.keymap) < 0) if (VIR_STRDUP(b_info->u.hvm.keymap, l_vfb->data.spice.keymap) < 0)

View File

@ -7212,7 +7212,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
const char *domainLibDir) const char *domainLibDir)
{ {
virBuffer opt = VIR_BUFFER_INITIALIZER; virBuffer opt = VIR_BUFFER_INITIALIZER;
virDomainGraphicsListenDefPtr listen = NULL; virDomainGraphicsListenDefPtr gListen = NULL;
const char *listenAddr = NULL; const char *listenAddr = NULL;
char *netAddr = NULL; char *netAddr = NULL;
bool escapeAddr; bool escapeAddr;
@ -7241,18 +7241,18 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
goto error; goto error;
} }
if ((listen = virDomainGraphicsGetListen(graphics, 0))) { if ((gListen = virDomainGraphicsGetListen(graphics, 0))) {
switch (listen->type) { switch (gListen->type) {
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
listenAddr = listen->address; listenAddr = gListen->address;
break; break;
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
if (!listen->network) if (!gListen->network)
break; break;
ret = networkGetNetworkAddress(listen->network, &netAddr); ret = networkGetNetworkAddress(gListen->network, &netAddr);
if (ret <= -2) { if (ret <= -2) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("network-based listen not possible, " "%s", _("network-based listen not possible, "
@ -7265,7 +7265,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
listenAddr = netAddr; listenAddr = netAddr;
/* store the address we found in the <graphics> element so it /* store the address we found in the <graphics> element so it
* will show up in status. */ * will show up in status. */
if (VIR_STRDUP(listen->address, netAddr) < 0) if (VIR_STRDUP(gListen->address, netAddr) < 0)
goto error; goto error;
break; break;
} }
@ -7359,7 +7359,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
virDomainGraphicsDefPtr graphics) virDomainGraphicsDefPtr graphics)
{ {
virBuffer opt = VIR_BUFFER_INITIALIZER; virBuffer opt = VIR_BUFFER_INITIALIZER;
virDomainGraphicsListenDefPtr listen = NULL; virDomainGraphicsListenDefPtr gListen = NULL;
const char *listenAddr = NULL; const char *listenAddr = NULL;
char *netAddr = NULL; char *netAddr = NULL;
int ret; int ret;
@ -7398,18 +7398,18 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
} }
if (port > 0 || tlsPort > 0) { if (port > 0 || tlsPort > 0) {
if ((listen = virDomainGraphicsGetListen(graphics, 0))) { if ((gListen = virDomainGraphicsGetListen(graphics, 0))) {
switch (listen->type) { switch (gListen->type) {
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
listenAddr = listen->address; listenAddr = gListen->address;
break; break;
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK: case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK:
if (!listen->network) if (!gListen->network)
break; break;
ret = networkGetNetworkAddress(listen->network, &netAddr); ret = networkGetNetworkAddress(gListen->network, &netAddr);
if (ret <= -2) { if (ret <= -2) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
"%s", _("network-based listen not possible, " "%s", _("network-based listen not possible, "
@ -7422,7 +7422,7 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
listenAddr = netAddr; listenAddr = netAddr;
/* store the address we found in the <graphics> element so it will /* store the address we found in the <graphics> element so it will
* show up in status. */ * show up in status. */
if (VIR_STRDUP(listen->address, listenAddr) < 0) if (VIR_STRDUP(gListen->address, listenAddr) < 0)
goto error; goto error;
break; break;
} }

View File

@ -314,7 +314,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
{ {
qemuMigrationCookieGraphicsPtr mig = NULL; qemuMigrationCookieGraphicsPtr mig = NULL;
const char *listenAddr; const char *listenAddr;
virDomainGraphicsListenDefPtr listen = virDomainGraphicsGetListen(def, 0); virDomainGraphicsListenDefPtr gListen = virDomainGraphicsGetListen(def, 0);
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
if (VIR_ALLOC(mig) < 0) if (VIR_ALLOC(mig) < 0)
@ -324,7 +324,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
if (mig->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) { if (mig->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
mig->port = def->data.vnc.port; mig->port = def->data.vnc.port;
if (!listen || !(listenAddr = listen->address)) if (!gListen || !(listenAddr = gListen->address))
listenAddr = cfg->vncListen; listenAddr = cfg->vncListen;
#ifdef WITH_GNUTLS #ifdef WITH_GNUTLS
@ -339,7 +339,7 @@ qemuMigrationCookieGraphicsAlloc(virQEMUDriverPtr driver,
else else
mig->tlsPort = -1; mig->tlsPort = -1;
if (!listen || !(listenAddr = listen->address)) if (!gListen || !(listenAddr = gListen->address))
listenAddr = cfg->spiceListen; listenAddr = cfg->spiceListen;
#ifdef WITH_GNUTLS #ifdef WITH_GNUTLS

View File

@ -1578,7 +1578,7 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
char *guiDisplay = NULL; char *guiDisplay = NULL;
char *sdlDisplay = NULL; char *sdlDisplay = NULL;
size_t i = 0; size_t i = 0;
virDomainGraphicsListenDefPtr listen; virDomainGraphicsListenDefPtr gListen;
for (i = 0; i < def->ngraphics; i++) { for (i = 0; i < def->ngraphics; i++) {
IVRDxServer *VRDxServer = NULL; IVRDxServer *VRDxServer = NULL;
@ -1606,15 +1606,15 @@ vboxAttachDisplay(virDomainDefPtr def, vboxGlobalData *data, IMachine *machine)
VIR_DEBUG("VRDP set to allow multiple connection"); VIR_DEBUG("VRDP set to allow multiple connection");
} }
if ((listen = virDomainGraphicsGetListen(def->graphics[i], 0)) && if ((gListen = virDomainGraphicsGetListen(def->graphics[i], 0)) &&
listen->address) { gListen->address) {
PRUnichar *netAddressUtf16 = NULL; PRUnichar *netAddressUtf16 = NULL;
VBOX_UTF8_TO_UTF16(listen->address, &netAddressUtf16); VBOX_UTF8_TO_UTF16(gListen->address, &netAddressUtf16);
gVBoxAPI.UIVRDxServer.SetNetAddress(data, VRDxServer, gVBoxAPI.UIVRDxServer.SetNetAddress(data, VRDxServer,
netAddressUtf16); netAddressUtf16);
VIR_DEBUG("VRDP listen address is set to: %s", VIR_DEBUG("VRDP listen address is set to: %s",
listen->address); gListen->address);
VBOX_UTF16_FREE(netAddressUtf16); VBOX_UTF16_FREE(netAddressUtf16);
} }

View File

@ -3403,7 +3403,7 @@ virVMXFormatConfig(virVMXContext *ctx, virDomainXMLOptionPtr xmlopt, virDomainDe
int int
virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer) virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
{ {
virDomainGraphicsListenDefPtr listen; virDomainGraphicsListenDefPtr gListen;
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument")); virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument"));
@ -3425,10 +3425,10 @@ virVMXFormatVNC(virDomainGraphicsDefPtr def, virBufferPtr buffer)
def->data.vnc.port); def->data.vnc.port);
} }
if ((listen = virDomainGraphicsGetListen(def, 0)) && if ((gListen = virDomainGraphicsGetListen(def, 0)) &&
listen->address) { gListen->address) {
virBufferAsprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n", virBufferAsprintf(buffer, "RemoteDisplay.vnc.ip = \"%s\"\n",
listen->address); gListen->address);
} }
if (def->data.vnc.keymap != NULL) { if (def->data.vnc.keymap != NULL) {

View File

@ -2712,7 +2712,7 @@ static int prlsdkCheckFSUnsupportedParams(virDomainFSDefPtr fs)
static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
{ {
virDomainGraphicsDefPtr gr; virDomainGraphicsDefPtr gr;
virDomainGraphicsListenDefPtr listen; virDomainGraphicsListenDefPtr gListen;
PRL_RESULT pret; PRL_RESULT pret;
int ret = -1; int ret = -1;
@ -2735,10 +2735,10 @@ static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def)
prlsdkCheckRetGoto(pret, cleanup); prlsdkCheckRetGoto(pret, cleanup);
} }
if ((listen = virDomainGraphicsGetListen(gr, 0))) { if ((gListen = virDomainGraphicsGetListen(gr, 0))) {
if (!listen->address) if (!gListen->address)
goto cleanup; goto cleanup;
pret = PrlVmCfg_SetVNCHostName(sdkdom, listen->address); pret = PrlVmCfg_SetVNCHostName(sdkdom, gListen->address);
prlsdkCheckRetGoto(pret, cleanup); prlsdkCheckRetGoto(pret, cleanup);
} }

View File

@ -1628,7 +1628,7 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
def->graphics[0]->data.sdl.xauth) < 0) def->graphics[0]->data.sdl.xauth) < 0)
return -1; return -1;
} else { } else {
virDomainGraphicsListenDefPtr listen; virDomainGraphicsListenDefPtr gListen;
if (xenConfigSetInt(conf, "sdl", 0) < 0) if (xenConfigSetInt(conf, "sdl", 0) < 0)
return -1; return -1;
@ -1645,9 +1645,9 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
def->graphics[0]->data.vnc.port - 5900) < 0) def->graphics[0]->data.vnc.port - 5900) < 0)
return -1; return -1;
if ((listen = virDomainGraphicsGetListen(def->graphics[0], 0)) && if ((gListen = virDomainGraphicsGetListen(def->graphics[0], 0)) &&
listen->address && gListen->address &&
xenConfigSetString(conf, "vnclisten", listen->address) < 0) xenConfigSetString(conf, "vnclisten", gListen->address) < 0)
return -1; return -1;
if (def->graphics[0]->data.vnc.auth.passwd && if (def->graphics[0]->data.vnc.auth.passwd &&
@ -1674,7 +1674,7 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
virBufferAsprintf(&buf, ",xauthority=%s", virBufferAsprintf(&buf, ",xauthority=%s",
def->graphics[0]->data.sdl.xauth); def->graphics[0]->data.sdl.xauth);
} else { } else {
virDomainGraphicsListenDefPtr listen virDomainGraphicsListenDefPtr gListen
= virDomainGraphicsGetListen(def->graphics[0], 0); = virDomainGraphicsGetListen(def->graphics[0], 0);
virBufferAddLit(&buf, "type=vnc"); virBufferAddLit(&buf, "type=vnc");
@ -1683,8 +1683,8 @@ xenFormatVfb(virConfPtr conf, virDomainDefPtr def)
if (!def->graphics[0]->data.vnc.autoport) if (!def->graphics[0]->data.vnc.autoport)
virBufferAsprintf(&buf, ",vncdisplay=%d", virBufferAsprintf(&buf, ",vncdisplay=%d",
def->graphics[0]->data.vnc.port - 5900); def->graphics[0]->data.vnc.port - 5900);
if (listen && listen->address) if (gListen && gListen->address)
virBufferAsprintf(&buf, ",vnclisten=%s", listen->address); virBufferAsprintf(&buf, ",vnclisten=%s", gListen->address);
if (def->graphics[0]->data.vnc.auth.passwd) if (def->graphics[0]->data.vnc.auth.passwd)
virBufferAsprintf(&buf, ",vncpasswd=%s", virBufferAsprintf(&buf, ",vncpasswd=%s",
def->graphics[0]->data.vnc.auth.passwd); def->graphics[0]->data.vnc.auth.passwd);

View File

@ -1523,7 +1523,7 @@ static int
xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def, xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
virBufferPtr buf) virBufferPtr buf)
{ {
virDomainGraphicsListenDefPtr listen; virDomainGraphicsListenDefPtr gListen;
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
@ -1551,9 +1551,9 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900);
} }
if ((listen = virDomainGraphicsGetListen(def, 0)) && if ((gListen = virDomainGraphicsGetListen(def, 0)) &&
listen->address) gListen->address)
virBufferAsprintf(buf, "(vnclisten '%s')", listen->address); virBufferAsprintf(buf, "(vnclisten '%s')", gListen->address);
if (def->data.vnc.auth.passwd) if (def->data.vnc.auth.passwd)
virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd);
if (def->data.vnc.keymap) if (def->data.vnc.keymap)
@ -1579,7 +1579,7 @@ xenFormatSxprGraphicsNew(virDomainGraphicsDefPtr def,
static int static int
xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf) xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf)
{ {
virDomainGraphicsListenDefPtr listen; virDomainGraphicsListenDefPtr gListen;
if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL && if (def->type != VIR_DOMAIN_GRAPHICS_TYPE_SDL &&
def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) { def->type != VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
@ -1604,9 +1604,9 @@ xenFormatSxprGraphicsOld(virDomainGraphicsDefPtr def, virBufferPtr buf)
virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900); virBufferAsprintf(buf, "(vncdisplay %d)", def->data.vnc.port-5900);
} }
if ((listen = virDomainGraphicsGetListen(def, 0)) && if ((gListen = virDomainGraphicsGetListen(def, 0)) &&
listen->address) gListen->address)
virBufferAsprintf(buf, "(vnclisten '%s')", listen->address); virBufferAsprintf(buf, "(vnclisten '%s')", gListen->address);
if (def->data.vnc.auth.passwd) if (def->data.vnc.auth.passwd)
virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd); virBufferAsprintf(buf, "(vncpasswd '%s')", def->data.vnc.auth.passwd);
if (def->data.vnc.keymap) if (def->data.vnc.keymap)

View File

@ -837,7 +837,7 @@ xenFormatXLDomainDisks(virConfPtr conf, virDomainDefPtr def)
static int static int
xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def) xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
{ {
virDomainGraphicsListenDefPtr listen; virDomainGraphicsListenDefPtr gListen;
virDomainGraphicsDefPtr graphics; virDomainGraphicsDefPtr graphics;
if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) { if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) {
@ -854,9 +854,9 @@ xenFormatXLSpice(virConfPtr conf, virDomainDefPtr def)
if (xenConfigSetInt(conf, "spice", 1) < 0) if (xenConfigSetInt(conf, "spice", 1) < 0)
return -1; return -1;
if ((listen = virDomainGraphicsGetListen(graphics, 0)) && if ((gListen = virDomainGraphicsGetListen(graphics, 0)) &&
listen->address && gListen->address &&
xenConfigSetString(conf, "spicehost", listen->address) < 0) xenConfigSetString(conf, "spicehost", gListen->address) < 0)
return -1; return -1;
if (xenConfigSetInt(conf, "spiceport", if (xenConfigSetInt(conf, "spiceport",