]> xenbits.xensource.com Git - libvirt.git/commit
storage: refactor backing chain division of labor
authorEric Blake <eblake@redhat.com>
Tue, 5 Nov 2013 20:50:29 +0000 (13:50 -0700)
committerEric Blake <eblake@redhat.com>
Thu, 7 Nov 2013 00:28:12 +0000 (17:28 -0700)
commit3ead2e7dedab7d9380496798ef0201be2b0047b5
tree013b6afbc32980c534aab5914a40091e3fafc131
parent9cac863965aa318667619727c387ec8ee3965557
storage: refactor backing chain division of labor

Future patches will want to learn metadata about a file using
a buffer that was already parsed in order to probe the file's
format.  Rather than reopening and re-reading the file, it makes
sense to separate getting file contents from actually parsing
those contents.

* src/util/virstoragefile.c (virStorageFileGetMetadataFromBuf)
(virStorageFileGetMetadataFromFDInternal): New functions.
(virStorageFileGetMetadataInternal): Hoist fstat() and read() into
callers.
(virStorageFileGetMetadataFromFD)
(virStorageFileGetMetadataRecurse): Rework clients.
* src/util/virstoragefile.h (virStorageFileGetMetadataFromBuf):
New prototype.
* src/libvirt_private.syms (virstoragefile.h): Export it.

Signed-off-by: Eric Blake <eblake@redhat.com>
src/libvirt_private.syms
src/util/virstoragefile.c
src/util/virstoragefile.h