and tweak the code to avoid using it.
---
cfg.mk | 12 ++++++++++++
include/libvirt/libvirt.h.in | 2 +-
src/conf/interface_conf.c | 10 +++++-----
src/conf/interface_conf.h | 2 +-
src/interface/interface_backend_udev.c | 2 +-
src/qemu/qemu_monitor.c | 4 ++--
src/qemu/qemu_monitor.h | 6 +++---
src/util/virfile.c | 6 +++---
tools/virsh-domain.c | 4 ++--
tools/virt-host-validate-common.h | 2 +-
10 files changed, 31 insertions(+), 19 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index ed7123b..8e99d04 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -962,6 +962,15 @@ sc_prohibit_paren_brace:
halt='Put space between closing parenthesis and opening brace' \
$(_sc_search_regexp)
+# Look for diagnostics that aren't marked for translation.
+# This won't find any for which error's format string is on a separate line.
+# The sed filters eliminate false-positives like these:
+sc_prohibit_devname:
+ @prohibit='\bdevname\b' \
+ exclude='sc_prohibit_devname' \
+ halt='avoid using 'devname' as FreeBSD exports the symbol' \
+ $(_sc_search_regexp)
+
# We don't use this feature of maint.mk.
prev_version_file = /dev/null
@@ -1146,3 +1155,6 @@ exclude_file_name_regexp--sc_prohibit_empty_first_line = \
exclude_file_name_regexp--sc_prohibit_useless_translation = \
^tests/virpolkittest.c
+
+exclude_file_name_regexp--sc_prohibit_devname = \
+ ^(tools/virsh.pod|cfg.mk|docs/.*)$$
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index 5217ab3..c9018c0 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -5601,7 +5601,7 @@ typedef enum {
} virDomainConsoleFlags;
int virDomainOpenConsole(virDomainPtr dom,
- const char *devname,
+ const char *dev_name,
virStreamPtr st,
unsigned int flags);
diff --git a/src/conf/interface_conf.c b/src/conf/interface_conf.c
index effe5ad..10c7c09 100644
--- a/src/conf/interface_conf.c
+++ b/src/conf/interface_conf.c
@@ -101,7 +101,7 @@ void virInterfaceDefFree(virInterfaceDefPtr def)
break;
case VIR_INTERFACE_TYPE_VLAN:
VIR_FREE(def->data.vlan.tag);
- VIR_FREE(def->data.vlan.devname);
+ VIR_FREE(def->data.vlan.dev_name);
break;
}
@@ -671,9 +671,9 @@ virInterfaceDefParseVlan(virInterfaceDefPtr def,
return -1;
}
- def->data.vlan.devname =
+ def->data.vlan.dev_name =
virXPathString("string(./interface/@name)", ctxt);
- if (def->data.vlan.devname == NULL) {
+ if (def->data.vlan.dev_name == NULL) {
virReportError(VIR_ERR_XML_ERROR,
"%s", _("vlan interface misses name
attribute"));
return -1;
@@ -955,11 +955,11 @@ virInterfaceVlanDefFormat(virBufferPtr buf, const virInterfaceDef
*def)
}
virBufferAsprintf(buf, "<vlan tag='%s'",
def->data.vlan.tag);
- if (def->data.vlan.devname != NULL) {
+ if (def->data.vlan.dev_name != NULL) {
virBufferAddLit(buf, ">\n");
virBufferAdjustIndent(buf, 2);
virBufferAsprintf(buf, "<interface name='%s'/>\n",
- def->data.vlan.devname);
+ def->data.vlan.dev_name);
virBufferAdjustIndent(buf, -2);
virBufferAddLit(buf, "</vlan>\n");
} else {
diff --git a/src/conf/interface_conf.h b/src/conf/interface_conf.h
index 94c18ef..ac212fb 100644
--- a/src/conf/interface_conf.h
+++ b/src/conf/interface_conf.h
@@ -116,7 +116,7 @@ typedef struct _virInterfaceVlanDef virInterfaceVlanDef;
typedef virInterfaceVlanDef *virInterfaceVlanDefPtr;
struct _virInterfaceVlanDef {
char *tag; /* TAG for vlan */
- char *devname; /* device name for vlan */
+ char *dev_name; /* device name for vlan */
};
typedef struct _virInterfaceIpDef virInterfaceIpDef;
diff --git a/src/interface/interface_backend_udev.c
b/src/interface/interface_backend_udev.c
index ecb1b2a..1dbbfe7 100644
--- a/src/interface/interface_backend_udev.c
+++ b/src/interface/interface_backend_udev.c
@@ -1015,7 +1015,7 @@ udevGetIfaceDefVlan(struct udev *udev ATTRIBUTE_UNUSED,
if (VIR_STRNDUP(ifacedef->data.vlan.tag, vid_pos, vid_len) < 0)
goto cleanup;
- if (VIR_STRNDUP(ifacedef->data.vlan.devname, dev_pos, dev_len) < 0) {
+ if (VIR_STRNDUP(ifacedef->data.vlan.dev_name, dev_pos, dev_len) < 0) {
VIR_FREE(ifacedef->data.vlan.tag);
goto cleanup;
}
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index c9929c3..00c62f7 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1821,7 +1821,7 @@ int qemuMonitorGetBlockExtent(qemuMonitorPtr mon,
unsigned long long *extent)
{
int ret;
- VIR_DEBUG("mon=%p, dev_name=%p", mon, dev_name);
+ VIR_DEBUG("mon=%p, dev_name=%s", mon, dev_name);
if (mon->json)
ret = qemuMonitorJSONGetBlockExtent(mon, dev_name, extent);
@@ -1836,7 +1836,7 @@ int qemuMonitorBlockResize(qemuMonitorPtr mon,
unsigned long long size)
{
int ret;
- VIR_DEBUG("mon=%p, devname=%p size=%llu", mon, device, size);
+ VIR_DEBUG("mon=%p, device=%s size=%llu", mon, device, size);
if (mon->json)
ret = qemuMonitorJSONBlockResize(mon, device, size);
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index f0c0b0a..63e14cc 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -333,7 +333,7 @@ int qemuMonitorBlockIOStatusToError(const char *status);
virHashTablePtr qemuMonitorGetBlockInfo(qemuMonitorPtr mon);
struct qemuDomainDiskInfo *
qemuMonitorBlockInfoLookup(virHashTablePtr blockInfo,
- const char *devname);
+ const char *dev_name);
int qemuMonitorGetBlockStatsInfo(qemuMonitorPtr mon,
const char *dev_name,
@@ -378,7 +378,7 @@ int qemuMonitorGetBlockExtent(qemuMonitorPtr mon,
const char *dev_name,
unsigned long long *extent);
int qemuMonitorBlockResize(qemuMonitorPtr mon,
- const char *devname,
+ const char *dev_name,
unsigned long long size);
int qemuMonitorSetVNCPassword(qemuMonitorPtr mon,
const char *password);
@@ -395,7 +395,7 @@ int qemuMonitorSetCPU(qemuMonitorPtr mon, int cpu, bool online);
/* XXX should we pass the virDomainDiskDefPtr instead
- * and hide devname details inside monitor. Reconsider
+ * and hide dev_name details inside monitor. Reconsider
* this when doing the QMP implementation
*/
int qemuMonitorEjectMedia(qemuMonitorPtr mon,
diff --git a/src/util/virfile.c b/src/util/virfile.c
index b3b8be2..c379df5 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -745,13 +745,13 @@ int virFileLoopDeviceAssociate(const char *file,
static int
-virFileNBDDeviceIsBusy(const char *devname)
+virFileNBDDeviceIsBusy(const char *dev_name)
{
char *path;
int ret = -1;
if (virAsprintf(&path, SYSFS_BLOCK_DIR "/%s/pid",
- devname) < 0)
+ dev_name) < 0)
return -1;
if (!virFileExists(path)) {
@@ -760,7 +760,7 @@ virFileNBDDeviceIsBusy(const char *devname)
else
virReportSystemError(errno,
_("Cannot check NBD device %s pid"),
- devname);
+ dev_name);
goto cleanup;
}
ret = 1;
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index ce59406..12550ff 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -2570,7 +2570,7 @@ static const vshCmdOptDef opts_console[] = {
.flags = VSH_OFLAG_REQ,
.help = N_("domain name, id or uuid")
},
- {.name = "devname",
+ {.name = "devname", /* sc_prohibit_devname */
.type = VSH_OT_STRING,
.help = N_("character device name")
},
@@ -2632,7 +2632,7 @@ cmdConsole(vshControl *ctl, const vshCmd *cmd)
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
return false;
- if (vshCommandOptStringReq(ctl, cmd, "devname", &name) < 0)
+ if (vshCommandOptStringReq(ctl, cmd, "devname", &name) < 0) /*
sc_prohibit_devname */
goto cleanup;
if (force)
diff --git a/tools/virt-host-validate-common.h b/tools/virt-host-validate-common.h
index a29f86c..25644dc 100644
--- a/tools/virt-host-validate-common.h
+++ b/tools/virt-host-validate-common.h
@@ -43,7 +43,7 @@ extern void virHostMsgFail(virHostValidateLevel level,
const char *hint);
extern int virHostValidateDevice(const char *hvname,
- const char *devname,
+ const char *dev_name,
virHostValidateLevel level,
const char *hint);
--
2.1.0