On 05/30/2014 03:07 PM, Jim Fehlig wrote:
Olaf Hering wrote:
> Translate libvirt discard settings into libxl-4.5 discard settings.
>
> Signed-off-by: Olaf Hering <olaf(a)aepfle.de>
> ---
>
> +static void
> +libxlDiskSetDiscard(libxl_device_disk *x_disk, int discard)
> +{
> + if (!x_disk->readwrite)
> + return;
> +#if defined(LIBXL_HAVE_LIBXL_DEVICE_DISK_DISCARD_ENABLE)
> + switch (discard) {
This line needs a cast to the enum type, if you want the compiler to
enforce that you covered all enum values.
> + case VIR_DOMAIN_DISK_DISCARD_DEFAULT:
>
case VIR_DOMAIN_DISK_DISCARD_LAST:
> + break;
> + case VIR_DOMAIN_DISK_DISCARD_UNMAP:
> + libxl_defbool_set(&x_disk->discard_enable, true);
> + break;
> + default:
>
Then you can remove 'default'.
Removing 'default' is also essential for the compiler-enforced full enum
coverage trick in a switch statement.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org