KVM: selftests: Add helpers to read integer module params
authorSean Christopherson <seanjc@google.com>
Tue, 9 Jan 2024 23:02:43 +0000 (15:02 -0800)
committerSean Christopherson <seanjc@google.com>
Tue, 30 Jan 2024 23:29:41 +0000 (15:29 -0800)
commit45e4755c39fc2df55f58ea893615a7d45a0fbcc8
tree2ad49d62071728b02908779b092fcd80a7d6614e
parentc85e986716b03bccfec2e5a577cc1aab4f172ffd
KVM: selftests: Add helpers to read integer module params

Add helpers to read integer module params, which is painfully non-trivial
because the pain of dealing with strings in C is exacerbated by the kernel
inserting a newline.

Don't bother differentiating between int, uint, short, etc.  They all fit
in an int, and KVM (thankfully) doesn't have any integer params larger
than an int.

Tested-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Link: https://lore.kernel.org/r/20240109230250.424295-24-seanjc@google.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
tools/testing/selftests/kvm/include/kvm_util_base.h
tools/testing/selftests/kvm/lib/kvm_util.c