Re: [libvirt-glib] Add gvir_storage_vol_resize()

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

 



On Wed, Feb 01, 2012 at 12:03:43PM +0100, Christophe Fergeau wrote:
> On Wed, Feb 01, 2012 at 02:27:28AM +0200, Zeeshan Ali (Khattak) wrote:
> > From: "Zeeshan Ali (Khattak)" <zeeshanak@xxxxxxxxx>
> > 
> > Add wrapper for virStorageVolResize().
> > ---
> >  libvirt-gobject/libvirt-gobject-storage-vol.c |   45 +++++++++++++++++++++++++
> >  libvirt-gobject/libvirt-gobject-storage-vol.h |   20 +++++++++++
> >  libvirt-gobject/libvirt-gobject.sym           |    1 +
> >  3 files changed, 66 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libvirt-gobject/libvirt-gobject-storage-vol.c b/libvirt-gobject/libvirt-gobject-storage-vol.c
> > index 491e2e6..f6f0c50 100644
> > --- a/libvirt-gobject/libvirt-gobject-storage-vol.c
> > +++ b/libvirt-gobject/libvirt-gobject-storage-vol.c
> > @@ -299,3 +299,48 @@ gboolean gvir_storage_vol_delete(GVirStorageVol *vol,
> >  
> >      return TRUE;
> >  }
> > +
> > +/**
> > + * gvir_storage_vol_resize:
> > + * @vol: the storage volume to resize
> > + * @capacity: the new capacity of the volume
> > + * @flags: the flags
> > + * @err: Return location for errors, or NULL
> > + *
> > + * Changes the capacity of the storage volume @vol to @capacity.
> > + *
> > + * Returns: the new capacity of the volume on success, 0 otherwise
> > + */
> > +gboolean gvir_storage_vol_resize(GVirStorageVol *vol,
> > +                                 guint64 capacity,
> > +                                 GVirStorageVolResizeFlags flags,
> 
> We're probably already doing that in other places, I may have already
> mentioned it, but I'm a bit uncomfortable with using the enum type for
> bitfields. If I'm not mistaken, if we use GVirStorageVolResizeFlags,
> passing a value which is not one of the enum values (such as DELTA |
> SHRINK) is undefined behaviour in the C spec. I'm fine with us deciding
> it's not important, but it's still worth mentioning :)

Yeah, for methods which are 'flags', we should use  guint64 as the
type. Only use the enum types for things which really are enums,
not bitfields.


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 :|

--
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]