• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2000 Silicon Graphics, Inc.  All Rights Reserved.
3  * Copyright (c) 2009-2016 Cyril Hrubis chrubis@suse.cz
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it would be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * Further, this software is distributed without any warranty that it is
14  * free of the rightful claim of any third person regarding infringement
15  * or the like.  Any license provided herein, whether implied or
16  * otherwise, applies only to this software file.  Patent licenses, if
17  * any, provided herein do not apply to combinations of this program with
18  * other software, or any other product whatsoever.
19  *
20  * You should have received a copy of the GNU General Public License along
21  * with this program; if not, write the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  *
24  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
25  * Mountain View, CA  94043, or:
26  *
27  * http://www.sgi.com
28  *
29  * For further information regarding this notice, see:
30  *
31  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
32  */
33 
34 #ifndef TST_KVERCMP_H__
35 #define TST_KVERCMP_H__
36 
37 /*
38  * The same as tst_kvercmp() but running kernel version is passed as parameter
39  * instead of utilizing uname().
40  */
41 int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3);
42 
43 /*
44  * Parsers string into three integer version.
45  */
46 int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3);
47 
48 /*
49  * Returns distribution name parsed from kernel version string or NULL.
50  */
51 const char *tst_kvcmp_distname(const char *cur_kver);
52 
53 /*
54  * Compares versions up to five version numbers long.
55  */
56 int tst_kvexcmp(const char *tst_exv, const char *cur_kver);
57 
58 /*
59  * Compare given kernel version with currently running kernel.
60  *
61  * Returns negative if older, 0 if the smame and possitive if newer.
62  */
63 int tst_kvercmp(int r1, int r2, int r3);
64 
65 struct tst_kern_exv {
66 	char *dist_name;
67 	char *extra_ver;
68 };
69 
70 int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers);
71 
72 #endif	/* TST_KVERCMP_H__ */
73