Re: [PATCH 3/7] qemu: Use macro instead of "qemu" in the context of URI scheme

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

 



On Thu, Sep 27, 2012 at 04:41:33PM +0200, Jiri Denemark wrote:
> ---
>  src/qemu/qemu_conf.h   |  2 ++
>  src/qemu/qemu_driver.c | 18 +++++++++---------
>  2 files changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
> index ca2f694..fe8de36 100644
> --- a/src/qemu/qemu_conf.h
> +++ b/src/qemu/qemu_conf.h
> @@ -47,6 +47,8 @@
>  
>  # define QEMUD_CPUMASK_LEN CPU_SETSIZE
>  
> +# define QEMU_URI_SCHEME "qemu"
> +
>  typedef struct _qemuDriverCloseDef qemuDriverCloseDef;
>  typedef qemuDriverCloseDef *qemuDriverCloseDefPtr;
>  
> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
> index 95a30e6..e1be849 100644
> --- a/src/qemu/qemu_driver.c
> +++ b/src/qemu/qemu_driver.c
> @@ -295,8 +295,8 @@ qemuAutostartDomains(struct qemud_driver *driver)
>       * network
>       */
>      virConnectPtr conn = virConnectOpen(driver->privileged ?
> -                                        "qemu:///system" :
> -                                        "qemu:///session");
> +                                        QEMU_URI_SCHEME ":///system" :
> +                                        QEMU_URI_SCHEME ":///session");
>      /* Ignoring NULL conn which is mostly harmless here */
>      struct qemuAutostartData data = { driver, conn };
>  
> @@ -859,8 +859,8 @@ qemudStartup(int privileged) {
>      virHashForEach(qemu_driver->domains.objs, qemuDomainNetsRestart, NULL);
>  
>      conn = virConnectOpen(qemu_driver->privileged ?
> -                          "qemu:///system" :
> -                          "qemu:///session");
> +                          QEMU_URI_SCHEME ":///system" :
> +                          QEMU_URI_SCHEME ":///session");
>  
>      qemuProcessReconnectAll(conn, qemu_driver);
>  
> @@ -1054,13 +1054,13 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
>              return VIR_DRV_OPEN_DECLINED;
>  
>          if (!(conn->uri = virURIParse(qemu_driver->privileged ?
> -                                      "qemu:///system" :
> -                                      "qemu:///session")))
> +                                      QEMU_URI_SCHEME ":///system" :
> +                                      QEMU_URI_SCHEME ":///session")))
>              return VIR_DRV_OPEN_ERROR;
>      } else {
>          /* If URI isn't 'qemu' its definitely not for us */
>          if (conn->uri->scheme == NULL ||
> -            STRNEQ(conn->uri->scheme, "qemu"))
> +            STRNEQ(conn->uri->scheme, QEMU_URI_SCHEME))
>              return VIR_DRV_OPEN_DECLINED;
>  
>          /* Allow remote driver to deal with URIs with hostname server */
> @@ -1077,8 +1077,8 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("no QEMU URI path given, try %s"),
>                             qemu_driver->privileged
> -                           ? "qemu:///system"
> -                           : "qemu:///session");
> +                           ? QEMU_URI_SCHEME ":///system"
> +                           : QEMU_URI_SCHEME ":///session");
>                  return VIR_DRV_OPEN_ERROR;
>          }

I'm not really convinced that this is a net win - in fact I think it
makes the code a little less readable in general.


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 :|

--
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]