This patch fixes *some* compilation issues on non-Linux platforms (cygwin).
Signed-off-by: Stefan Berger <stefanb(a)linux.vnet.ibm.com>
diff --git a/src/util/interface.c b/src/util/interface.c
index aec12f5..5d473b7 100644
--- a/src/util/interface.c
+++ b/src/util/interface.c
@@ -1317,7 +1317,7 @@ ifaceGetPhysicalFunction(const char *ifname, char
**pfname)
}
#else
int
-ifaceIsVirtualFunction(const char *ifname)
+ifaceIsVirtualFunction(const char *ifname ATTRIBUTE_UNUSED)
{
ifaceError(VIR_ERR_INTERNAL_ERROR, "%s",
_("ifaceIsVirtualFunction is not supported on non-linux "
@@ -1326,8 +1326,9 @@ ifaceIsVirtualFunction(const char *ifname)
}
int
-ifaceGetVirtualFunctionIndex(const char *pfname, const char *vfname,
- int *vf_index)
+ifaceGetVirtualFunctionIndex(const char *pfname ATTRIBUTE_UNUSED,
+ const char *vfname ATTRIBUTE_UNUSED,
+ int *vf_index ATTRIBUTE_UNUSED)
{
ifaceError(VIR_ERR_INTERNAL_ERROR, "%s",
_("ifaceGetVirtualFunctionIndex is not supported on
non-linux "
@@ -1336,7 +1337,8 @@ ifaceGetVirtualFunctionIndex(const char *pfname,
const char *vfname,
}
int
-ifaceGetPhysicalFunction(const char *ifname, char **pfname)
+ifaceGetPhysicalFunction(const char *ifname ATTRIBUTE_UNUSED,
+ char **pfname ATTRIBUTE_UNUSED)
{
ifaceError(VIR_ERR_INTERNAL_ERROR, "%s",
_("ifaceGetPhysicalFunction is not supported on non-linux "
diff --git a/src/util/pci.c b/src/util/pci.c
index 7040e55..9873f33 100644
--- a/src/util/pci.c
+++ b/src/util/pci.c
@@ -1685,6 +1685,8 @@ int pciDeviceIsAssignable(pciDevice *dev,
return 1;
}
+#ifdef __linux__
+
/*
* returns 1 if equal and 0 if not
*/
@@ -1804,7 +1806,6 @@ out:
return ret;
}
-#ifdef __linux__
/*
* Returns Physical function given a virtual function
*/
@@ -2010,8 +2011,8 @@ out:
}
#else
int
-pciGetPhysicalFunction(const char *vf_sysfs_path,
- struct pci_config_address **physical_function)
+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"));
@@ -2019,9 +2020,9 @@ pciGetPhysicalFunction(const char *vf_sysfs_path,
}
int
-pciGetVirtualFunctions(const char *sysfs_path,
- struct pci_config_address ***virtual_functions,
- unsigned int *num_virtual_functions)
+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"));
@@ -2029,7 +2030,7 @@ pciGetVirtualFunctions(const char *sysfs_path,
}
int
-pciDeviceIsVirtualFunction(const char *vf_sysfs_device_link)
+pciDeviceIsVirtualFunction(const char *vf_sysfs_device_link
ATTRIBUTE_UNUSED)
{
pciReportError(VIR_ERR_INTERNAL_ERROR,
_("pciDeviceIsVirtualFunction is "
"not supported on non-linux platforms"));
@@ -2037,9 +2038,9 @@ pciDeviceIsVirtualFunction(const char
*vf_sysfs_device_link)
}
int
-pciGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
- const char *vf_sysfs_device_link,
- int *vf_index)
+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"));
@@ -2048,7 +2049,8 @@ pciGetVirtualFunctionIndex(const char
*pf_sysfs_device_link,
}
int
-pciDeviceNetName(char *device_link_sysfs_path, char **netname)
+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"));
diff --git a/src/util/virfile.c b/src/util/virfile.c
index 0edf058..1158998 100644
--- a/src/util/virfile.c
+++ b/src/util/virfile.c
@@ -44,7 +44,7 @@
int virFileClose(int *fdptr, bool preserve_errno)
{
- int saved_errno;
+ int saved_errno = 0;
int rc = 0;
if (*fdptr >= 0) {
@@ -62,7 +62,7 @@ int virFileClose(int *fdptr, bool preserve_errno)
int virFileFclose(FILE **file, bool preserve_errno)
{
- int saved_errno;
+ int saved_errno = 0;
int rc = 0;
if (*file) {
diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c
index 7dd3c51..1927051 100644
--- a/src/util/virpidfile.c
+++ b/src/util/virpidfile.c
@@ -213,6 +213,8 @@ int virPidFileReadPathIfAlive(const char *path,
#ifdef __linux__
if (virFileLinkPointsTo(procpath, binpath) == 0)
*pid = -1;
+#else
+ (void)binpath;
#endif
VIR_FREE(procpath);