Blob Blame History Raw
From 3a1d215c947592bdf9db3cb65480add04119bb98 Mon Sep 17 00:00:00 2001
Message-Id: <3a1d215c947592bdf9db3cb65480add04119bb98.1383922565.git.jdenemar@redhat.com>
From: Laine Stump <laine@laine.org>
Date: Fri, 8 Nov 2013 05:42:32 -0700
Subject: [PATCH] util: use size_t instead of unsigned int for
 num_virtual_functions

This is a prerequisite to the fix for the fix to:

  https://bugzilla.redhat.com/show_bug.cgi?id=1025397

num_virtual_functions needs to be size_t in order to use the
VIR_APPEND_ELEMENT macro.

(cherry picked from commit 89e2a6c88c2d26cf3a9a70adc8fdac970a471b64)

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/conf/node_device_conf.h | 2 +-
 src/network/bridge_driver.c | 2 +-
 src/util/virnetdev.c        | 4 ++--
 src/util/virnetdev.h        | 2 +-
 src/util/virpci.c           | 8 ++++----
 src/util/virpci.h           | 2 +-
 6 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/conf/node_device_conf.h b/src/conf/node_device_conf.h
index 1fa61b5..60cf8c3 100644
--- a/src/conf/node_device_conf.h
+++ b/src/conf/node_device_conf.h
@@ -110,7 +110,7 @@ struct _virNodeDevCapsDef {
             char *vendor_name;
             virPCIDeviceAddressPtr physical_function;
             virPCIDeviceAddressPtr *virtual_functions;
-            unsigned int num_virtual_functions;
+            size_t num_virtual_functions;
             unsigned int flags;
             virPCIDeviceAddressPtr *iommuGroupDevices;
             size_t nIommuGroupDevices;
diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index c900478..6e31840 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -3736,7 +3736,7 @@ int networkRegister(void) {
  */
 static int
 networkCreateInterfacePool(virNetworkDefPtr netdef) {
-    unsigned int num_virt_fns = 0;
+    size_t num_virt_fns = 0;
     char **vfname = NULL;
     virPCIDeviceAddressPtr *virt_fns;
     int ret = -1;
diff --git a/src/util/virnetdev.c b/src/util/virnetdev.c
index 30df7a6..566a207 100644
--- a/src/util/virnetdev.c
+++ b/src/util/virnetdev.c
@@ -1080,7 +1080,7 @@ int
 virNetDevGetVirtualFunctions(const char *pfname,
                              char ***vfname,
                              virPCIDeviceAddressPtr **virt_fns,
-                             unsigned int *n_vfname)
+                             size_t *n_vfname)
 {
     int ret = -1;
     size_t i;
@@ -1267,7 +1267,7 @@ int
 virNetDevGetVirtualFunctions(const char *pfname ATTRIBUTE_UNUSED,
                              char ***vfname ATTRIBUTE_UNUSED,
                              virPCIDeviceAddressPtr **virt_fns ATTRIBUTE_UNUSED,
-                             unsigned int *n_vfname ATTRIBUTE_UNUSED)
+                             size_t *n_vfname ATTRIBUTE_UNUSED)
 {
     virReportSystemError(ENOSYS, "%s",
                          _("Unable to get virtual functions on this platform"));
diff --git a/src/util/virnetdev.h b/src/util/virnetdev.h
index 44a37ca..9fd6628 100644
--- a/src/util/virnetdev.h
+++ b/src/util/virnetdev.h
@@ -124,7 +124,7 @@ int virNetDevGetPhysicalFunction(const char *ifname, char **pfname)
 int virNetDevGetVirtualFunctions(const char *pfname,
                                  char ***vfname,
                                  virPCIDeviceAddressPtr **virt_fns,
-                                 unsigned int *n_vfname)
+                                 size_t *n_vfname)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3)
     ATTRIBUTE_NONNULL(4) ATTRIBUTE_RETURN_CHECK;
 
diff --git a/src/util/virpci.c b/src/util/virpci.c
index be95d03..87ea81b 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -2385,7 +2385,7 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path,
 int
 virPCIGetVirtualFunctions(const char *sysfs_path,
                           virPCIDeviceAddressPtr **virtual_functions,
-                          unsigned int *num_virtual_functions)
+                          size_t *num_virtual_functions)
 {
     int ret = -1;
     size_t i;
@@ -2418,7 +2418,7 @@ virPCIGetVirtualFunctions(const char *sysfs_path,
                 goto error;
             }
 
-            VIR_DEBUG("Number of virtual functions: %d",
+            VIR_DEBUG("Number of virtual functions: %zu",
                       *num_virtual_functions);
 
             if (virPCIGetDeviceAddressFromSysfsLink(device_link,
@@ -2489,7 +2489,7 @@ virPCIGetVirtualFunctionIndex(const char *pf_sysfs_device_link,
 {
     int ret = -1;
     size_t i;
-    unsigned int num_virt_fns = 0;
+    size_t num_virt_fns = 0;
     virPCIDeviceAddressPtr vf_bdf = NULL;
     virPCIDeviceAddressPtr *virt_fns = NULL;
 
@@ -2634,7 +2634,7 @@ virPCIGetPhysicalFunction(const char *vf_sysfs_path ATTRIBUTE_UNUSED,
 int
 virPCIGetVirtualFunctions(const char *sysfs_path ATTRIBUTE_UNUSED,
                           virPCIDeviceAddressPtr **virtual_functions ATTRIBUTE_UNUSED,
-                          unsigned int *num_virtual_functions ATTRIBUTE_UNUSED)
+                          size_t *num_virtual_functions ATTRIBUTE_UNUSED)
 {
     virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _(unsupported));
     return -1;
diff --git a/src/util/virpci.h b/src/util/virpci.h
index 0aa6fee..0479f0b 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -138,7 +138,7 @@ int virPCIGetPhysicalFunction(const char *sysfs_path,
 
 int virPCIGetVirtualFunctions(const char *sysfs_path,
                               virPCIDeviceAddressPtr **virtual_functions,
-                              unsigned int *num_virtual_functions);
+                              size_t *num_virtual_functions);
 
 int virPCIIsVirtualFunction(const char *vf_sysfs_device_link);
 
-- 
1.8.4.2