[libvirt] [PATCH 2/2] util: move virFile* functions from virutil.c to virutil.h

Osier Yang jyang at redhat.com
Fri May 10 03:46:19 UTC 2013


On 10/05/13 03:02, Laine Stump wrote:

s/virutil\.h/virfile\.c/,  in the patch subject.

> These all existed before virfile.c was created, and for some reason
> weren't moved.
>
> This is mostly straightfoward, although the syntax rule prohibiting
> write() had to be changed to have an exception for virfile.c instead
> of virutil.c.
>
> This movement pointed out that there is a function called
> virBuildPath(), and another almost identical function called
> virFileBuildPath(). They really should be a single function, which
> I'll take care of as soon as I figure out what the arglist should look
> like.
> ---
>   cfg.mk                               |    2 +-
>   src/esx/esx_driver.c                 |    5 +-
>   src/esx/esx_storage_backend_vmfs.c   |    1 +
>   src/libvirt.c                        |    1 +
>   src/libvirt_private.syms             |   66 +-
>   src/node_device/node_device_driver.c |    3 +-
>   src/node_device/node_device_udev.c   |    1 +
>   src/parallels/parallels_driver.c     |    1 +
>   src/parallels/parallels_network.c    |    1 +
>   src/parallels/parallels_storage.c    |    1 +
>   src/rpc/virnetsshsession.c           |    3 +-
>   src/rpc/virnettlscontext.c           |    1 +
>   src/security/security_dac.c          |    1 +
>   src/storage/parthelper.c             |    3 +-
>   src/storage/storage_backend_disk.c   |    1 +
>   src/util/virebtables.c               |    1 +
>   src/util/virfile.c                   | 1448 +++++++++++++++++++++++++++++-
>   src/util/virfile.h                   |  121 ++-
>   src/util/virhook.c                   |    2 +-
>   src/util/viriptables.c               |    1 +
>   src/util/virkeyfile.c                |    3 +-
>   src/util/virnetdevveth.c             |    3 +-
>   src/util/virsysinfo.c                |    3 +-
>   src/util/virusb.c                    |    3 +-
>   src/util/virutil.c                   | 1603 ++--------------------------------
>   src/util/virutil.h                   |  111 ---
>   src/vbox/vbox_XPCOMCGlue.c           |    1 +
>   src/vmx/vmx.c                        |    1 +
>   src/xen/xm_internal.c                |    1 +
>   tests/eventtest.c                    |    3 +-
>   tests/libvirtdconftest.c             |    3 +-
>   tests/securityselinuxtest.c          |    1 +
>   tests/virlockspacetest.c             |    3 +-
>   tests/virportallocatortest.c         |    1 +
>   tests/virstoragetest.c               |    1 +
>   tools/virsh-interface.c              |    3 +-
>   tools/virsh-network.c                |    3 +-
>   tools/virsh-nodedev.c                |    1 +
>   tools/virsh-nwfilter.c               |    3 +-
>   tools/virsh-pool.c                   |    3 +-
>   tools/virsh-secret.c                 |    3 +-
>   tools/virsh-snapshot.c               |    3 +-
>   42 files changed, 1746 insertions(+), 1678 deletions(-)
>
> diff --git a/cfg.mk b/cfg.mk
> index 227c18b..0bf5bfc 100644
> --- a/cfg.mk
> +++ b/cfg.mk
> @@ -841,7 +841,7 @@ $(srcdir)/src/remote/remote_client_bodies.h: $(srcdir)/src/remote/remote_protoco
>   # List all syntax-check exemptions:
>   exclude_file_name_regexp--sc_avoid_strcase = ^tools/virsh\.h$$
>   
> -_src1=libvirt|fdstream|qemu/qemu_monitor|util/(vircommand|virutil)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
> +_src1=libvirt|fdstream|qemu/qemu_monitor|util/(vircommand|virfile)|xen/xend_internal|rpc/virnetsocket|lxc/lxc_controller|locking/lock_daemon
>   _test1=shunloadtest|virnettlscontexttest|vircgroupmock
>   exclude_file_name_regexp--sc_avoid_write = \
>     ^(src/($(_src1))|daemon/libvirtd|tools/console|tests/($(_test1)))\.c$$
> diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c
> index dcf64b8..eff02a0 100644
> --- a/src/esx/esx_driver.c
> +++ b/src/esx/esx_driver.c
> @@ -2,7 +2,7 @@
>   /*
>    * esx_driver.c: core driver functions for managing VMware ESX hosts
>    *
> - * Copyright (C) 2010-2012 Red Hat, Inc.
> + * Copyright (C) 2010-2013 Red Hat, Inc.
>    * Copyright (C) 2009-2013 Matthias Bolte <matthias.bolte at googlemail.com>
>    * Copyright (C) 2009 Maximilian Wilhelm <max at rfc2324.org>
>    *
> @@ -29,6 +29,7 @@
>   #include "snapshot_conf.h"
>   #include "virauth.h"
>   #include "viralloc.h"
> +#include "virfile.h"
>   #include "virlog.h"
>   #include "viruuid.h"
>   #include "vmx.h"
> @@ -44,8 +45,8 @@
>   #include "esx_vi.h"
>   #include "esx_vi_methods.h"
>   #include "esx_util.h"
> -#include "viruri.h"
>   #include "virstring.h"
> +#include "viruri.h"
>   
>   #define VIR_FROM_THIS VIR_FROM_ESX
>   
> diff --git a/src/esx/esx_storage_backend_vmfs.c b/src/esx/esx_storage_backend_vmfs.c
> index 5d6f183..da27144 100644
> --- a/src/esx/esx_storage_backend_vmfs.c
> +++ b/src/esx/esx_storage_backend_vmfs.c
> @@ -32,6 +32,7 @@
>   #include "internal.h"
>   #include "md5.h"
>   #include "viralloc.h"
> +#include "virfile.h"
>   #include "virlog.h"
>   #include "viruuid.h"
>   #include "storage_conf.h"
> diff --git a/src/libvirt.c b/src/libvirt.c
> index 33a4419..1954051 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -59,6 +59,7 @@
>   # include "rpc/virnettlscontext.h"
>   #endif
>   #include "vircommand.h"
> +#include "virfile.h"
>   #include "virrandom.h"
>   #include "viruri.h"
>   #include "virthread.h"
> diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
> index d4cb4a3..3dac210 100644
> --- a/src/libvirt_private.syms
> +++ b/src/libvirt_private.syms
> @@ -1271,18 +1271,51 @@ virEventPollUpdateTimeout;
>   
>   
>   # util/virfile.h
> +saferead;
> +safewrite;
> +safezero;

These names should be changed, but it's a different story.

Big but mechanical, ACK.




More information about the libvir-list mailing list