Re: [PATCH 04/10] util: storagesource: Add helper to copy and free storage source seclabels

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]