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

Matthias Bolte matthias.bolte at googlemail.com
Wed Dec 1 16:14:32 UTC 2010


2010/12/1 Eric Blake <eblake at redhat.com>:
> 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
>

Okay, I folded this in before pushing as discussed on IRC:

#else /* !WITH_MACVTAP */
static void
qemudVPAssociatePortProfiles(virDomainDefPtr def ATTRIBUTE_UNUSED) { }
#endif

Matthias




More information about the libvir-list mailing list