KVM: selftests: Use pread() to read binary stats header
authorSean Christopherson <seanjc@google.com>
Tue, 11 Jul 2023 23:01:26 +0000 (16:01 -0700)
committerPaolo Bonzini <pbonzini@redhat.com>
Sat, 29 Jul 2023 15:05:28 +0000 (11:05 -0400)
commit625646aede90554fed8d46fd0e081238e071ac5e
tree53f583f6e0648242005678c531de2efb7c24673e
parenteed3013faa401aae662398709410a59bb0646e32
KVM: selftests: Use pread() to read binary stats header

Use pread() with an explicit offset when reading the header and the header
name for a binary stats fd so that the common helper and the binary stats
test don't subtly rely on the file effectively being untouched, e.g. to
allow multiple reads of the header, name, etc.

Signed-off-by: Sean Christopherson <seanjc@google.com>
Message-Id: <20230711230131.648752-3-seanjc@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/kvm_binary_stats_test.c