mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Use virDirOpenQuiet
Remove all the remaining usage of opendir.
This commit is contained in:
parent
7a5df06e10
commit
994b024624
@ -1058,8 +1058,7 @@ static int openvzAssignUUIDs(void)
|
|||||||
if (conf_dir == NULL)
|
if (conf_dir == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
dp = opendir(conf_dir);
|
if (virDirOpenQuiet(&dp, conf_dir) < 0) {
|
||||||
if (dp == NULL) {
|
|
||||||
VIR_FREE(conf_dir);
|
VIR_FREE(conf_dir);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -111,7 +111,7 @@ qemuHostdevHostSupportsPassthroughVFIO(void)
|
|||||||
int direrr;
|
int direrr;
|
||||||
|
|
||||||
/* condition 1 - /sys/kernel/iommu_groups/ contains entries */
|
/* condition 1 - /sys/kernel/iommu_groups/ contains entries */
|
||||||
if (!(iommuDir = opendir("/sys/kernel/iommu_groups/")))
|
if (virDirOpenQuiet(&iommuDir, "/sys/kernel/iommu_groups/") < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
while ((direrr = virDirRead(iommuDir, &iommuGroup, NULL)) > 0) {
|
while ((direrr = virDirRead(iommuDir, &iommuGroup, NULL)) > 0) {
|
||||||
|
@ -1917,7 +1917,7 @@ virStorageBackendStablePath(virStoragePoolObjPtr pool,
|
|||||||
* get created.
|
* get created.
|
||||||
*/
|
*/
|
||||||
reopen:
|
reopen:
|
||||||
if ((dh = opendir(pool->def->target.path)) == NULL) {
|
if (virDirOpenQuiet(&dh, pool->def->target.path) < 0) {
|
||||||
opentries++;
|
opentries++;
|
||||||
if (loop && errno == ENOENT && opentries < 50) {
|
if (loop && errno == ENOENT && opentries < 50) {
|
||||||
usleep(100 * 1000);
|
usleep(100 * 1000);
|
||||||
|
@ -3378,8 +3378,7 @@ virCgroupRemoveRecursively(char *grppath)
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
int direrr;
|
int direrr;
|
||||||
|
|
||||||
grpdir = opendir(grppath);
|
if (virDirOpenQuiet(&grpdir, grppath) < 0) {
|
||||||
if (grpdir == NULL) {
|
|
||||||
if (errno == ENOENT)
|
if (errno == ENOENT)
|
||||||
return 0;
|
return 0;
|
||||||
rc = -errno;
|
rc = -errno;
|
||||||
|
@ -641,7 +641,7 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo,
|
|||||||
if (virAsprintf(&sysfs_nodedir, "%s/node", sysfs_system_path) < 0)
|
if (virAsprintf(&sysfs_nodedir, "%s/node", sysfs_system_path) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(nodedir = opendir(sysfs_nodedir))) {
|
if (virDirOpenQuiet(&nodedir, sysfs_nodedir) < 0) {
|
||||||
/* the host isn't probably running a NUMA architecture */
|
/* the host isn't probably running a NUMA architecture */
|
||||||
goto fallback;
|
goto fallback;
|
||||||
}
|
}
|
||||||
|
@ -2011,7 +2011,7 @@ virPCIDeviceAddressIOMMUGroupIterate(virPCIDeviceAddressPtr orig,
|
|||||||
orig->domain, orig->bus, orig->slot, orig->function) < 0)
|
orig->domain, orig->bus, orig->slot, orig->function) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(groupDir = opendir(groupPath))) {
|
if (virDirOpenQuiet(&groupDir, groupPath) < 0) {
|
||||||
/* just process the original device, nothing more */
|
/* just process the original device, nothing more */
|
||||||
ret = (actor)(orig, opaque);
|
ret = (actor)(orig, opaque);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -2683,8 +2683,7 @@ virPCIGetNetName(char *device_link_sysfs_path, char **netname)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
dir = opendir(pcidev_sysfs_net_path);
|
if (virDirOpenQuiet(&dir, pcidev_sysfs_net_path) < 0)
|
||||||
if (dir == NULL)
|
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
while (virDirRead(dir, &entry, pcidev_sysfs_net_path) > 0) {
|
while (virDirRead(dir, &entry, pcidev_sysfs_net_path) > 0) {
|
||||||
|
@ -125,7 +125,7 @@ findLease(const char *name,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(dir = opendir(leaseDir))) {
|
if (virDirOpenQuiet(&dir, leaseDir) < 0) {
|
||||||
ERROR("Failed to open dir '%s'", leaseDir);
|
ERROR("Failed to open dir '%s'", leaseDir);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user