Re: [PATCH 01/11] storage: Introduce virStorageBackendDeviceProbeEmpty

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

 



On 12/15/2016 10:42 PM, John Ferlan wrote:
> Rename virStorageBackendFileSystemProbe and to virStorageBackendBLKIDProbe
> and move to the more common storage_backend module.
> 
> Create a shim virStorageBackendDeviceProbeEmpty which will make the call
> to the virStorageBackendBLKIDProbeFS and check the return value.
> 
> Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
> ---
>  src/storage/storage_backend.c    | 120 +++++++++++++++++++++++++++++++++++++++
>  src/storage/storage_backend.h    |   3 +
>  src/storage/storage_backend_fs.c |  90 +----------------------------
>  3 files changed, 124 insertions(+), 89 deletions(-)
> 
> diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
> index f2fc038..2432b54 100644
> --- a/src/storage/storage_backend.c
> +++ b/src/storage/storage_backend.c

> +/* virStorageBackendDeviceProbeEmpty:
> + * @devpath: Path to the device to check
> + * @format: Desired format string
> + *
> + * Check if the @devpath has some sort of known file system using the
> + * BLKID API if available.
> + *
> + * Returns true if the probe deems the device has nothing valid on it
> + * and returns false if the probe finds something
> + */
> +bool
> +virStorageBackendDeviceProbeEmpty(const char *devpath,
> +                                  const char *format)
> +{
> +    if (virStorageBackendBLKIDProbeFS(devpath, format) ==
> +        FILESYSTEM_PROBE_NOT_FOUND)
> +        true;

return true; /* is what you want here. */

Or even better:

return virStorageBackendBLKIDProbeFS() == FILESYSTEM_PROBE_NOT_FOUND;

> +
> +    return false;
> +}

ACK with that change.

Michal

--
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]
  Powered by Linux