
On 8/16/19 10:56 PM, Daniel Henrique Barboza wrote:
On 8/14/19 8:57 AM, Michal Privoznik wrote:
In upcoming patches we will need only some portions of the PCI address. To construct that easily, it's better if the PCI address of a device is stored as four integers rather than one string.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- tests/virpcimock.c | 76 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 15 deletions(-)
diff --git a/tests/virpcimock.c b/tests/virpcimock.c index de365cdb78..c10764dcdd 100644 --- a/tests/virpcimock.c +++ b/tests/virpcimock.c @@ -118,8 +118,16 @@ struct pciDriver { unsigned int fail; /* Bitwise-OR of driverActions that should fail */ }; +struct pciDeviceAddress { + unsigned int domain; + unsigned int bus; + unsigned int device; + unsigned int function; +}; +# define ADDR_STR_FMT "%04x:%02x:%02x.%d" +
I was going to complain "this stuff is similar to what we already have in utils/virpci.c, why can't we use it here", but in a second thought I realized virpci.h is too big of a import just for a macro and a couple of parse functions.
Yet again, great minds think alike :-) This was exactly my reasoning for not including virpci.h. I mean, I wanted to but then realized it's probably better if we keep the mock separate.
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Thanks, Michal