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

Re: [libvirt] [PATCH] libvirtd: Don't check WITH_LIBVIRTD in C source files



On Mon, Feb 04, 2013 at 10:08:42PM -0600, Doug Goldstein wrote:
> On Mon, Feb 4, 2013 at 8:20 PM, Hu Tao <hutao cn fujitsu com> wrote:
> > Don't check WITH_LIBVIRTD in C source files because we will build
> > the sources even without libvirtd.
> > ---
> >  src/driver.h               | 4 ----
> >  src/libvirt.c              | 7 -------
> >  src/libvirt_internal.h     | 2 --
> >  src/remote/remote_driver.c | 6 ------
> >  src/xen/xen_driver.c       | 6 +-----
> >  5 files changed, 1 insertion(+), 24 deletions(-)
> >
> > diff --git a/src/driver.h b/src/driver.h
> > index 02ddd83..dab7495 100644
> > --- a/src/driver.h
> > +++ b/src/driver.h
> > @@ -1512,7 +1512,6 @@ struct _virStorageDriver {
> >      virDrvStoragePoolIsPersistent           poolIsPersistent;
> >  };
> >
> > -# ifdef WITH_LIBVIRTD
> >
> >  typedef int (*virDrvStateInitialize) (bool privileged,
> >                                        virStateInhibitCallback callback,
> > @@ -1531,7 +1530,6 @@ struct _virStateDriver {
> >      virDrvStateReload      reload;
> >      virDrvStateStop        stop;
> >  };
> > -# endif
> >
> >
> >  typedef struct _virDeviceMonitor virDeviceMonitor;
> > @@ -1768,9 +1766,7 @@ int virRegisterStorageDriver(virStorageDriverPtr);
> >  int virRegisterDeviceMonitor(virDeviceMonitorPtr);
> >  int virRegisterSecretDriver(virSecretDriverPtr);
> >  int virRegisterNWFilterDriver(virNWFilterDriverPtr);
> > -# ifdef WITH_LIBVIRTD
> >  int virRegisterStateDriver(virStateDriverPtr);
> > -# endif
> >  void virDriverModuleInitialize(const char *defmoddir);
> >  void *virDriverLoadModule(const char *name);
> >
> > diff --git a/src/libvirt.c b/src/libvirt.c
> > index f81a3de..e2a7b5d 100644
> > --- a/src/libvirt.c
> > +++ b/src/libvirt.c
> > @@ -118,10 +118,8 @@ static virSecretDriverPtr virSecretDriverTab[MAX_DRIVERS];
> >  static int virSecretDriverTabCount = 0;
> >  static virNWFilterDriverPtr virNWFilterDriverTab[MAX_DRIVERS];
> >  static int virNWFilterDriverTabCount = 0;
> > -#ifdef WITH_LIBVIRTD
> >  static virStateDriverPtr virStateDriverTab[MAX_DRIVERS];
> >  static int virStateDriverTabCount = 0;
> > -#endif
> >
> >
> >  #if defined(POLKIT_AUTH)
> > @@ -771,7 +769,6 @@ virRegisterDriver(virDriverPtr driver)
> >      return virDriverTabCount++;
> >  }
> >
> > -#ifdef WITH_LIBVIRTD
> >  /**
> >   * virRegisterStateDriver:
> >   * @driver: pointer to a driver block
> > @@ -885,10 +882,6 @@ int virStateStop(void) {
> >      return ret;
> >  }
> >
> > -#endif
> > -
> > -
> > -
> >  /**
> >   * virGetVersion:
> >   * @libVer: return value for the library version (OUT)
> > diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h
> > index 595d2db..b82f6b9 100644
> > --- a/src/libvirt_internal.h
> > +++ b/src/libvirt_internal.h
> > @@ -27,7 +27,6 @@
> >
> >  # include "internal.h"
> >
> > -# ifdef WITH_LIBVIRTD
> >  typedef void (*virStateInhibitCallback)(bool inhibit,
> >                                          void *opaque);
> >
> > @@ -37,7 +36,6 @@ int virStateInitialize(bool privileged,
> >  int virStateCleanup(void);
> >  int virStateReload(void);
> >  int virStateStop(void);
> > -# endif
> >
> >  /* Feature detection.  This is a libvirt-private interface for determining
> >   * what features are supported by the driver.
> > diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c
> > index 341321b..354a216 100644
> > --- a/src/remote/remote_driver.c
> > +++ b/src/remote/remote_driver.c
> > @@ -156,7 +156,6 @@ static void remoteDomainEventQueue(struct private_data *priv, virDomainEventPtr
> >  /* Helper functions for remoteOpen. */
> >  static char *get_transport_from_scheme(char *scheme);
> >
> > -#ifdef WITH_LIBVIRTD
> >  static int
> >  remoteStartup(bool privileged ATTRIBUTE_UNUSED,
> >                virStateInhibitCallback callback ATTRIBUTE_UNUSED,
> > @@ -168,7 +167,6 @@ remoteStartup(bool privileged ATTRIBUTE_UNUSED,
> >      inside_daemon = true;
> >      return 0;
> >  }
> > -#endif
> >
> >  #ifndef WIN32
> >  /**
> > @@ -6382,12 +6380,10 @@ static virNWFilterDriver nwfilter_driver = {
> >  };
> >
> >
> > -#ifdef WITH_LIBVIRTD
> >  static virStateDriver state_driver = {
> >      .name = "Remote",
> >      .initialize = remoteStartup,
> >  };
> > -#endif
> >
> >
> >  /** remoteRegister:
> > @@ -6408,9 +6404,7 @@ remoteRegister(void)
> >      if (virRegisterDeviceMonitor(&dev_monitor) == -1) return -1;
> >      if (virRegisterSecretDriver(&secret_driver) == -1) return -1;
> >      if (virRegisterNWFilterDriver(&nwfilter_driver) == -1) return -1;
> > -#ifdef WITH_LIBVIRTD
> >      if (virRegisterStateDriver(&state_driver) == -1) return -1;
> > -#endif
> >
> >      return 0;
> >  }
> > diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c
> > index 2795ebc..d65f4a6 100644
> > --- a/src/xen/xen_driver.c
> > +++ b/src/xen/xen_driver.c
> > @@ -91,7 +91,7 @@ static struct xenUnifiedDriver const * const drivers[XEN_UNIFIED_NR_DRIVERS] = {
> >  #endif
> >  };
> >
> > -#if defined WITH_LIBVIRTD || defined __sun
> > +#ifdef __sun
> >  static bool inside_daemon = false;
> >  #endif
> >
> > @@ -200,7 +200,6 @@ done:
> >      return res;
> >  }
> >
> > -#ifdef WITH_LIBVIRTD
> >
> >  static int
> >  xenInitialize(bool privileged ATTRIBUTE_UNUSED,
> > @@ -216,7 +215,6 @@ static virStateDriver state_driver = {
> >      .initialize = xenInitialize,
> >  };
> >
> > -#endif
> >
> >  /*----- Dispatch functions. -----*/
> >
> > @@ -2398,9 +2396,7 @@ static virDriver xenUnifiedDriver = {
> >  int
> >  xenRegister(void)
> >  {
> > -#ifdef WITH_LIBVIRTD
> >      if (virRegisterStateDriver(&state_driver) == -1) return -1;
> > -#endif
> >
> >      return virRegisterDriver(&xenUnifiedDriver);
> >  }
> > --
> > 1.8.0.1.240.ge8a1f5a
> 
> What platform or target were you aiming this for that this was needed?
> This appears to prevent supporting backends from being registered
> while the other parts of the code provide other functionality.

I didn't mention the patch is to solve the build failure with
--without-libvirtd. In the first version[1] I provided stubs for
those functions defined with WITH_LIBVIRTD, but DanP suggested
to remove all WITH_LIBVIRTD in files in src/, if I understood
correctly.

[1] https://www.redhat.com/archives/libvir-list/2013-February/msg00087.html

-- 
Regards,
Hu Tao


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