mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-15 09:53:44 -06:00
util: consolidate duplicated error messages in pci.c
This is nearly identical to an earlier patch for virnetlink.c. There are special stub versions of all public functions in this file that are compiled when the platform isn't linux. Each of these functions had an almost identical message, differing only in the function name included in the message. Since log messages already contain the function name, we can just define a const char* with the common part of the string, and use that same string for all the log messages. If nothing else, this at least makes for less strings that need translating...
This commit is contained in:
parent
7a23ba090d
commit
b8e478502a
@ -2170,12 +2170,13 @@ cleanup:
|
||||
}
|
||||
|
||||
#else
|
||||
static const char *unsupported = N_("not supported on non-linux platforms");
|
||||
|
||||
int
|
||||
pciGetPhysicalFunction(const char *vf_sysfs_path ATTRIBUTE_UNUSED,
|
||||
struct pci_config_address **physical_function ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciGetPhysicalFunction is not "
|
||||
"supported on non-linux platforms"));
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2184,16 +2185,14 @@ pciGetVirtualFunctions(const char *sysfs_path ATTRIBUTE_UNUSED,
|
||||
struct pci_config_address ***virtual_functions ATTRIBUTE_UNUSED,
|
||||
unsigned int *num_virtual_functions ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciGetVirtualFunctions is not "
|
||||
"supported on non-linux platforms"));
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||
return -1;
|
||||
}
|
||||
|
||||
int
|
||||
pciDeviceIsVirtualFunction(const char *vf_sysfs_device_link ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciDeviceIsVirtualFunction is "
|
||||
"not supported on non-linux platforms"));
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2202,8 +2201,7 @@ pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link ATTRIBUTE_UNUSED,
|
||||
const char *vf_sysfs_device_link ATTRIBUTE_UNUSED,
|
||||
int *vf_index ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciGetVirtualFunctionIndex is "
|
||||
"not supported on non-linux platforms"));
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||
return -1;
|
||||
|
||||
}
|
||||
@ -2212,8 +2210,7 @@ int
|
||||
pciConfigAddressToSysfsFile(struct pci_config_address *dev ATTRIBUTE_UNUSED,
|
||||
char **pci_sysfs_device_link ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciConfigAddressToSysfsFile is not "
|
||||
"supported on non-linux platforms"));
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2221,8 +2218,7 @@ int
|
||||
pciDeviceNetName(char *device_link_sysfs_path ATTRIBUTE_UNUSED,
|
||||
char **netname ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciDeviceNetName is not "
|
||||
"supported on non-linux platforms"));
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -2231,8 +2227,7 @@ pciDeviceGetVirtualFunctionInfo(const char *vf_sysfs_device_path ATTRIBUTE_UNUSE
|
||||
char **pfname ATTRIBUTE_UNUSED,
|
||||
int *vf_index ATTRIBUTE_UNUSED)
|
||||
{
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, _("pciDeviceGetVirtualFunctionInfo "
|
||||
"is not supported on non-linux platforms"));
|
||||
pciReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
|
||||
return -1;
|
||||
}
|
||||
#endif /* __linux__ */
|
||||
|
Loading…
Reference in New Issue
Block a user