On 02/04/2013 09:23 AM, 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 Even though this is a solution and it makes the calls to virState* never fail during compilation, I see the other approach being used as well in some files (xen _driver.c for example): #ifdef WITH_LIBVIRTD if (virRegisterStateDriver(&state_driver) == -1) return -1; #endif I like this a bit more, but that's just a subjective opinion. However, if you go with your approach, I'd rather see it cleaning up those paths as well. > > 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; > +} > + The comment is false in this case, so I'd keep the comments to a minimum and just mention that these are just dummy functions. [...] Martin -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list