mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 21:34:54 +03:00
Avoid using "devname" as an identifier.
/usr/lib/stdlib.h in Mac OS X and probably also in BSD's exports this symbol :(
This commit is contained in:
parent
4d4430e125
commit
79cf07af7c
@ -202,7 +202,7 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef,
|
||||
char uuidstr[VIR_UUID_STRING_BUFLEN];
|
||||
char macstr[VIR_MAC_STRING_BUFLEN];
|
||||
char *vmname;
|
||||
char *devname;
|
||||
char *dev_name;
|
||||
char *rdev;
|
||||
const char *virt;
|
||||
|
||||
@ -211,7 +211,7 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef,
|
||||
rdev = virDomainAuditGetRdev(device);
|
||||
|
||||
if (!(vmname = virAuditEncode("vm", vmDef->name)) ||
|
||||
!(devname = virAuditEncode("path", device))) {
|
||||
!(dev_name = virAuditEncode("path", device))) {
|
||||
VIR_WARN("OOM while encoding audit message");
|
||||
goto cleanup;
|
||||
}
|
||||
@ -223,11 +223,11 @@ virDomainAuditNetDevice(virDomainDefPtr vmDef, virDomainNetDefPtr netDef,
|
||||
|
||||
VIR_AUDIT(VIR_AUDIT_RECORD_RESOURCE, success,
|
||||
"virt=%s resrc=net reason=open %s uuid=%s net='%s' %s rdev=%s",
|
||||
virt, vmname, uuidstr, macstr, devname, VIR_AUDIT_STR(rdev));
|
||||
virt, vmname, uuidstr, macstr, dev_name, VIR_AUDIT_STR(rdev));
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(vmname);
|
||||
VIR_FREE(devname);
|
||||
VIR_FREE(dev_name);
|
||||
VIR_FREE(rdev);
|
||||
}
|
||||
|
||||
|
@ -612,7 +612,7 @@ typedef virDomainPtr
|
||||
|
||||
typedef int
|
||||
(*virDrvDomainOpenConsole)(virDomainPtr dom,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
virStreamPtr st,
|
||||
unsigned int flags);
|
||||
|
||||
|
@ -16313,13 +16313,13 @@ virDomainSnapshotFree(virDomainSnapshotPtr snapshot)
|
||||
/**
|
||||
* virDomainOpenConsole:
|
||||
* @dom: a domain object
|
||||
* @devname: the console, serial or parallel port device alias, or NULL
|
||||
* @dev_name: the console, serial or parallel port device alias, or NULL
|
||||
* @st: a stream to associate with the console
|
||||
* @flags: unused, pass 0
|
||||
*
|
||||
* This opens the backend associated with a console, serial or
|
||||
* parallel port device on a guest, if the backend is supported.
|
||||
* If the @devname is omitted, then the first console or serial
|
||||
* If the @dev_name is omitted, then the first console or serial
|
||||
* device is opened. The console is associated with the passed
|
||||
* in @st stream, which should have been opened in non-blocking
|
||||
* mode for bi-directional I/O.
|
||||
@ -16327,14 +16327,14 @@ virDomainSnapshotFree(virDomainSnapshotPtr snapshot)
|
||||
* returns 0 if the console was opened, -1 on error
|
||||
*/
|
||||
int virDomainOpenConsole(virDomainPtr dom,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
virStreamPtr st,
|
||||
unsigned int flags)
|
||||
{
|
||||
virConnectPtr conn;
|
||||
|
||||
VIR_DOMAIN_DEBUG(dom, "devname=%s, st=%p, flags=%x",
|
||||
NULLSTR(devname), st, flags);
|
||||
VIR_DOMAIN_DEBUG(dom, "dev_name=%s, st=%p, flags=%x",
|
||||
NULLSTR(dev_name), st, flags);
|
||||
|
||||
virResetLastError();
|
||||
|
||||
@ -16352,7 +16352,7 @@ int virDomainOpenConsole(virDomainPtr dom,
|
||||
|
||||
if (conn->driver->domainOpenConsole) {
|
||||
int ret;
|
||||
ret = conn->driver->domainOpenConsole(dom, devname, st, flags);
|
||||
ret = conn->driver->domainOpenConsole(dom, dev_name, st, flags);
|
||||
if (ret < 0)
|
||||
goto error;
|
||||
return ret;
|
||||
|
@ -67,7 +67,7 @@ struct cgroup_device_policy {
|
||||
};
|
||||
|
||||
|
||||
static int lxcGetLoopFD(char **devname)
|
||||
static int lxcGetLoopFD(char **dev_name)
|
||||
{
|
||||
int fd = -1;
|
||||
DIR *dh = NULL;
|
||||
@ -122,7 +122,7 @@ static int lxcGetLoopFD(char **devname)
|
||||
cleanup:
|
||||
if (fd != -1) {
|
||||
VIR_DEBUG("Got free loop device %s %d", looppath, fd);
|
||||
*devname = looppath;
|
||||
*dev_name = looppath;
|
||||
} else {
|
||||
VIR_DEBUG("No free loop devices available");
|
||||
VIR_FREE(looppath);
|
||||
|
@ -2837,7 +2837,7 @@ cleanup:
|
||||
|
||||
static int
|
||||
lxcDomainOpenConsole(virDomainPtr dom,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
virStreamPtr st,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -2864,7 +2864,7 @@ lxcDomainOpenConsole(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (devname) {
|
||||
if (dev_name) {
|
||||
/* XXX support device aliases in future */
|
||||
lxcError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Named device aliases are not supported"));
|
||||
@ -2884,7 +2884,7 @@ lxcDomainOpenConsole(virDomainPtr dom,
|
||||
|
||||
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
lxcError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("character device %s is not using a PTY"), devname);
|
||||
_("character device %s is not using a PTY"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -3142,7 +3142,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||
virNetworkIpDefPtr ipdef;
|
||||
virSocketAddr addr;
|
||||
virSocketAddrPtr addrptr = NULL;
|
||||
char *devname = NULL;
|
||||
char *dev_name = NULL;
|
||||
|
||||
*netaddr = NULL;
|
||||
networkDriverLock(driver);
|
||||
@ -3172,7 +3172,7 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||
break;
|
||||
|
||||
case VIR_NETWORK_FORWARD_BRIDGE:
|
||||
if ((devname = netdef->bridge))
|
||||
if ((dev_name = netdef->bridge))
|
||||
break;
|
||||
/*
|
||||
* fall through if netdef->bridge wasn't set, since this is
|
||||
@ -3182,9 +3182,9 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||
case VIR_NETWORK_FORWARD_VEPA:
|
||||
case VIR_NETWORK_FORWARD_PASSTHROUGH:
|
||||
if ((netdef->nForwardIfs > 0) && netdef->forwardIfs)
|
||||
devname = netdef->forwardIfs[0].dev;
|
||||
dev_name = netdef->forwardIfs[0].dev;
|
||||
|
||||
if (!devname) {
|
||||
if (!dev_name) {
|
||||
networkReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("network '%s' has no associated interface or bridge"),
|
||||
netdef->name);
|
||||
@ -3192,11 +3192,11 @@ networkGetNetworkAddress(const char *netname, char **netaddr)
|
||||
break;
|
||||
}
|
||||
|
||||
if (devname) {
|
||||
if (ifaceGetIPAddress(devname, &addr)) {
|
||||
if (dev_name) {
|
||||
if (ifaceGetIPAddress(dev_name, &addr)) {
|
||||
virReportSystemError(errno,
|
||||
_("Failed to get IP address for '%s' (network '%s')"),
|
||||
devname, netdef->name);
|
||||
dev_name, netdef->name);
|
||||
} else {
|
||||
addrptr = &addr;
|
||||
}
|
||||
|
@ -422,20 +422,20 @@ int qemuDomainNetVLAN(virDomainNetDefPtr def)
|
||||
/* Names used before -drive existed */
|
||||
static int qemuAssignDeviceDiskAliasLegacy(virDomainDiskDefPtr disk)
|
||||
{
|
||||
char *devname;
|
||||
char *dev_name;
|
||||
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||
STREQ(disk->dst, "hdc"))
|
||||
devname = strdup("cdrom");
|
||||
dev_name = strdup("cdrom");
|
||||
else
|
||||
devname = strdup(disk->dst);
|
||||
dev_name = strdup(disk->dst);
|
||||
|
||||
if (!devname) {
|
||||
if (!dev_name) {
|
||||
virReportOOMError();
|
||||
return -1;
|
||||
}
|
||||
|
||||
disk->info.alias = devname;
|
||||
disk->info.alias = dev_name;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -465,7 +465,7 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
|
||||
{
|
||||
int busid, devid;
|
||||
int ret;
|
||||
char *devname;
|
||||
char *dev_name;
|
||||
|
||||
if (virDiskNameToBusDeviceIndex(disk, &busid, &devid) < 0) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
@ -477,24 +477,24 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
|
||||
switch (disk->bus) {
|
||||
case VIR_DOMAIN_DISK_BUS_IDE:
|
||||
if (disk->device== VIR_DOMAIN_DISK_DEVICE_DISK)
|
||||
ret = virAsprintf(&devname, "ide%d-hd%d", busid, devid);
|
||||
ret = virAsprintf(&dev_name, "ide%d-hd%d", busid, devid);
|
||||
else
|
||||
ret = virAsprintf(&devname, "ide%d-cd%d", busid, devid);
|
||||
ret = virAsprintf(&dev_name, "ide%d-cd%d", busid, devid);
|
||||
break;
|
||||
case VIR_DOMAIN_DISK_BUS_SCSI:
|
||||
if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK)
|
||||
ret = virAsprintf(&devname, "scsi%d-hd%d", busid, devid);
|
||||
ret = virAsprintf(&dev_name, "scsi%d-hd%d", busid, devid);
|
||||
else
|
||||
ret = virAsprintf(&devname, "scsi%d-cd%d", busid, devid);
|
||||
ret = virAsprintf(&dev_name, "scsi%d-cd%d", busid, devid);
|
||||
break;
|
||||
case VIR_DOMAIN_DISK_BUS_FDC:
|
||||
ret = virAsprintf(&devname, "floppy%d", devid);
|
||||
ret = virAsprintf(&dev_name, "floppy%d", devid);
|
||||
break;
|
||||
case VIR_DOMAIN_DISK_BUS_VIRTIO:
|
||||
ret = virAsprintf(&devname, "virtio%d", devid);
|
||||
ret = virAsprintf(&dev_name, "virtio%d", devid);
|
||||
break;
|
||||
case VIR_DOMAIN_DISK_BUS_XEN:
|
||||
ret = virAsprintf(&devname, "xenblk%d", devid);
|
||||
ret = virAsprintf(&dev_name, "xenblk%d", devid);
|
||||
break;
|
||||
default:
|
||||
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
||||
@ -508,7 +508,7 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
|
||||
return -1;
|
||||
}
|
||||
|
||||
disk->info.alias = devname;
|
||||
disk->info.alias = dev_name;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -10334,7 +10334,7 @@ cleanup:
|
||||
|
||||
static int
|
||||
qemuDomainOpenConsole(virDomainPtr dom,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
virStreamPtr st,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -10362,16 +10362,16 @@ qemuDomainOpenConsole(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (devname) {
|
||||
if (dev_name) {
|
||||
if (vm->def->console &&
|
||||
STREQ(devname, vm->def->console->info.alias))
|
||||
STREQ(dev_name, vm->def->console->info.alias))
|
||||
chr = vm->def->console;
|
||||
for (i = 0 ; !chr && i < vm->def->nserials ; i++) {
|
||||
if (STREQ(devname, vm->def->serials[i]->info.alias))
|
||||
if (STREQ(dev_name, vm->def->serials[i]->info.alias))
|
||||
chr = vm->def->serials[i];
|
||||
}
|
||||
for (i = 0 ; !chr && i < vm->def->nparallels ; i++) {
|
||||
if (STREQ(devname, vm->def->parallels[i]->info.alias))
|
||||
if (STREQ(dev_name, vm->def->parallels[i]->info.alias))
|
||||
chr = vm->def->parallels[i];
|
||||
}
|
||||
} else {
|
||||
@ -10384,14 +10384,14 @@ qemuDomainOpenConsole(virDomainPtr dom,
|
||||
if (!chr) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find character device %s"),
|
||||
NULLSTR(devname));
|
||||
NULLSTR(dev_name));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("character device %s is not using a PTY"),
|
||||
NULLSTR(devname));
|
||||
NULLSTR(dev_name));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -1217,7 +1217,7 @@ int qemuMonitorGetMemoryStats(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
long long *rd_req,
|
||||
long long *rd_bytes,
|
||||
long long *rd_total_times,
|
||||
@ -1229,7 +1229,7 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
long long *errs)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p dev=%s", mon, devname);
|
||||
VIR_DEBUG("mon=%p dev=%s", mon, dev_name);
|
||||
|
||||
if (!mon) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
@ -1238,7 +1238,7 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
if (mon->json)
|
||||
ret = qemuMonitorJSONGetBlockStatsInfo(mon, devname,
|
||||
ret = qemuMonitorJSONGetBlockStatsInfo(mon, dev_name,
|
||||
rd_req, rd_bytes,
|
||||
rd_total_times,
|
||||
wr_req, wr_bytes,
|
||||
@ -1247,7 +1247,7 @@ int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
flush_total_times,
|
||||
errs);
|
||||
else
|
||||
ret = qemuMonitorTextGetBlockStatsInfo(mon, devname,
|
||||
ret = qemuMonitorTextGetBlockStatsInfo(mon, dev_name,
|
||||
rd_req, rd_bytes,
|
||||
rd_total_times,
|
||||
wr_req, wr_bytes,
|
||||
@ -1282,17 +1282,17 @@ int qemuMonitorGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
int qemuMonitorGetBlockExtent(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
unsigned long long *extent)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p, fd=%d, devname=%p",
|
||||
mon, mon->fd, devname);
|
||||
VIR_DEBUG("mon=%p, fd=%d, dev_name=%p",
|
||||
mon, mon->fd, dev_name);
|
||||
|
||||
if (mon->json)
|
||||
ret = qemuMonitorJSONGetBlockExtent(mon, devname, extent);
|
||||
ret = qemuMonitorJSONGetBlockExtent(mon, dev_name, extent);
|
||||
else
|
||||
ret = qemuMonitorTextGetBlockExtent(mon, devname, extent);
|
||||
ret = qemuMonitorTextGetBlockExtent(mon, dev_name, extent);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -1439,11 +1439,11 @@ int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, int online)
|
||||
|
||||
|
||||
int qemuMonitorEjectMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
bool force)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p devname=%s force=%d", mon, devname, force);
|
||||
VIR_DEBUG("mon=%p dev_name=%s force=%d", mon, dev_name, force);
|
||||
|
||||
if (!mon) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
@ -1452,21 +1452,21 @@ int qemuMonitorEjectMedia(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
if (mon->json)
|
||||
ret = qemuMonitorJSONEjectMedia(mon, devname, force);
|
||||
ret = qemuMonitorJSONEjectMedia(mon, dev_name, force);
|
||||
else
|
||||
ret = qemuMonitorTextEjectMedia(mon, devname, force);
|
||||
ret = qemuMonitorTextEjectMedia(mon, dev_name, force);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
int qemuMonitorChangeMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
const char *newmedia,
|
||||
const char *format)
|
||||
{
|
||||
int ret;
|
||||
VIR_DEBUG("mon=%p devname=%s newmedia=%s format=%s",
|
||||
mon, devname, newmedia, format);
|
||||
VIR_DEBUG("mon=%p dev_name=%s newmedia=%s format=%s",
|
||||
mon, dev_name, newmedia, format);
|
||||
|
||||
if (!mon) {
|
||||
qemuReportError(VIR_ERR_INVALID_ARG, "%s",
|
||||
@ -1475,9 +1475,9 @@ int qemuMonitorChangeMedia(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
if (mon->json)
|
||||
ret = qemuMonitorJSONChangeMedia(mon, devname, newmedia, format);
|
||||
ret = qemuMonitorJSONChangeMedia(mon, dev_name, newmedia, format);
|
||||
else
|
||||
ret = qemuMonitorTextChangeMedia(mon, devname, newmedia, format);
|
||||
ret = qemuMonitorTextChangeMedia(mon, dev_name, newmedia, format);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ int qemuMonitorGetMemoryStats(qemuMonitorPtr mon,
|
||||
virDomainMemoryStatPtr stats,
|
||||
unsigned int nr_stats);
|
||||
int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
long long *rd_req,
|
||||
long long *rd_bytes,
|
||||
long long *rd_total_times,
|
||||
@ -227,7 +227,7 @@ int qemuMonitorGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
int *nparams);
|
||||
|
||||
int qemuMonitorGetBlockExtent(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
unsigned long long *extent);
|
||||
|
||||
|
||||
@ -250,10 +250,10 @@ int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, int online);
|
||||
* this when doing the QMP implementation
|
||||
*/
|
||||
int qemuMonitorEjectMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
bool force);
|
||||
int qemuMonitorChangeMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
const char *newmedia,
|
||||
const char *format);
|
||||
|
||||
|
@ -1338,7 +1338,7 @@ cleanup:
|
||||
|
||||
|
||||
int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
long long *rd_req,
|
||||
long long *rd_bytes,
|
||||
long long *rd_total_times,
|
||||
@ -1405,12 +1405,12 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
|
||||
/* New QEMU has separate names for host & guest side of the disk
|
||||
* and libvirt gives the host side a 'drive-' prefix. The passed
|
||||
* in devname is the guest side though
|
||||
* in dev_name is the guest side though
|
||||
*/
|
||||
if (STRPREFIX(thisdev, QEMU_DRIVE_HOST_PREFIX))
|
||||
thisdev += strlen(QEMU_DRIVE_HOST_PREFIX);
|
||||
|
||||
if (STRNEQ(thisdev, devname))
|
||||
if (STRNEQ(thisdev, dev_name))
|
||||
continue;
|
||||
|
||||
found = 1;
|
||||
@ -1485,7 +1485,7 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
|
||||
if (!found) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find statistics for device '%s'"), devname);
|
||||
_("cannot find statistics for device '%s'"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
ret = 0;
|
||||
@ -1570,7 +1570,7 @@ cleanup:
|
||||
}
|
||||
|
||||
int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
unsigned long long *extent)
|
||||
{
|
||||
int ret = -1;
|
||||
@ -1620,12 +1620,12 @@ int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon,
|
||||
|
||||
/* New QEMU has separate names for host & guest side of the disk
|
||||
* and libvirt gives the host side a 'drive-' prefix. The passed
|
||||
* in devname is the guest side though
|
||||
* in dev_name is the guest side though
|
||||
*/
|
||||
if (STRPREFIX(thisdev, QEMU_DRIVE_HOST_PREFIX))
|
||||
thisdev += strlen(QEMU_DRIVE_HOST_PREFIX);
|
||||
|
||||
if (STRNEQ(thisdev, devname))
|
||||
if (STRNEQ(thisdev, dev_name))
|
||||
continue;
|
||||
|
||||
found = 1;
|
||||
@ -1653,7 +1653,7 @@ int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon,
|
||||
|
||||
if (!found) {
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find statistics for device '%s'"), devname);
|
||||
_("cannot find statistics for device '%s'"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
ret = 0;
|
||||
@ -1840,12 +1840,12 @@ cleanup:
|
||||
|
||||
|
||||
int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
bool force)
|
||||
{
|
||||
int ret;
|
||||
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("eject",
|
||||
"s:device", devname,
|
||||
"s:device", dev_name,
|
||||
"b:force", force ? 1 : 0,
|
||||
NULL);
|
||||
virJSONValuePtr reply = NULL;
|
||||
@ -1864,7 +1864,7 @@ int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
int qemuMonitorJSONChangeMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
const char *newmedia,
|
||||
const char *format)
|
||||
{
|
||||
@ -1872,13 +1872,13 @@ int qemuMonitorJSONChangeMedia(qemuMonitorPtr mon,
|
||||
virJSONValuePtr cmd;
|
||||
if (format)
|
||||
cmd = qemuMonitorJSONMakeCommand("change",
|
||||
"s:device", devname,
|
||||
"s:device", dev_name,
|
||||
"s:target", newmedia,
|
||||
"s:arg", format,
|
||||
NULL);
|
||||
else
|
||||
cmd = qemuMonitorJSONMakeCommand("change",
|
||||
"s:device", devname,
|
||||
"s:device", dev_name,
|
||||
"s:target", newmedia,
|
||||
NULL);
|
||||
|
||||
|
@ -61,7 +61,7 @@ int qemuMonitorJSONGetMemoryStats(qemuMonitorPtr mon,
|
||||
virDomainMemoryStatPtr stats,
|
||||
unsigned int nr_stats);
|
||||
int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
long long *rd_req,
|
||||
long long *rd_bytes,
|
||||
long long *rd_total_times,
|
||||
@ -74,7 +74,7 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
int qemuMonitorJSONGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
int *nparams);
|
||||
int qemuMonitorJSONGetBlockExtent(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
unsigned long long *extent);
|
||||
|
||||
|
||||
@ -92,10 +92,10 @@ int qemuMonitorJSONSetBalloon(qemuMonitorPtr mon,
|
||||
int qemuMonitorJSONSetCPU(qemuMonitorPtr mon, int cpu, int online);
|
||||
|
||||
int qemuMonitorJSONEjectMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
bool force);
|
||||
int qemuMonitorJSONChangeMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
const char *newmedia,
|
||||
const char *format);
|
||||
|
||||
|
@ -751,7 +751,7 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
|
||||
|
||||
|
||||
int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
long long *rd_req,
|
||||
long long *rd_bytes,
|
||||
long long *rd_total_times,
|
||||
@ -766,7 +766,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
int ret = -1;
|
||||
char *dummy;
|
||||
const char *p, *eol;
|
||||
int devnamelen = strlen(devname);
|
||||
int devnamelen = strlen(dev_name);
|
||||
|
||||
if (qemuMonitorHMPCommand (mon, "info blockstats", &info) < 0) {
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
@ -808,12 +808,12 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
while (*p) {
|
||||
/* New QEMU has separate names for host & guest side of the disk
|
||||
* and libvirt gives the host side a 'drive-' prefix. The passed
|
||||
* in devname is the guest side though
|
||||
* in dev_name is the guest side though
|
||||
*/
|
||||
if (STRPREFIX(p, QEMU_DRIVE_HOST_PREFIX))
|
||||
p += strlen(QEMU_DRIVE_HOST_PREFIX);
|
||||
|
||||
if (STREQLEN (p, devname, devnamelen)
|
||||
if (STREQLEN (p, dev_name, devnamelen)
|
||||
&& p[devnamelen] == ':' && p[devnamelen+1] == ' ') {
|
||||
|
||||
eol = strchr (p, '\n');
|
||||
@ -880,7 +880,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
|
||||
/* If we reach here then the device was not found. */
|
||||
qemuReportError (VIR_ERR_INVALID_ARG,
|
||||
_("no stats found for device %s"), devname);
|
||||
_("no stats found for device %s"), dev_name);
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(info);
|
||||
@ -959,7 +959,7 @@ int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
}
|
||||
|
||||
int qemuMonitorTextGetBlockExtent(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
|
||||
const char *devname ATTRIBUTE_UNUSED,
|
||||
const char *dev_name ATTRIBUTE_UNUSED,
|
||||
unsigned long long *extent ATTRIBUTE_UNUSED)
|
||||
{
|
||||
qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
@ -1163,21 +1163,21 @@ int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online)
|
||||
|
||||
|
||||
int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
bool force)
|
||||
{
|
||||
char *cmd = NULL;
|
||||
char *reply = NULL;
|
||||
int ret = -1;
|
||||
|
||||
if (virAsprintf(&cmd, "eject %s%s", force ? "-f " : "", devname) < 0) {
|
||||
if (virAsprintf(&cmd, "eject %s%s", force ? "-f " : "", dev_name) < 0) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s"), devname);
|
||||
_("could not eject media on %s"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1186,7 +1186,7 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
|
||||
* No message is printed on success it seems */
|
||||
if (c_strcasestr(reply, "device ")) {
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not eject media on %s: %s"), devname, reply);
|
||||
_("could not eject media on %s: %s"), dev_name, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1200,7 +1200,7 @@ cleanup:
|
||||
|
||||
|
||||
int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
const char *newmedia,
|
||||
const char *format ATTRIBUTE_UNUSED)
|
||||
{
|
||||
@ -1214,14 +1214,14 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (virAsprintf(&cmd, "change %s \"%s\"", devname, safepath) < 0) {
|
||||
if (virAsprintf(&cmd, "change %s \"%s\"", dev_name, safepath) < 0) {
|
||||
virReportOOMError();
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (qemuMonitorHMPCommand(mon, cmd, &reply) < 0) {
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not change media on %s"), devname);
|
||||
_("could not change media on %s"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@ -1230,14 +1230,14 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
||||
* No message is printed on success it seems */
|
||||
if (c_strcasestr(reply, "device ")) {
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not change media on %s: %s"), devname, reply);
|
||||
_("could not change media on %s: %s"), dev_name, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/* Could not open message indicates bad filename */
|
||||
if (strstr(reply, "Could not open ")) {
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED,
|
||||
_("could not change media on %s: %s"), devname, reply);
|
||||
_("could not change media on %s: %s"), dev_name, reply);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
|
||||
virDomainMemoryStatPtr stats,
|
||||
unsigned int nr_stats);
|
||||
int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
long long *rd_req,
|
||||
long long *rd_bytes,
|
||||
long long *rd_total_times,
|
||||
@ -71,7 +71,7 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
|
||||
int qemuMonitorTextGetBlockStatsParamsNumber(qemuMonitorPtr mon,
|
||||
int *nparams);
|
||||
int qemuMonitorTextGetBlockExtent(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
unsigned long long *extent);
|
||||
|
||||
int qemuMonitorTextSetVNCPassword(qemuMonitorPtr mon,
|
||||
@ -88,10 +88,10 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
|
||||
int qemuMonitorTextSetCPU(qemuMonitorPtr mon, int cpu, int online);
|
||||
|
||||
int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
bool force);
|
||||
int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
const char *newmedia,
|
||||
const char *format);
|
||||
|
||||
|
@ -649,7 +649,7 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
{
|
||||
char *part_num = NULL;
|
||||
char *devpath = NULL;
|
||||
char *devname, *srcname;
|
||||
char *dev_name, *srcname;
|
||||
virCommandPtr cmd = NULL;
|
||||
bool isDevMapperDevice;
|
||||
int rc = -1;
|
||||
@ -663,26 +663,26 @@ virStorageBackendDiskDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
devname = basename(devpath);
|
||||
dev_name = basename(devpath);
|
||||
srcname = basename(pool->def->source.devices[0].path);
|
||||
VIR_DEBUG("devname=%s, srcname=%s", devname, srcname);
|
||||
VIR_DEBUG("dev_name=%s, srcname=%s", dev_name, srcname);
|
||||
|
||||
isDevMapperDevice = virIsDevMapperDevice(devpath);
|
||||
|
||||
if (!isDevMapperDevice && !STRPREFIX(devname, srcname)) {
|
||||
if (!isDevMapperDevice && !STRPREFIX(dev_name, srcname)) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Volume path '%s' did not start with parent "
|
||||
"pool source device name."), devname);
|
||||
"pool source device name."), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (!isDevMapperDevice) {
|
||||
part_num = devname + strlen(srcname);
|
||||
part_num = dev_name + strlen(srcname);
|
||||
|
||||
if (*part_num == 0) {
|
||||
virStorageReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot parse partition number from target "
|
||||
"'%s'"), devname);
|
||||
"'%s'"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -125,7 +125,7 @@ cleanup:
|
||||
|
||||
|
||||
static int
|
||||
virStorageBackendIsMultipath(const char *devname)
|
||||
virStorageBackendIsMultipath(const char *dev_name)
|
||||
{
|
||||
int ret = 0;
|
||||
struct dm_task *dmt = NULL;
|
||||
@ -140,7 +140,7 @@ virStorageBackendIsMultipath(const char *devname)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (dm_task_set_name(dmt, devname) == 0) {
|
||||
if (dm_task_set_name(dmt, dev_name) == 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
@ -172,7 +172,7 @@ out:
|
||||
|
||||
|
||||
static int
|
||||
virStorageBackendGetMinorNumber(const char *devname, uint32_t *minor)
|
||||
virStorageBackendGetMinorNumber(const char *dev_name, uint32_t *minor)
|
||||
{
|
||||
int ret = -1;
|
||||
struct dm_task *dmt;
|
||||
@ -182,7 +182,7 @@ virStorageBackendGetMinorNumber(const char *devname, uint32_t *minor)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!dm_task_set_name(dmt, devname)) {
|
||||
if (!dm_task_set_name(dmt, dev_name)) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
@ -2235,7 +2235,7 @@ cleanup:
|
||||
|
||||
static int
|
||||
umlDomainOpenConsole(virDomainPtr dom,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
virStreamPtr st,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -2262,7 +2262,7 @@ umlDomainOpenConsole(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (devname) {
|
||||
if (dev_name) {
|
||||
/* XXX support device aliases in future */
|
||||
umlReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Named device aliases are not supported"));
|
||||
@ -2276,13 +2276,13 @@ umlDomainOpenConsole(virDomainPtr dom,
|
||||
|
||||
if (!chr) {
|
||||
umlReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("cannot find character device %s"), devname);
|
||||
_("cannot find character device %s"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
umlReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("character device %s is not using a PTY"), devname);
|
||||
_("character device %s is not using a PTY"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -2455,11 +2455,11 @@ virTimeMs(unsigned long long *ms)
|
||||
|
||||
#if HAVE_LIBDEVMAPPER_H
|
||||
bool
|
||||
virIsDevMapperDevice(const char *devname)
|
||||
virIsDevMapperDevice(const char *dev_name)
|
||||
{
|
||||
struct stat buf;
|
||||
|
||||
if (!stat(devname, &buf) &&
|
||||
if (!stat(dev_name, &buf) &&
|
||||
S_ISBLK(buf.st_mode) &&
|
||||
dm_is_dm_major(major(buf.st_rdev)))
|
||||
return true;
|
||||
@ -2467,7 +2467,7 @@ virIsDevMapperDevice(const char *devname)
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
bool virIsDevMapperDevice(const char *devname ATTRIBUTE_UNUSED)
|
||||
bool virIsDevMapperDevice(const char *dev_name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -255,7 +255,7 @@ char *virTimestamp(void);
|
||||
|
||||
int virTimeMs(unsigned long long *ms) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
bool virIsDevMapperDevice(const char *devname) ATTRIBUTE_NONNULL(1);
|
||||
bool virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int virEmitXMLWarning(int fd,
|
||||
const char *name,
|
||||
|
@ -2119,7 +2119,7 @@ out:
|
||||
|
||||
static int
|
||||
xenUnifiedDomainOpenConsole(virDomainPtr dom,
|
||||
const char *devname,
|
||||
const char *dev_name,
|
||||
virStreamPtr st,
|
||||
unsigned int flags)
|
||||
{
|
||||
@ -2135,7 +2135,7 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
if (devname) {
|
||||
if (dev_name) {
|
||||
/* XXX support device aliases in future */
|
||||
xenUnifiedError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||
_("Named device aliases are not supported"));
|
||||
@ -2159,7 +2159,7 @@ xenUnifiedDomainOpenConsole(virDomainPtr dom,
|
||||
|
||||
if (chr->source.type != VIR_DOMAIN_CHR_TYPE_PTY) {
|
||||
xenUnifiedError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("character device %s is not using a PTY"), devname);
|
||||
_("character device %s is not using a PTY"), dev_name);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
|
@ -278,7 +278,7 @@ virConsoleEventOnStdout(int watch ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
int vshRunConsole(virDomainPtr dom, const char *devname)
|
||||
int vshRunConsole(virDomainPtr dom, const char *dev_name)
|
||||
{
|
||||
int ret = -1;
|
||||
struct termios ttyattr, rawattr;
|
||||
@ -331,7 +331,7 @@ int vshRunConsole(virDomainPtr dom, const char *devname)
|
||||
if (!con->st)
|
||||
goto cleanup;
|
||||
|
||||
if (virDomainOpenConsole(dom, devname, con->st, 0) < 0)
|
||||
if (virDomainOpenConsole(dom, dev_name, con->st, 0) < 0)
|
||||
goto cleanup;
|
||||
|
||||
con->stdinWatch = virEventAddHandle(STDIN_FILENO,
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
# ifndef WIN32
|
||||
|
||||
int vshRunConsole(virDomainPtr dom, const char *devname);
|
||||
int vshRunConsole(virDomainPtr dom, const char *dev_name);
|
||||
|
||||
# endif /* !WIN32 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user