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

Re: [libvirt] [PATCH]: Export the 'label' on block devices



On Thu, Oct 16, 2008 at 02:35:21PM +0200, Chris Lalancette wrote:
> Daniel P. Berrange wrote:
> > I know you're just replicating the existing code, but both these functions can
> > be killed off and replaced with auto-generated code from our enum support
> > macros
> > 
> >     VIR_ENUM_IMPL(virStorageBackendDiskLabel, 
> >                   VIR_STORAGE_POOL_DISK_LAST,
> >                   "dos", "dvh", "gpt", "mac",
> >                   "bsd", "pc98", "sun", "lvm2"
> >                   "unknown")
> > 
> > And in the header file just
> > 
> >     VIR_ENUM_DECL(virStorageBackendDiskLabel)
> 
> I've implemented this, and there was quite a bit of fallout from it.  In
> particular, I had to change the signature of poolOptions.formatToString and
> formatFromString, which required a bunch of changes elsewhere in the storage
> code.  The good news is that we remove quite a bit of very similar hand crafted
> code, so this patch actually removes more code than it adds.  Tested by me as
> before.
> diff -u -r1.15 storage_backend_fs.c
> --- a/src/storage_backend_fs.c	13 Oct 2008 16:46:29 -0000	1.15
> +++ b/src/storage_backend_fs.c	16 Oct 2008 12:31:23 -0000
> @@ -48,7 +48,8 @@
>  #include "xml.h"
>  
>  enum {
> -    VIR_STORAGE_POOL_FS_AUTO = 0,
> +    VIR_STORAGE_POOL_FS_UNKNOWN = 0,
> +    VIR_STORAGE_POOL_FS_AUTO = 1,

This shouldn't be added - automatic is intended to be default.

>  
>  enum {
> -    VIR_STORAGE_VOL_RAW,
> +    VIR_STORAGE_VOL_UNKNOWN = 0,
> +    VIR_STORAGE_VOL_RAW = 1,

Likewise, 'raw' should be the default, with no need for unknown.


Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


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