aboutsummaryrefslogtreecommitdiff
path: root/kernel-features.c
diff options
context:
space:
mode:
authorAdam Litke <agl@us.ibm.com>2008-10-23 19:53:55 +0000
committerEric B Munson <ebmunson@us.ibm.com>2008-10-27 10:41:53 +0000
commit46573a03d1a57910014a5f8e85a773622bb6fe03 (patch)
treef5fb95c673bcfa3da8d0a7384e8974891c9e2d14 /kernel-features.c
parent1827d3a908533f04f988cf8550eaedf4adfc284e (diff)
downloadlibhugetlbfs-46573a03d1a57910014a5f8e85a773622bb6fe03.tar.gz
tests: Add helper for comparing kernel versions
Make use of pre-existing kernel version comparison code and create a helper that can be used by test wrapper scripts to compare two kernel versions. Signed-off-by: Adam Litke <agl@us.ibm.com> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
Diffstat (limited to 'kernel-features.c')
-rw-r--r--kernel-features.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/kernel-features.c b/kernel-features.c
index c6a9987..5f20249 100644
--- a/kernel-features.c
+++ b/kernel-features.c
@@ -149,6 +149,17 @@ static int ver_cmp(struct kernel_version *a, struct kernel_version *b)
return 0;
}
+int test_compare_kver(const char *a, const char *b)
+{
+ struct kernel_version ka, kb;
+
+ if (str_to_ver(a, &ka) < 0)
+ return -EINVAL;
+ if (str_to_ver(b, &kb) < 0)
+ return -EINVAL;
+ return ver_cmp(&ka, &kb);
+}
+
int hugetlbfs_test_feature(int feature_code)
{
if (feature_code >= HUGETLB_FEATURE_NR) {