
On 04.12.2015 17:02, Laine Stump wrote:
On 12/04/2015 07:30 AM, Michal Privoznik wrote:
There are few outdated things. Firstly, we don't need to undergo the torture of fopen, fscanf and fclose when we have nice wrapper over that: virFileReadAll. Secondly, we can use dynamically allocated buffer for the interface index.
Nothing against your changes to the existing function (ACK to that), but why is it reading sysfs for the ifindex? Why not just use virNetDevGetIndex(), as we do everywhere else in libvirt? (For that matter, I'm betting that the response message to the netlink request that creates the macvtap device will already contain the ifindex of the newly created device, but it would take more re-working of the code to carry that up from virNetDevMacVLanCreate() and over into virNetDevMacVLanTapOpen(), so likely not worth the small efficiency gain).
Oh, right! I'm switching to virNetDevGetIndex. Although frankly, I'm not much of a friend with netlink to know how to dig out anything from a response there. Michal