From 1cc783bc4431e6c546337413934bfc4fdc4169bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 7 Mar 2023 16:07:20 +0100 Subject: [PATCH] util: remove waitForLock from virPidFileAcquire MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The parameter was added for consistency with virPidFileAcquirePath. However, all callers of virPidFileAcquire pass false. Remove the argument. Partially-reverts: 2250a2b5d21c3b3529727f38a99cba22f84024f7 Signed-off-by: Ján Tomko Reviewed-by: Martin Kletzander --- src/bhyve/bhyve_driver.c | 2 +- src/interface/interface_backend_netcf.c | 2 +- src/interface/interface_backend_udev.c | 2 +- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 2 +- src/network/bridge_driver.c | 3 +-- src/node_device/node_device_udev.c | 2 +- src/nwfilter/nwfilter_driver.c | 2 +- src/qemu/qemu_driver.c | 2 +- src/secret/secret_driver.c | 2 +- src/storage/storage_driver.c | 3 +-- src/util/virpidfile.c | 3 +-- src/util/virpidfile.h | 1 - src/vz/vz_driver.c | 2 +- 14 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index d100adeb8f..e7d9c2adf3 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1247,7 +1247,7 @@ bhyveStateInitialize(bool privileged, } if ((bhyve_driver->lockFD = - virPidFileAcquire(BHYVE_STATE_DIR, "driver", false, getpid())) < 0) + virPidFileAcquire(BHYVE_STATE_DIR, "driver", getpid())) < 0) goto cleanup; if (virDomainObjListLoadAllConfigs(bhyve_driver->domains, diff --git a/src/interface/interface_backend_netcf.c b/src/interface/interface_backend_netcf.c index 5964720e0f..7bd3e7e1e2 100644 --- a/src/interface/interface_backend_netcf.c +++ b/src/interface/interface_backend_netcf.c @@ -123,7 +123,7 @@ netcfStateInitialize(bool privileged, } if ((driver->lockFD = - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; /* open netcf */ diff --git a/src/interface/interface_backend_udev.c b/src/interface/interface_backend_udev.c index 54b43fb999..cba14f91f8 100644 --- a/src/interface/interface_backend_udev.c +++ b/src/interface/interface_backend_udev.c @@ -1136,7 +1136,7 @@ udevStateInitialize(bool privileged, } if ((driver->lockFD = - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto cleanup; driver->udev = udev_new(); diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index c8bcde2612..04e74086e6 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -751,7 +751,7 @@ libxlStateInitialize(bool privileged, } if ((libxl_driver->lockFD = - virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto error; if (!(libxl_driver->lockManager = diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 0f7687a221..b1d53659d7 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -1505,7 +1505,7 @@ static int lxcStateInitialize(bool privileged, } if ((lxc_driver->lockFD = - virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto cleanup; /* Get all the running persistent or transient configs first */ diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c index a5973e26cd..3fa56bfc09 100644 --- a/src/network/bridge_driver.c +++ b/src/network/bridge_driver.c @@ -608,8 +608,7 @@ networkStateInitialize(bool privileged, goto error; if ((network_driver->lockFD = - virPidFileAcquire(cfg->stateDir, "driver", - false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto error; /* if this fails now, it will be retried later with networkDnsmasqCapsRefresh() */ diff --git a/src/node_device/node_device_udev.c b/src/node_device/node_device_udev.c index 2454cab8f8..5782aa43c8 100644 --- a/src/node_device/node_device_udev.c +++ b/src/node_device/node_device_udev.c @@ -2278,7 +2278,7 @@ nodeStateInitialize(bool privileged, } if ((driver->lockFD = - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto cleanup; if (!(driver->devs = virNodeDeviceObjListNew()) || diff --git a/src/nwfilter/nwfilter_driver.c b/src/nwfilter/nwfilter_driver.c index 8e45096eaa..3803850e26 100644 --- a/src/nwfilter/nwfilter_driver.c +++ b/src/nwfilter/nwfilter_driver.c @@ -254,7 +254,7 @@ nwfilterStateInitialize(bool privileged, } if ((driver->lockFD = - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; if (virNWFilterIPAddrMapInit() < 0) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c546e35953..fd8136be37 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -678,7 +678,7 @@ qemuStateInitialize(bool privileged, } if ((qemu_driver->lockFD = - virPidFileAcquire(cfg->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(cfg->stateDir, "driver", getpid())) < 0) goto error; qemu_driver->qemuImgBinary = virFindFileInPath("qemu-img"); diff --git a/src/secret/secret_driver.c b/src/secret/secret_driver.c index c38cd6f651..43d2a0c05a 100644 --- a/src/secret/secret_driver.c +++ b/src/secret/secret_driver.c @@ -536,7 +536,7 @@ secretStateInitialize(bool privileged, } if ((driver->lockFD = - virPidFileAcquire(driver->stateDir, "driver", false, getpid())) < 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; if (!(driver->secrets = virSecretObjListNew())) diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c index d90c1c9ee8..308704f1c8 100644 --- a/src/storage/storage_driver.c +++ b/src/storage/storage_driver.c @@ -289,8 +289,7 @@ storageStateInitialize(bool privileged, } if ((driver->lockFD = - virPidFileAcquire(driver->stateDir, "driver", - false, getpid())) < 0) + virPidFileAcquire(driver->stateDir, "driver", getpid())) < 0) goto error; if (virStoragePoolObjLoadAllState(driver->pools, diff --git a/src/util/virpidfile.c b/src/util/virpidfile.c index bfd967c1af..5448a8652d 100644 --- a/src/util/virpidfile.c +++ b/src/util/virpidfile.c @@ -447,7 +447,6 @@ int virPidFileAcquirePath(const char *path, int virPidFileAcquire(const char *dir, const char *name, - bool waitForLock, pid_t pid) { g_autofree char *pidfile = NULL; @@ -458,7 +457,7 @@ int virPidFileAcquire(const char *dir, if (!(pidfile = virPidFileBuildPath(dir, name))) return -ENOMEM; - return virPidFileAcquirePath(pidfile, waitForLock, pid); + return virPidFileAcquirePath(pidfile, false, pid); } diff --git a/src/util/virpidfile.h b/src/util/virpidfile.h index e84542f298..ff4d31c9fd 100644 --- a/src/util/virpidfile.h +++ b/src/util/virpidfile.h @@ -61,7 +61,6 @@ int virPidFileAcquirePath(const char *path, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; int virPidFileAcquire(const char *dir, const char *name, - bool waitForLock, pid_t pid) G_GNUC_WARN_UNUSED_RESULT; int virPidFileReleasePath(const char *path, diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 327704b375..4a7b14997f 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -4097,7 +4097,7 @@ vzStateInitialize(bool privileged, } if ((vz_driver_lock_fd = - virPidFileAcquire(VZ_STATEDIR, "driver", false, getpid())) < 0) + virPidFileAcquire(VZ_STATEDIR, "driver", getpid())) < 0) return VIR_DRV_STATE_INIT_ERROR; if (prlsdkInit() < 0) {