[libvirt] [PATCH 3/4] storage: refactor metadata lookup
Daniel P. Berrange
berrange at redhat.com
Thu Feb 7 14:55:44 UTC 2013
On Wed, Feb 06, 2013 at 10:10:19PM -0700, Eric Blake wrote:
> Prior to this patch, we had the callchains:
> external users
> \-> virStorageFileGetMetadataFromFD
> \-> virStorageFileGetMetadataFromBuf
> virStorageFileGetMetadataRecurse
> \-> virStorageFileGetMetadataFromFD
> \-> virStorageFileGetMetadataFromBuf
>
> However, a future patch wants to add an additional parameter to
> the bottom of the chain, for use by virStorageFileGetMetadataRecurse,
> without affecting existing external callers. Since there is only a
> single caller of the internal function, we can repurpose it to fit
> our needs, with this patch giving us:
>
> external users
> \-> virStorageFileGetMetadataFromFD
> \-> virStorageFileGetMetadataInternal
> virStorageFileGetMetadataRecurse /
> \-> virStorageFileGetMetadataInternal
>
> Note that no callers cared whether virStorageFileGetMetadataFromBuf
> returned 0 (success) or 1 (able to read, but not able to decipher),
> only whether there was failure (not able to read).
>
> * src/util/virstoragefile.c (virStorageFileGetMetadataFromFD):
> Move most of the guts...
> (virStorageFileGetMetadataFromBuf): ...here, and rename...
> (virStorageFileGetMetadataInternal): ...to this.
> (virStorageFileGetMetadataRecurse): Use internal helper.
> ---
> src/util/virstoragefile.c | 156 ++++++++++++++++++++++------------------------
> 1 file changed, 75 insertions(+), 81 deletions(-)
ACK, a little complex to follow though.
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list