On Mon, Feb 04, 2013 at 11:43:59AM +0000, Daniel P. Berrange wrote:
On Mon, Feb 04, 2013 at 04:23:30PM +0800, Hu Tao wrote:
> ---
> src/driver.h | 4 ---
> src/libvirt.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++-
> src/libvirt_internal.h | 2 --
> 3 files changed, 69 insertions(+), 7 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..38e4f6e 100644
> --- a/src/libvirt.c
> +++ b/src/libvirt.c
> @@ -885,8 +885,76 @@ int virStateStop(void) {
> return ret;
> }
>
> -#endif
> +#else /* WITH_LIBVIRTD */
> +
> +/**
> + * virRegisterStateDriver:
> + * @driver: pointer to a driver block
> + *
> + * Register a virtualization driver
> + *
> + * Returns the driver priority or -1 in case of error.
> + */
> +int
> +virRegisterStateDriver(virStateDriverPtr driver ATTRIBUTE_UNUSED)
> +{
> + return 0;
> +}
> +
> +/**
> + * virStateInitialize:
> + * @privileged: set to true if running with root privilege, false otherwise
> + * @callback: callback to invoke to inhibit shutdown of the daemon
> + * @opaque: data to pass to @callback
> + *
> + * Initialize all virtualization drivers.
> + *
> + * Returns 0 if all succeed, -1 upon any failure.
> + */
> +int virStateInitialize(bool privileged ATTRIBUTE_UNUSED,
> + virStateInhibitCallback callback ATTRIBUTE_UNUSED,
> + void *opaque ATTRIBUTE_UNUSED)
> +{
> + return 0;
> +}
> +
> +/**
> + * virStateCleanup:
> + *
> + * Run each virtualization driver's cleanup method.
> + *
> + * Returns 0 if all succeed, -1 upon any failure.
> + */
> +int virStateCleanup(void)
> +{
> + return 0;
> +}
> +
> +/**
> + * virStateReload:
> + *
> + * Run each virtualization driver's reload method.
> + *
> + * Returns 0 if all succeed, -1 upon any failure.
> + */
> +int virStateReload(void)
> +{
> + return 0;
> +}
> +
> +/**
> + * virStateStop:
> + *
> + * Run each virtualization driver's "stop" method.
> + *
> + * Returns 0 if successful, -1 on failure
> + */
> +int virStateStop(void)
> +{
> + return 0;
> +}
Don't add all these stubs - just remove the WITH_LIBVIRTD
conditional from the original impls. There is nothing that
prevents us building them, even if libvirtd is disabled
Okey, I see. I'll send v2.
--
Regards,
Hu Tao