autofs-5.0.6 - add kernel verion check function From: Ian Kent Add a function to check kernel version. --- CHANGELOG | 1 + include/mounts.h | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 29e4049..7e5783f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -27,6 +27,7 @@ - teach automount about sss source. - fix init script usage message. - ignore duplicate exports in auto.net. +- add kernel verion check function. 28/06/2011 autofs-5.0.6 ----------------------- diff --git a/include/mounts.h b/include/mounts.h index 4d932ca..3947d83 100644 --- a/include/mounts.h +++ b/include/mounts.h @@ -16,6 +16,9 @@ #ifndef MOUNTS_H #define MOUNTS_H +#include +#include + #ifndef AUTOFS_TYPE_ANY #define AUTOFS_TYPE_ANY 0x0000 #endif @@ -72,6 +75,20 @@ struct mnt_list { struct list_head ordered; }; +static inline unsigned int linux_version_code(void) +{ + struct utsname my_utsname; + unsigned int p, q, r; + + if (uname(&my_utsname)) + return 0; + + p = (unsigned int)atoi(strtok(my_utsname.release, ".")); + q = (unsigned int)atoi(strtok(NULL, ".")); + r = (unsigned int)atoi(strtok(NULL, ".")); + return KERNEL_VERSION(p, q, r); +} + unsigned int query_kproto_ver(void); unsigned int get_kver_major(void); unsigned int get_kver_minor(void);