blob: 13499767848ba6a47218ecfe55affc3428acfe16 [file] [log] [blame]
Cyril Hrubis9c74eef2016-02-04 10:32:22 +01001/*
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/*
Cyril Hrubis882f45a2017-04-21 16:31:48 +020038 * The same as tst_kvercmp() but running kernel version is passed as parameter
39 * instead of utilizing uname().
40 */
41int tst_kvcmp(const char *cur_kver, int r1, int r2, int r3);
42
43/*
44 * Parsers string into three integer version.
Cyril Hrubis9c74eef2016-02-04 10:32:22 +010045 */
Cyril Hrubis4dcfd282016-11-01 15:07:12 +010046int tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3);
Cyril Hrubis9c74eef2016-02-04 10:32:22 +010047
48/*
Cyril Hrubis882f45a2017-04-21 16:31:48 +020049 * Returns distribution name parsed from kernel version string or NULL.
50 */
51const char *tst_kvcmp_distname(const char *cur_kver);
52
53/*
54 * Compares versions up to five version numbers long.
55 */
56int tst_kvexcmp(const char *tst_exv, const char *cur_kver);
57
58/*
Cyril Hrubis9c74eef2016-02-04 10:32:22 +010059 * Compare given kernel version with currently running kernel.
60 *
61 * Returns negative if older, 0 if the smame and possitive if newer.
62 */
63int tst_kvercmp(int r1, int r2, int r3);
64
65struct tst_kern_exv {
66 char *dist_name;
67 char *extra_ver;
68};
69
70int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers);
71
72#endif /* TST_KVERCMP_H__ */