Whamcloud - gitweb
0557c2dd554e5c9fc92edf980ec5444782031a4d
[fs/lustre-release.git] / lustre / include / lustre_ver.h
1 #ifndef _LUSTRE_VER_H_
2 #define _LUSTRE_VER_H_
3
4 /*
5  * LUSTRE_VERSION_STRING
6  *
7  * Note that some files may seem to include this header unnecessarily.
8  * If the file uses LUSTRE_VERSION_STRING, it is likely doing the include
9  * for compatibility with the Lustre code in the Linux kernel.
10  * In the Linux kernel, they are likely hard coding LUSTRE_VERSION_STRING
11  * right here in this file.  The out-of-kernel Lustre code generates
12  * LUSTRE_VERSION_STRING in autoconf with AC_DEFINE.
13  */
14
15 #define OBD_OCD_VERSION(major, minor, patch, fix)                       \
16         (((major) << 24) + ((minor) << 16) + ((patch) << 8) + (fix))
17
18 #define OBD_OCD_VERSION_MAJOR(version)  ((int)((version) >> 24) & 255)
19 #define OBD_OCD_VERSION_MINOR(version)  ((int)((version) >> 16) & 255)
20 #define OBD_OCD_VERSION_PATCH(version)  ((int)((version) >>  8) & 255)
21 #define OBD_OCD_VERSION_FIX(version)    ((int)((version) >>  0) & 255)
22
23 #define LUSTRE_VERSION_CODE                                             \
24         OBD_OCD_VERSION(LUSTRE_MAJOR, LUSTRE_MINOR, LUSTRE_PATCH, LUSTRE_FIX)
25
26 /* liblustre clients are only allowed to connect if their LUSTRE_FIX mismatches
27  * by this amount (set in lustre/autoconf/lustre-version.ac). */
28 #define LUSTRE_VERSION_ALLOWED_OFFSET OBD_OCD_VERSION(0, 0, 1, 32)
29
30 #ifdef __KERNEL__
31 /* If lustre version of client and servers it connects to differs by more
32  * than this amount, client would issue a warning.
33  * (set in lustre/autoconf/lustre-version.ac) */
34 #define LUSTRE_VERSION_OFFSET_WARN OBD_OCD_VERSION(0, 4, 50, 0)
35 #endif
36
37 #endif