render / rpms / libvirt

Forked from rpms/libvirt 9 months ago
Clone
3e5111
From edc31db33c74dd86c1d49c4e561a8535ef5968a9 Mon Sep 17 00:00:00 2001
3e5111
Message-Id: <edc31db33c74dd86c1d49c4e561a8535ef5968a9@dist-git>
3e5111
From: Peter Krempa <pkrempa@redhat.com>
3e5111
Date: Tue, 20 Jun 2017 16:58:52 +0200
3e5111
Subject: [PATCH] util: storage: Make @backingFormat optional in
3e5111
 virStorageFileGetMetadataInternal
3e5111
3e5111
Some callers don't need to know the backing format. Make the argument
3e5111
optional by using a dummy int if NULL is passed.
3e5111
3e5111
(cherry picked from commit 296a53313f447d2f251cbea2cb050d2f695a7991)
3e5111
3e5111
https://bugzilla.redhat.com/show_bug.cgi?id=1461303
3e5111
3e5111
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
3e5111
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
3e5111
---
3e5111
 src/util/virstoragefile.c | 4 ++++
3e5111
 src/util/virstoragefile.h | 2 +-
3e5111
 2 files changed, 5 insertions(+), 1 deletion(-)
3e5111
3e5111
diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
3e5111
index 3ed79fb2b5..437a13b90b 100644
3e5111
--- a/src/util/virstoragefile.c
3e5111
+++ b/src/util/virstoragefile.c
3e5111
@@ -966,9 +966,13 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
3e5111
                                   size_t len,
3e5111
                                   int *backingFormat)
3e5111
 {
3e5111
+    int dummy;
3e5111
     int ret = -1;
3e5111
     size_t i;
3e5111
 
3e5111
+    if (!backingFormat)
3e5111
+        backingFormat = &dummy;
3e5111
+
3e5111
     VIR_DEBUG("path=%s, buf=%p, len=%zu, meta->format=%d",
3e5111
               meta->path, buf, len, meta->format);
3e5111
 
3e5111
diff --git a/src/util/virstoragefile.h b/src/util/virstoragefile.h
3e5111
index ce54a19cee..0bff8671f7 100644
3e5111
--- a/src/util/virstoragefile.h
3e5111
+++ b/src/util/virstoragefile.h
3e5111
@@ -293,7 +293,7 @@ int virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
3e5111
                                       char *buf,
3e5111
                                       size_t len,
3e5111
                                       int *backingFormat)
3e5111
-    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(4);
3e5111
+    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
3e5111
 
3e5111
 virStorageSourcePtr virStorageFileGetMetadataFromFD(const char *path,
3e5111
                                                     int fd,
3e5111
-- 
3e5111
2.13.1
3e5111