1 /* SPDX-License-Identifier: GPL-2.0-or-later 2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved. 3 * Copyright (c) 2009-2016 Cyril Hrubis chrubis@suse.cz 4 */ 5 6 #ifndef TST_KVERCMP_H__ 7 #define TST_KVERCMP_H__ 8 9 /* 10 * The same as tst_kvercmp() but running kernel version is passed as parameter 11 * instead of utilizing uname(). 12 */ 13 int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3); 14 15 /* 16 * Parsers string into three integer version. 17 */ 18 int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3); 19 20 /* 21 * Returns distribution name parsed from kernel version string or NULL. 22 */ 23 const char *tst_kvcmp_distname(const char *cur_kver); 24 25 /* 26 * Compares versions up to five version numbers long. 27 */ 28 int tst_kvexcmp(const char *tst_exv, const char *cur_kver); 29 30 /* 31 * Compare given kernel version with currently running kernel. 32 * 33 * Returns negative if older, 0 if the same and possitive if newer. 34 */ 35 int tst_kvercmp(int r1, int r2, int r3); 36 37 struct tst_kern_exv { 38 char *dist_name; 39 char *extra_ver; 40 }; 41 42 int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers); 43 44 #endif /* TST_KVERCMP_H__ */ 45