Cyril Hrubis | 9c74eef | 2016-02-04 10:32:22 +0100 | [diff] [blame^] | 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 | * Parse string kernel version into three integers. |
| 39 | * |
| 40 | * If version has only two numbers, i.e. 2.4 the third integer is set to zero. |
| 41 | */ |
| 42 | void tst_parse_kver(const char *str_kver, int *v1, int *v2, int *v3); |
| 43 | |
| 44 | /* |
| 45 | * Compare given kernel version with currently running kernel. |
| 46 | * |
| 47 | * Returns negative if older, 0 if the smame and possitive if newer. |
| 48 | */ |
| 49 | int tst_kvercmp(int r1, int r2, int r3); |
| 50 | |
| 51 | struct tst_kern_exv { |
| 52 | char *dist_name; |
| 53 | char *extra_ver; |
| 54 | }; |
| 55 | |
| 56 | int tst_kvercmp2(int r1, int r2, int r3, struct tst_kern_exv *vers); |
| 57 | |
| 58 | #endif /* TST_KVERCMP_H__ */ |