render / rpms / libvirt

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