[libvirt] [sandbox PATCH 08/10] Init-util : Common directory functions for init-common and init-qemu

Daniel P. Berrange berrange at redhat.com
Thu Jun 25 16:24:05 UTC 2015


On Thu, Jun 25, 2015 at 01:27:28PM +0200, Eren Yagdiran wrote:
> Init-util provides common functions for creating directories for both
> Init-common and Init-qemu. Error handling needs to be done in calling
> function.
> ---
>  libvirt-sandbox/Makefile.am                 |  4 +-
>  libvirt-sandbox/libvirt-sandbox-init-qemu.c | 57 +++++++++-------------------
>  libvirt-sandbox/libvirt-sandbox-init-util.c | 58 +++++++++++++++++++++++++++++
>  libvirt-sandbox/libvirt-sandbox-init-util.h | 41 ++++++++++++++++++++
>  4 files changed, 119 insertions(+), 41 deletions(-)
>  create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.c
>  create mode 100644 libvirt-sandbox/libvirt-sandbox-init-util.h

Creating a shared file for these two functions is not really
required. They are needed in init-qemu because that file only relies
on POSIX APIs. In init-common we have the ability to use glib, so
we you can just use


> +int gvir_sandbox_init_util_mkdir(const char *dir, int mode, int debug);

  g_mkdir_with_parents(dir)

> +int gvir_sandbox_init_util_mkparent(const char *dir, int mode, int debug);

   parent = g_path_get_dirname(dir)
   g_mkdir_with_parents(parent)
   g_free(parent)

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list