[libvirt] [PATCH] Fix undefined symbol error when macvtap support is disabled

Eric Blake eblake at redhat.com
Wed Dec 1 15:51:04 UTC 2010


On 12/01/2010 08:34 AM, Matthias Bolte wrote:
> Use macvtap specific functions depending on WITH_MACVTAP.
> 
> Use #if instead of #ifdef to check for WITH_MACVTAP, because
> WITH_MACVTAP is always defined with value 0 or 1.

That, and #if undefined behaves the same as #if defined_as_0.

> 
> Also export virVMOperationType{To|From}String unconditional,
> because they are used unconditional in the domain config code.
> ---
>  src/libvirt_macvtap.syms |    5 +++--
>  src/libvirt_private.syms |    5 +++++
>  src/qemu/qemu_driver.c   |    4 ++++
>  src/util/macvtap.h       |   19 +++++++++----------
>  4 files changed, 21 insertions(+), 12 deletions(-)

ACK.

> +++ b/src/qemu/qemu_driver.c
> @@ -11879,6 +11879,7 @@ cleanup:
>      return ret;
>  }
>  
> +#if WITH_MACVTAP
>  static void
>  qemudVPAssociatePortProfiles(virDomainDefPtr def) {
>      int i;
> @@ -11913,6 +11914,7 @@ err_exit:
>          }
>      }
>  }
> +#endif /* WITH_MACVTAP */

I would have done:

#else /* !WITH_MACVTAP */
# define qemudVPAssociatePortProfiles(ignored) /* */
#endif

>  
>  /* Finish is the third and final step, and it runs on the destination host. */
>  static virDomainPtr
> @@ -11974,7 +11976,9 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
>              goto cleanup;
>          }
>  
> +#if WITH_MACVTAP
>          qemudVPAssociatePortProfiles(vm->def);
> +#endif /* WITH_MACVTAP */

in order to avoid an in-function #ifdef. Up to you if you want to tweak
that before pushing.

-- 
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/20101201/a6d3aa79/attachment-0001.sig>


More information about the libvir-list mailing list