[libvirt] [PATCH] util: storage: Make @backingFormat optional in virStorageFileGetMetadataInternal

Martin Kletzander mkletzan at redhat.com
Tue Jun 20 14:45:52 UTC 2017

On Tue, Jun 20, 2017 at 04:37:21PM +0200, Peter Krempa wrote:
>Some callers don't need to know the backing format. Make the argument
>optional by using a dummy int if NULL is passed.
> src/util/virstoragefile.c | 4 ++++
> src/util/virstoragefile.h | 2 +-
> 2 files changed, 5 insertions(+), 1 deletion(-)

I wanted to say this is weird, even though it works, but then I saw it
already used in virStorageFileGetMetadataFrom{FD,Buf}(), so I guess it's
fine :)

>diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c
>index 8047d977f..042698872 100644
>--- a/src/util/virstoragefile.c
>+++ b/src/util/virstoragefile.c
>@@ -966,9 +966,13 @@ virStorageFileGetMetadataInternal(virStorageSourcePtr meta,
>                                   size_t len,
>                                   int *backingFormat)
> {
>+    int format;

I would change this to 'int dummy' so that it's clearly visible it won't
be used (and it's the same as in the other functions).

ACK either way.  Oh, I'm sorry,

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170620/32977e79/attachment-0001.sig>

More information about the libvir-list mailing list