]> git.ipfire.org Git - thirdparty/libvirt.git/commit
lib: Format PCI address differently
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 30 Jul 2019 14:24:39 +0000 (16:24 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 5 Aug 2019 17:42:15 +0000 (19:42 +0200)
commit9b332820f39619f816bf1e36ea591bae10352077
tree29c64218e57be2ccbe2a9f525a9fa65d419a29f1
parentf0c50bc1cea209f589067c4e3e8787ce35651107
lib: Format PCI address differently

Currently, the way we format PCI address is using printf-s
precision, e.g. "%.4x". This works if we don't want to print any
value outside of bounds (which is usually the case). However,
turns out, PCI domain can be 0x10000 which doesn't work well with
our format strings. However, if we change the format string to
"%04x" then we still pad small values with zeroes but also we are
able to print values that are larger than four digits. In fact,
this format string used by kernel to print a PCI address:

  "%04x:%02x:%02x.%d"

The other three format strings (for bus, device and function) are
changed too, so that we use the same format string as kernel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/conf/device_conf.c
src/conf/domain_addr.c
src/conf/domain_conf.c
src/conf/node_device_conf.c
src/util/virpci.h
tools/virsh-domain.c