On 06/19/2014 07:46 AM, Peter Krempa wrote:
They will be reused to transfer disk labels from snapshotted disks
to
the new disk definitions.
---
src/libvirt_private.syms | 1 +
src/util/virstoragefile.c | 43 ++++++++++++++++++++++++++++++++++++-------
src/util/virstoragefile.h | 3 +++
3 files changed, 40 insertions(+), 7 deletions(-)
+++ b/src/util/virstoragefile.c
@@ -1496,6 +1496,29 @@ virStorageNetHostDefCopy(size_t nhosts,
}
+int
+virStorageSourceCopySeclabels(virStorageSourcePtr to,
+ const virStorageSource *from)
+{
+ size_t i;
+
+ if (VIR_ALLOC_N(to->seclabels, from->nseclabels) < 0)
I'd feel safer if you start this function with either:
virStorageSourceClearSeclabels(to);
or:
if (to->seclabels)
return -1;
to make sure that we are only ever copying labels onto a clean slate.
void
virStorageSourcePoolDefFree(virStorageSourcePoolDefPtr def)
{
@@ -1555,10 +1578,21 @@ virStorageSourceClearBackingStore(virStorageSourcePtr def)
void
-virStorageSourceClear(virStorageSourcePtr def)
+virStorageSourceClearSeclabels(virStorageSourcePtr def)
bikeshedding - maybe name this virStorageSourceSeclabelsClear (noun-verb
"we are taking the StorageSourceSeclabels and clearing it"; not
object-verb-noun "we are taking the StorageSource, and clearing its
seclabels")
The idea is on the right track, but we're starting to get into territory
where cleaning up the series for v2 will be better.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org