]> git.ipfire.org Git - thirdparty/libvirt.git/commit
util: make virPCIGetNetName() more versatile
authorLaine Stump <laine@laine.org>
Mon, 31 Jul 2017 04:21:45 +0000 (00:21 -0400)
committerLaine Stump <laine@laine.org>
Fri, 11 Aug 2017 22:35:09 +0000 (18:35 -0400)
commitb3b5aa75ed40d14bb96d3e7d2cff7356ccaab442
treeebadcf810a2ac159621c11cbcbed043968e32f84
parent0dc67e6d2d682fdf48c520770224bab133f5b6db
util: make virPCIGetNetName() more versatile

A single PCI device may have multiple netdevs associated with it. Each
of those netdevs will have a different phys_port_id entry in
sysfs. This patch modifies virPCIGetNetName() to allow selecting one
of the potential many netdevs in two different ways:

1) by setting the "idx" argument, the caller can select the 1st (0),
2nd (1), etc. netdev from the PCI device's net subdirectory.

2) If the physPortID arg is set (to a null-terminated string) then
virPCIGetNetName() returns the netdev that has that phys_port_id in
the sysfs file of the same name in the netdev's directory.
src/util/virhostdev.c
src/util/virnetdev.c
src/util/virpci.c
src/util/virpci.h