diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c index e2527c9c75..5d06eb6e88 100644 --- a/src/storage/storage_backend.c +++ b/src/storage/storage_backend.c @@ -636,7 +636,7 @@ virStorageBackendCreateQemuImgOpts(char **opts, { virBuffer buf = VIR_BUFFER_INITIALIZER; bool b; - int i; + size_t i; if (backingType) virBufferAsprintf(&buf, "backing_fmt=%s,", backingType); @@ -1069,7 +1069,7 @@ virStorageBackendGetBuildVolFromFunction(virStorageVolDefPtr vol, virStorageBackendPtr virStorageBackendForType(int type) { - unsigned int i; + size_t i; for (i = 0; backends[i]; i++) if (backends[i]->type == type) return backends[i]; @@ -1362,7 +1362,7 @@ int virStorageBackendDetectBlockVolFormatFD(virStorageVolTargetPtr target, int fd) { - int i; + size_t i; off_t start; unsigned char buffer[1024]; ssize_t bytes; @@ -1527,7 +1527,8 @@ virStorageBackendRunProgRegex(virStoragePoolObjPtr pool, regex_t *reg; regmatch_t *vars = NULL; char line[1024]; - int maxReg = 0, i, j; + int maxReg = 0; + size_t i, j; int totgroups = 0, ngroup = 0, maxvars = 0; char **groups; @@ -1657,7 +1658,7 @@ virStorageBackendRunProgNul(virStoragePoolObjPtr pool, FILE *fp = NULL; char **v; int ret = -1; - int i; + size_t i; if (n_columns == 0) return -1; diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c index 6ebcf48055..4e53ec5e60 100644 --- a/src/storage/storage_backend_disk.c +++ b/src/storage/storage_backend_disk.c @@ -432,7 +432,7 @@ virStorageBackendDiskPartTypeToCreate(virStoragePoolObjPtr pool) if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) { /* count primary and extended paritions, can't be more than 3 to create a new primary partition */ - int i; + size_t i; int count = 0; for (i = 0; i < pool->volumes.count; i++) { if (pool->volumes.objs[i]->target.type == VIR_STORAGE_VOL_DISK_TYPE_PRIMARY || @@ -454,7 +454,7 @@ virStorageBackendDiskPartFormat(virStoragePoolObjPtr pool, virStorageVolDefPtr vol, char** partFormat) { - int i; + size_t i; if (pool->def->source.format == VIR_STORAGE_POOL_DISK_DOS) { const char *partedFormat; partedFormat = virStoragePartedFsTypeTypeToString(vol->target.format); @@ -527,7 +527,7 @@ virStorageBackendDiskPartBoundries(virStoragePoolObjPtr pool, unsigned long long *end, unsigned long long allocation) { - int i; + size_t i; int smallestExtent = -1; unsigned long long smallestSize = 0; unsigned long long extraBytes = 0; diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c index 9802d158ae..8b40f5524f 100644 --- a/src/storage/storage_backend_fs.c +++ b/src/storage/storage_backend_fs.c @@ -253,7 +253,7 @@ virStorageBackendFileSystemNetFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSE }; virStoragePoolSourcePtr source = NULL; char *retval = NULL; - unsigned int i; + size_t i; virCommandPtr cmd = NULL; virCheckFlags(0, NULL); diff --git a/src/storage/storage_backend_iscsi.c b/src/storage/storage_backend_iscsi.c index 402462d9ab..ba4f388bb5 100644 --- a/src/storage/storage_backend_iscsi.c +++ b/src/storage/storage_backend_iscsi.c @@ -548,7 +548,7 @@ virStorageBackendISCSIFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, size_t ntargets = 0; char **targets = NULL; char *ret = NULL; - int i; + size_t i; virStoragePoolSourceList list = { .type = VIR_STORAGE_POOL_ISCSI, .nsources = 0, diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c index fff303dea5..416a0424fe 100644 --- a/src/storage/storage_backend_logical.c +++ b/src/storage/storage_backend_logical.c @@ -77,7 +77,8 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool, regex_t *reg = NULL; regmatch_t *vars = NULL; char *p = NULL; - int i, err, nextents, nvars, ret = -1; + size_t i; + int err, nextents, nvars, ret = -1; const char *attrs = groups[9]; /* Skip inactive volume */ @@ -213,7 +214,8 @@ virStorageBackendLogicalMakeVol(virStoragePoolObjPtr pool, /* vars[0] is skipped */ for (i = 0; i < nextents; i++) { - int j, len; + size_t j; + int len; char *offset_str = NULL; j = (i * 2) + 1; @@ -339,7 +341,7 @@ virStorageBackendLogicalFindPoolSourcesFunc(virStoragePoolObjPtr pool ATTRIBUTE_ virStoragePoolSourceListPtr sourceList = data; char *pvname = NULL; char *vgname = NULL; - int i; + size_t i; virStoragePoolSourceDevicePtr dev; virStoragePoolSource *thisSource; @@ -402,7 +404,7 @@ virStorageBackendLogicalFindPoolSources(virConnectPtr conn ATTRIBUTE_UNUSED, virCommandPtr cmd; char *retval = NULL; virStoragePoolSourceList sourceList; - int i; + size_t i; virCheckFlags(0, NULL); diff --git a/src/storage/storage_backend_rbd.c b/src/storage/storage_backend_rbd.c index 7b73a387fa..493e33bc40 100644 --- a/src/storage/storage_backend_rbd.c +++ b/src/storage/storage_backend_rbd.c @@ -56,7 +56,7 @@ static int virStorageBackendRBDOpenRADOSConn(virStorageBackendRBDStatePtr *ptr, virBuffer mon_host = VIR_BUFFER_INITIALIZER; virSecretPtr secret = NULL; char secretUuid[VIR_UUID_STRING_BUFLEN]; - int i; + size_t i; char *mon_buff = NULL; VIR_DEBUG("Found Cephx username: %s", @@ -260,7 +260,6 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, size_t max_size = 1024; int ret = -1; int len = -1; - int i; char *name, *names = NULL; virStorageBackendRBDStatePtr ptr; ptr.cluster = NULL; @@ -316,7 +315,7 @@ static int virStorageBackendRBDRefreshPool(virConnectPtr conn ATTRIBUTE_UNUSED, VIR_FREE(names); } - for (i = 0, name = names; name < names + max_size; i++) { + for (name = names; name < names + max_size;) { virStorageVolDefPtr vol; if (VIR_REALLOC_N(pool->volumes.objs, pool->volumes.count + 1) < 0) { diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index 7b119f9bb5..a8eb731aec 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -67,7 +67,7 @@ static void storageDriverUnlock(virStorageDriverStatePtr driver) static void storageDriverAutostart(virStorageDriverStatePtr driver) { - unsigned int i; + size_t i; for (i = 0; i < driver->pools.count; i++) { virStoragePoolObjPtr pool = driver->pools.objs[i]; @@ -339,7 +339,8 @@ storageClose(virConnectPtr conn) { static int storageConnectNumOfStoragePools(virConnectPtr conn) { virStorageDriverStatePtr driver = conn->storagePrivateData; - unsigned int i, nactive = 0; + size_t i; + int nactive = 0; if (virConnectNumOfStoragePoolsEnsureACL(conn) < 0) return -1; @@ -363,7 +364,8 @@ storageConnectListStoragePools(virConnectPtr conn, char **const names, int nnames) { virStorageDriverStatePtr driver = conn->storagePrivateData; - int got = 0, i; + int got = 0; + size_t i; if (virConnectListStoragePoolsEnsureACL(conn) < 0) return -1; @@ -396,7 +398,8 @@ storageConnectListStoragePools(virConnectPtr conn, static int storageConnectNumOfDefinedStoragePools(virConnectPtr conn) { virStorageDriverStatePtr driver = conn->storagePrivateData; - unsigned int i, nactive = 0; + size_t i; + int nactive = 0; if (virConnectNumOfDefinedStoragePoolsEnsureACL(conn) < 0) return -1; @@ -420,7 +423,8 @@ storageConnectListDefinedStoragePools(virConnectPtr conn, char **const names, int nnames) { virStorageDriverStatePtr driver = conn->storagePrivateData; - int got = 0, i; + int got = 0; + size_t i; if (virConnectListDefinedStoragePoolsEnsureACL(conn) < 0) return -1; @@ -1158,7 +1162,8 @@ static int storagePoolNumOfVolumes(virStoragePoolPtr obj) { virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; - int ret = -1, i; + int ret = -1; + size_t i; storageDriverLock(driver); pool = virStoragePoolObjFindByUUID(&driver->pools, obj->uuid); @@ -1197,7 +1202,8 @@ storagePoolListVolumes(virStoragePoolPtr obj, int maxnames) { virStorageDriverStatePtr driver = obj->conn->storagePrivateData; virStoragePoolObjPtr pool; - int i, n = 0; + size_t i; + int n = 0; memset(names, 0, maxnames * sizeof(*names)); @@ -1247,7 +1253,7 @@ storagePoolListAllVolumes(virStoragePoolPtr pool, unsigned int flags) { virStorageDriverStatePtr driver = pool->conn->storagePrivateData; virStoragePoolObjPtr obj; - int i; + size_t i; virStorageVolPtr *tmp_vols = NULL; virStorageVolPtr vol = NULL; int nvols = 0; @@ -1365,7 +1371,7 @@ static virStorageVolPtr storageVolLookupByKey(virConnectPtr conn, const char *key) { virStorageDriverStatePtr driver = conn->storagePrivateData; - unsigned int i; + size_t i; virStorageVolPtr ret = NULL; storageDriverLock(driver); @@ -1404,7 +1410,7 @@ static virStorageVolPtr storageVolLookupByPath(virConnectPtr conn, const char *path) { virStorageDriverStatePtr driver = conn->storagePrivateData; - unsigned int i; + size_t i; virStorageVolPtr ret = NULL; char *cleanpath; @@ -2271,7 +2277,7 @@ storageVolDelete(virStorageVolPtr obj, virStoragePoolObjPtr pool; virStorageBackendPtr backend; virStorageVolDefPtr vol = NULL; - unsigned int i; + size_t i; int ret = -1; storageDriverLock(driver);