2 * version.h -- get running kernel version
4 * Copyright (C) 2008 Oracle. All rights reserved.
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 021110-1307, USA.
23 #ifndef _NFS_UTILS_MOUNT_VERSION_H
24 #define _NFS_UTILS_MOUNT_VERSION_H
29 #include <sys/utsname.h>
31 static inline unsigned int MAKE_VERSION(unsigned int p, unsigned int q,
34 return (65536 * p) + (256 * q) + r;
37 static inline unsigned int linux_version_code(void)
39 struct utsname my_utsname;
42 if (uname(&my_utsname))
45 p = (unsigned int)atoi(strtok(my_utsname.release, "."));
46 q = (unsigned int)atoi(strtok(NULL, "."));
47 r = (unsigned int)atoi(strtok(NULL, "."));
48 return MAKE_VERSION(p, q, r);
51 #endif /* _NFS_UTILS_MOUNT_VERSION_H */