[libvirt] [PATCH 3/3] cleanup: Kill usage of access(PATH, F_OK) in favor of virFileExists()

Martin Kletzander mkletzan at redhat.com
Fri Sep 13 15:31:30 UTC 2013


On 09/13/2013 04:19 PM, Peter Krempa wrote:
> Semantics of the libvirt helper are more clear. This change also allows
> to clean up some pieces of code.
> ---
>  src/openvz/openvz_conf.c              | 2 +-
>  src/parallels/parallels_storage.c     | 2 +-
>  src/qemu/qemu_capabilities.c          | 4 ++--
>  src/qemu/qemu_cgroup.c                | 6 +++---
>  src/qemu/qemu_process.c               | 2 +-
>  src/storage/storage_backend_fs.c      | 2 +-
>  src/storage/storage_backend_logical.c | 2 +-
>  src/storage/storage_backend_mpath.c   | 8 +-------
>  src/storage/storage_backend_scsi.c    | 3 +--
>  src/util/vircgroup.c                  | 2 +-
>  src/util/virfile.c                    | 2 +-
>  src/util/virpci.c                     | 2 +-
>  src/util/virscsi.c                    | 2 +-
>  src/util/virutil.c                    | 6 +++---
>  14 files changed, 19 insertions(+), 26 deletions(-)
> 
[...]
> diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
> index d305b06..956cfce 100644
> --- a/src/storage/storage_backend_fs.c
> +++ b/src/storage/storage_backend_fs.c
> @@ -503,7 +503,7 @@ virStorageBackendFileSystemCheck(virConnectPtr conn ATTRIBUTE_UNUSED,
>  {
>      *isActive = false;
>      if (pool->def->type == VIR_STORAGE_POOL_DIR) {
> -        if (access(pool->def->target.path, F_OK) == 0)
> +        if (virFileExists(pool->def->target.path))
>              *isActive = true;

Why didn't you use the same (nicer) way here, when you used it
everywhere else.  I'm talking about '*isActive = virFileExists(...)'.

ACK either way, looking forward to [12]/3 ;-)

Martin

P.S.: If you'll need the answer urgently, ping me and I'll see them in
the archives.




More information about the libvir-list mailing list