[libvirt] [PATCH 10/10] network: internal API functions to manage assignment of physdev to guest
Eric Blake
eblake at redhat.com
Fri Jul 8 20:23:11 UTC 2011
On 07/05/2011 10:18 PM, Laine Stump wrote:
> I realized that PATCH 10/10 would cause the build to fail if someone
> did a build --with-qemu but --without-network. I'm squashing the
> following into the original patch to remedy that.
>
> I'm not really a fan of putting #if all over the place, but this is
> similar to what's done with WITH_MACVTAP, so at least there's
> precedence. (This is necessary because this new "backend API" to the
> network driver isn't called via a pointer table filled in at runtime,
> as is done with the public API).
Would it be any easier to instead guarantee that even when #if
WITH_NETWORK is false, those same symbols are available as no-ops to
allow compilation to proceed?
> +#if WITH_NETWORK
> /* If appropriate, grab a physical device from the configured
> * network's pool of devices, or resolve bridge device name
> * to the one defined in the network definition.
> */
> if (networkAllocateActualDevice(net) < 0)
> goto error;
> -
> +#endif
That is, make networkAllocateActualDevice() be a no-op that returns 0 if
there is no network support compiled in, and therefore nothing to allocate.
> +++ b/tests/Makefile.am
> @@ -319,8 +319,11 @@ endif
>
> if WITH_QEMU
>
> -qemu_LDADDS = ../src/libvirt_driver_qemu.la \
> - ../src/libvirt_driver_network.la
> +qemu_LDADDS = ../src/libvirt_driver_qemu.la
> +
> +if WITH_NETWORK
> +qemu_LDADDS += ../src/libvirt_driver_network.la
> +endif
Then again, if you are compiling --without-network, you don't want to
link against a library that won't be built. That would imply that any
no-op stubs would have to be provided by static inline functions in the
header in the no-network case.
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110708/b385d773/attachment-0001.sig>
More information about the libvir-list
mailing list