On Thu, Oct 20, 2022 at 16:58:56 -0500, Jonathon Jongsma wrote:
Preparatory step for caching nbdkit capabilities. This patch
implements
the newData and isValid virFileCacheHandlers callback functions.
Signed-off-by: Jonathon Jongsma <jjongsma(a)redhat.com>
---
src/qemu/qemu_nbdkit.c | 93 +++++++++++++++++++++++++++++++++++++++++-
src/qemu/qemu_nbdkit.h | 4 ++
2 files changed, 96 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_nbdkit.c b/src/qemu/qemu_nbdkit.c
index 5de1021d89..9ab048e9e1 100644
--- a/src/qemu/qemu_nbdkit.c
+++ b/src/qemu/qemu_nbdkit.c
@@ -202,7 +202,7 @@ qemuNbdkitGetDirMtime(const char *moddir)
}
-G_GNUC_UNUSED static void
+static void
qemuNbdkitCapsQuery(qemuNbdkitCaps *caps)
{
struct stat st;
@@ -241,3 +241,94 @@ qemuNbdkitCapsSet(qemuNbdkitCaps *nbdkitCaps,
{
ignore_value(virBitmapSetBit(nbdkitCaps->flags, flag));
}
+
+
+static bool
+virNbkditCapsCheckModdir(const char *moddir,
+ time_t expectedMtime)
+{
+ time_t mtime = qemuNbdkitGetDirMtime(moddir);
+
+ if (mtime != expectedMtime) {
+ VIR_DEBUG("Outdated capabilities for nbdkit: module "
+ "directory '%s' changed (%lld vs %lld)",
Preferrably don't use linebreaks in debug/error messages for better
greppability even if it exceeds the "recomended" line lenght. (more
instances in this patch).
Reviewed-by: Peter Krempa <pkrempa(a)redhat.com>