On 11/05/2013 02:32 PM, Eric Blake wrote:
This gets rid of another stat() per volume, as well as cutting
bytes read in half, when populating the volumes of a directory
pool during a pool refresh. Not to mention that it provides an
interface that can let gluster pools also probe file types.
* src/util/virstoragefile.h (virStorageFileProbeFormatFromFD):
Delete.
(virStorageFileProbeFormatFromBuf): New prototype.
(VIR_STORAGE_MAX_HEADER): New constant, based on...
* src/util/virstoragefile.c (STORAGE_MAX_HEAD): ...old name.
(vmdk4GetBackingStore, virStorageFileGetMetadataInternal)
(virStorageFileProbeFormat): Adjust clients.
(virStorageFileProbeFormatFromFD): Delete.
(virStorageFileProbeFormatFromBuf): Export.
* src/storage/storage_backend_fs.c (virStorageBackendProbeTarget):
Adjust client.
* src/libvirt_private.syms (virstoragefile.h): Adjust exports.
Signed-off-by: Eric Blake <eblake(a)redhat.com>
---
- virStorageFileFreeMetadata(meta);
-
- return ret;
+ goto cleanup;
error:
VIR_FORCE_CLOSE(fd);
cleanup:
virStorageFileFreeMetadata(meta);
+ VIR_FREE(header);
Up to here is fine...
+ virStorageFileFreeMetadata(meta);
...but I have no idea what I was thinking with this line of the patch :)
I've already deleted it in my local tree, to avoid double frees.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org