[libvirt] [PATCH 1 of 3] [LXC] Add functions to manage veth device pairs

Dan Smith danms at us.ibm.com
Fri Jun 20 17:52:04 UTC 2008

>> +#define DEBUG(fmt,...) VIR_DEBUG(__FILE__, fmt, __VA_ARGS__)
>> +#define DEBUG0(msg) VIR_DEBUG(__FILE__, "%s", msg)

DL> Do you know ##__VA_ARGS ?

Yes, and I agree this not my preferred way.  However, this isn't my
code and when I went to look for other instances, I found many so I
decided not to change it.

  % cat *.c | grep DEBUG0 -c

DL> Is this function safe for concurrent access ? eg. getFreeVethName
DL> called in parallel by two processes or another process creates a
DL> pair device just after you exit the loop ?

No, there is indeed a race.  However, since this just makes a
suggestion and relies on the subsequent call to try to instantiate the
interface, I don't think there's a chance for anything other than a
spurious failure.

This is specifically why I wanted to get this on the list sooner than
later.  I figured (or hoped) that given the experience in this group
that someone could offer some educated suggestions before I jumped in
and started trying to fix it.

>> +    if (1 > strlen(veth1)) {

DL> Why do you check with strlen > 1 ?

To be honest, I have no idea why Dave did that.  I'll check with him
to see if there's something we're missing.  It's probably worth a
comment if so.

Dan Smith
IBM Linux Technology Center
Open Hypervisor Team
email: danms at us.ibm.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20080620/2beb0a9b/attachment-0001.sig>

More information about the libvir-list mailing list