xref: /kvm-unit-tests/lib/errata.h (revision 7516869fc7fbc175d18adb165117ba502050b160)
1 /*
2  * errata functions
3  *
4  * This code is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Library General Public License version 2.
6  */
7 #ifndef _ERRATA_H_
8 #define _ERRATA_H_
9 
10 #define _ERRATA(erratum) errata("ERRATA_" # erratum)
11 #define ERRATA(erratum) _ERRATA(erratum)
12 
13 #define _ERRATA_RELAXED(erratum) errata_relaxed("ERRATA_" # erratum)
14 #define ERRATA_RELAXED(erratum) _ERRATA_RELAXED(erratum)
15 
16 static inline bool errata(const char *erratum)
17 {
18 	char *s = getenv(erratum);
19 
20 	return s && (*s == '1' || *s == 'y' || *s == 'Y');
21 }
22 
23 static inline bool errata_relaxed(const char *erratum)
24 {
25 	char *s = getenv(erratum);
26 
27 	return !(s && (*s == '0' || *s == 'n' || *s == 'N'));
28 }
29 
30 #endif
31