diff --git a/src/lxc/lxc_cgroup.c b/src/lxc/lxc_cgroup.c index de6b53bd9c..5c8acb3595 100644 --- a/src/lxc/lxc_cgroup.c +++ b/src/lxc/lxc_cgroup.c @@ -427,7 +427,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, } } - for (i = 0 ; i < def->ndisks ; i++) { + for (i = 0; i < def->ndisks; i++) { if (def->disks[i]->type != VIR_DOMAIN_DISK_TYPE_BLOCK) continue; @@ -445,7 +445,7 @@ static int virLXCCgroupSetupDeviceACL(virDomainDefPtr def, } } - for (i = 0 ; i < def->nfss ; i++) { + for (i = 0; i < def->nfss; i++) { if (def->fss[i]->type != VIR_DOMAIN_FS_TYPE_BLOCK) continue; diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c index b4be4cd19d..c74e3ca102 100644 --- a/src/lxc/lxc_container.c +++ b/src/lxc/lxc_container.c @@ -353,7 +353,7 @@ static int lxcContainerRenameAndEnableInterfaces(bool privNet, size_t i; char *newname = NULL; - for (i = 0 ; i < nveths ; i++) { + for (i = 0; i < nveths; i++) { if (virAsprintf(&newname, "eth%zu", i) < 0) { virReportOOMError(); rc = -1; @@ -475,7 +475,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, if (lxcContainerGetSubtree(prefix, &mounts, &nmounts) < 0) goto cleanup; - for (i = 0 ; i < nmounts ; i++) { + for (i = 0; i < nmounts; i++) { VIR_DEBUG("Umount %s", mounts[i]); if (umount(mounts[i]) < 0) { char ebuf[1024]; @@ -509,7 +509,7 @@ static int lxcContainerUnmountSubtree(const char *prefix, ret = 0; cleanup: - for (i = 0 ; i < nmounts ; i++) + for (i = 0; i < nmounts; i++) VIR_FREE(mounts[i]); VIR_FREE(mounts); @@ -689,7 +689,7 @@ static int lxcContainerMountBasicFS(char *sec_mount_options) VIR_DEBUG("Mounting basic filesystems sec_mount_options=%s", sec_mount_options); - for (i = 0 ; i < ARRAY_CARDINALITY(mnts) ; i++) { + for (i = 0; i < ARRAY_CARDINALITY(mnts); i++) { const char *srcpath = NULL; VIR_DEBUG("Processing %s -> %s", @@ -849,7 +849,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths) }; /* Populate /dev/ with a few important bits */ - for (i = 0 ; i < ARRAY_CARDINALITY(devs) ; i++) { + for (i = 0; i < ARRAY_CARDINALITY(devs); i++) { dev_t dev = makedev(devs[i].maj, devs[i].min); if (mknod(devs[i].path, S_IFCHR, dev) < 0 || chmod(devs[i].path, devs[i].mode)) { @@ -860,7 +860,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths) } } - for (i = 0 ; i < ARRAY_CARDINALITY(links) ; i++) { + for (i = 0; i < ARRAY_CARDINALITY(links); i++) { if (symlink(links[i].src, links[i].dst) < 0) { virReportSystemError(errno, _("Failed to symlink device %s to %s"), @@ -890,7 +890,7 @@ static int lxcContainerPopulateDevices(char **ttyPaths, size_t nttyPaths) } } - for (i = 0 ; i < nttyPaths ; i++) { + for (i = 0; i < nttyPaths; i++) { char *tty; if (virAsprintf(&tty, "/dev/tty%zu", i+1) < 0) { virReportOOMError(); @@ -1356,7 +1356,7 @@ static int lxcContainerMountAllFS(virDomainDefPtr vmDef, VIR_DEBUG("Mounting all non-root filesystems"); /* Pull in rest of container's mounts */ - for (i = 0 ; i < vmDef->nfss ; i++) { + for (i = 0; i < vmDef->nfss; i++) { if (STREQ(vmDef->fss[i]->dst, "/")) continue; @@ -1460,7 +1460,7 @@ static int lxcContainerSetupAllDisks(virDomainDefPtr vmDef, size_t i; VIR_DEBUG("Setting up disks"); - for (i = 0 ; i < vmDef->ndisks ; i++) { + for (i = 0; i < vmDef->ndisks; i++) { if (lxcContainerSetupDisk(vmDef, vmDef->disks[i], securityDriver) < 0) return -1; @@ -1702,7 +1702,7 @@ static int lxcContainerSetupAllHostdevs(virDomainDefPtr vmDef, size_t i; VIR_DEBUG("Setting up hostdevs"); - for (i = 0 ; i < vmDef->nhostdevs ; i++) { + for (i = 0; i < vmDef->nhostdevs; i++) { virDomainHostdevDefPtr def = vmDef->hostdevs[i]; switch (def->mode) { case VIR_DOMAIN_HOSTDEV_MODE_SUBSYS: @@ -1840,7 +1840,7 @@ static int lxcContainerResolveSymlinks(virDomainDefPtr vmDef) char *newroot; size_t i; - for (i = 0 ; i < vmDef->nfss ; i++) { + for (i = 0; i < vmDef->nfss; i++) { virDomainFSDefPtr fs = vmDef->fss[i]; if (!fs->src) continue; @@ -2070,7 +2070,7 @@ lxcNeedNetworkNamespace(virDomainDefPtr def) return true; if (def->features & (1 << VIR_DOMAIN_FEATURE_PRIVNET)) return true; - for (i = 0 ; i < def->nhostdevs ; i++) { + for (i = 0; i < def->nhostdevs; i++) { if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_CAPABILITIES && def->hostdevs[i]->source.caps.type == VIR_DOMAIN_HOSTDEV_CAPS_TYPE_NET) return true; diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index b3fc598fd0..dfe686b744 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -199,7 +199,7 @@ static int virLXCControllerCloseLoopDevices(virLXCControllerPtr ctrl) { size_t i; - for (i = 0 ; i < ctrl->nloopDevs ; i++) + for (i = 0; i < ctrl->nloopDevs; i++) VIR_FORCE_CLOSE(ctrl->loopDevFds[i]); return 0; @@ -251,11 +251,11 @@ static void virLXCControllerFree(virLXCControllerPtr ctrl) virObjectUnref(ctrl->securityManager); - for (i = 0 ; i < ctrl->nveths ; i++) + for (i = 0; i < ctrl->nveths; i++) VIR_FREE(ctrl->veths[i]); VIR_FREE(ctrl->veths); - for (i = 0 ; i < ctrl->nconsoles ; i++) + for (i = 0; i < ctrl->nconsoles; i++) virLXCControllerConsoleClose(&(ctrl->consoles[i])); VIR_FREE(ctrl->consoles); @@ -450,7 +450,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl) size_t i; int ret = -1; - for (i = 0 ; i < ctrl->def->nfss ; i++) { + for (i = 0; i < ctrl->def->nfss; i++) { virDomainFSDefPtr fs = ctrl->def->fss[i]; int fd; @@ -487,7 +487,7 @@ static int virLXCControllerSetupLoopDevices(virLXCControllerPtr ctrl) } } - for (i = 0 ; i < ctrl->def->ndisks ; i++) { + for (i = 0; i < ctrl->def->ndisks; i++) { virDomainDiskDefPtr disk = ctrl->def->disks[i]; int fd; @@ -1067,7 +1067,7 @@ static int virLXCControllerMain(virLXCControllerPtr ctrl) virResetLastError(); - for (i = 0 ; i < ctrl->nconsoles ; i++) { + for (i = 0; i < ctrl->nconsoles; i++) { if ((ctrl->consoles[i].epollFd = epoll_create1(EPOLL_CLOEXEC)) < 0) { virReportSystemError(errno, "%s", _("Unable to create epoll fd")); @@ -1115,7 +1115,7 @@ cleanup: virMutexDestroy(&lock); cleanup2: - for (i = 0 ; i < ctrl->nconsoles ; i++) + for (i = 0; i < ctrl->nconsoles; i++) virLXCControllerConsoleClose(&(ctrl->consoles[i])); return rc; @@ -1138,7 +1138,7 @@ static int virLXCControllerMoveInterfaces(virLXCControllerPtr ctrl) size_t i; virDomainDefPtr def = ctrl->def; - for (i = 0 ; i < ctrl->nveths ; i++) { + for (i = 0; i < ctrl->nveths; i++) { if (virNetDevSetNamespace(ctrl->veths[i], ctrl->initpid) < 0) return -1; } @@ -1175,7 +1175,7 @@ static int virLXCControllerDeleteInterfaces(virLXCControllerPtr ctrl) size_t i; int ret = 0; - for (i = 0 ; i < ctrl->nveths ; i++) { + for (i = 0; i < ctrl->nveths; i++) { if (virNetDevVethDelete(ctrl->veths[i]) < 0) ret = -1; } @@ -1371,7 +1371,7 @@ virLXCControllerSetupConsoles(virLXCControllerPtr ctrl, { size_t i; - for (i = 0 ; i < ctrl->nconsoles ; i++) { + for (i = 0; i < ctrl->nconsoles; i++) { VIR_DEBUG("Opening tty on private %s", ctrl->devptmx); if (lxcCreateTty(ctrl->devptmx, &ctrl->consoles[i].contFd, @@ -1568,7 +1568,7 @@ virLXCControllerRun(virLXCControllerPtr ctrl) if (virLXCControllerDaemonHandshake(ctrl) < 0) goto cleanup; - for (i = 0 ; i < ctrl->nconsoles ; i++) + for (i = 0; i < ctrl->nconsoles; i++) if (virLXCControllerConsoleSetNonblocking(&(ctrl->consoles[i])) < 0) goto cleanup; @@ -1582,7 +1582,7 @@ cleanup: VIR_FORCE_CLOSE(containerhandshake[0]); VIR_FORCE_CLOSE(containerhandshake[1]); - for (i = 0 ; i < ctrl->nconsoles ; i++) + for (i = 0; i < ctrl->nconsoles; i++) VIR_FREE(containerTTYPaths[i]); VIR_FREE(containerTTYPaths); @@ -1739,7 +1739,7 @@ int main(int argc, char *argv[]) ctrl->veths = veths; ctrl->nveths = nveths; - for (i = 0 ; i < nttyFDs ; i++) { + for (i = 0; i < nttyFDs; i++) { if (virLXCControllerAddConsole(ctrl, ttyFDs[i]) < 0) goto cleanup; ttyFDs[i] = -1; @@ -1801,7 +1801,7 @@ cleanup: virPidFileDelete(LXC_STATE_DIR, name); if (ctrl) virLXCControllerDeleteInterfaces(ctrl); - for (i = 0 ; i < nttyFDs ; i++) + for (i = 0; i < nttyFDs; i++) VIR_FORCE_CLOSE(ttyFDs[i]); VIR_FREE(ttyFDs); diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 997f81dd1d..3d6baf5378 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2191,7 +2191,7 @@ lxcDomainInterfaceStats(virDomainPtr dom, } /* Check the path is one of the domain's network interfaces. */ - for (i = 0 ; i < vm->def->nnets ; i++) { + for (i = 0; i < vm->def->nnets; i++) { if (vm->def->nets[i]->ifname && STREQ(vm->def->nets[i]->ifname, path)) { ret = 0; @@ -2544,7 +2544,7 @@ lxcDomainOpenConsole(virDomainPtr dom, } if (dev_name) { - for (i = 0 ; i < vm->def->nconsoles ; i++) { + for (i = 0; i < vm->def->nconsoles; i++) { if (vm->def->consoles[i]->info.alias && STREQ(vm->def->consoles[i]->info.alias, dev_name)) { chr = vm->def->consoles[i]; diff --git a/src/lxc/lxc_hostdev.c b/src/lxc/lxc_hostdev.c index 0ce5d053ea..257e93b343 100644 --- a/src/lxc/lxc_hostdev.c +++ b/src/lxc/lxc_hostdev.c @@ -232,7 +232,7 @@ virLXCPrepareHostUSBDevices(virLXCDriverPtr driver, /* Loop 1: build temporary list */ - for (i = 0 ; i < nhostdevs ; i++) { + for (i = 0; i < nhostdevs; i++) { virDomainHostdevDefPtr hostdev = hostdevs[i]; bool required = true; virUSBDevicePtr usb; @@ -287,7 +287,7 @@ int virLXCPrepareHostDevices(virLXCDriverPtr driver, return 0; /* Sanity check for supported configurations only */ - for (i = 0 ; i < def->nhostdevs ; i++) { + for (i = 0; i < def->nhostdevs; i++) { virDomainHostdevDefPtr dev = def->hostdevs[i]; switch (dev->mode) { diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index b06d748a21..d2485c3ff9 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -261,7 +261,7 @@ static void virLXCProcessCleanup(virLXCDriverPtr driver, virLXCDomainReAttachHostDevices(driver, vm->def); - for (i = 0 ; i < vm->def->nnets ; i++) { + for (i = 0; i < vm->def->nnets; i++) { virDomainNetDefPtr iface = vm->def->nets[i]; vport = virDomainNetGetActualVirtPortProfile(iface); if (iface->ifname) { @@ -433,7 +433,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn, int ret = -1; size_t i; - for (i = 0 ; i < def->nnets ; i++) { + for (i = 0; i < def->nnets; i++) { char *veth = NULL; /* If appropriate, grab a physical device from the configured * network's pool of devices, or resolve bridge device name @@ -536,7 +536,7 @@ static int virLXCProcessSetupInterfaces(virConnectPtr conn, cleanup: if (ret < 0) { - for (i = 0 ; i < def->nnets ; i++) { + for (i = 0; i < def->nnets; i++) { virDomainNetDefPtr iface = def->nets[i]; virNetDevVPortProfilePtr vport = virDomainNetGetActualVirtPortProfile(iface); if (vport && vport->virtPortType == VIR_NETDEV_VPORT_PROFILE_OPENVSWITCH) @@ -851,7 +851,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver, } virCommandAddArgList(cmd, "--name", vm->def->name, NULL); - for (i = 0 ; i < nttyFDs ; i++) { + for (i = 0; i < nttyFDs; i++) { virCommandAddArg(cmd, "--console"); virCommandAddArgFormat(cmd, "%d", ttyFDs[i]); virCommandPreserveFD(cmd, ttyFDs[i]); @@ -864,7 +864,7 @@ virLXCProcessBuildControllerCmd(virLXCDriverPtr driver, virCommandAddArgFormat(cmd, "%d", handshakefd); virCommandAddArg(cmd, "--background"); - for (i = 0 ; i < nveths ; i++) { + for (i = 0; i < nveths; i++) { virCommandAddArgList(cmd, "--veth", veths[i], NULL); } @@ -1131,7 +1131,7 @@ int virLXCProcessStart(virConnectPtr conn, virReportOOMError(); goto cleanup; } - for (i = 0 ; i < vm->def->nconsoles ; i++) + for (i = 0; i < vm->def->nconsoles; i++) ttyFDs[i] = -1; /* If you are using a SecurityDriver with dynamic labelling, @@ -1152,7 +1152,7 @@ int virLXCProcessStart(virConnectPtr conn, vm->def, NULL) < 0) goto cleanup; - for (i = 0 ; i < vm->def->nconsoles ; i++) { + for (i = 0; i < vm->def->nconsoles; i++) { char *ttyPath; if (vm->def->consoles[i]->source.type != VIR_DOMAIN_CHR_TYPE_PTY) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -1334,7 +1334,7 @@ cleanup: virReportSystemError(errno, "%s", _("could not close logfile")); rc = -1; } - for (i = 0 ; i < nveths ; i++) { + for (i = 0; i < nveths; i++) { if (rc != 0) ignore_value(virNetDevVethDelete(veths[i])); VIR_FREE(veths[i]); @@ -1361,7 +1361,7 @@ cleanup: VIR_FREE(vm->def->seclabels[0]->imagelabel); } } - for (i = 0 ; i < nttyFDs ; i++) + for (i = 0; i < nttyFDs; i++) VIR_FORCE_CLOSE(ttyFDs[i]); VIR_FREE(ttyFDs); VIR_FORCE_CLOSE(handshakefds[0]);