]> git.openfabrics.org - ~emulex/for-vlad/compat.git/commitdiff
compat: add compat_version read-only module parameter compat-20100517
authorLuis R. Rodriguez <lrodriguez@atheros.com>
Mon, 17 May 2010 18:55:06 +0000 (11:55 -0700)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Mon, 17 May 2010 18:55:06 +0000 (11:55 -0700)
This will allow you to supply a version tag for the
backport you use. Compat-wireless will re-use this and
give it its own value based on the kernel we backport
from. It will use either the linux-next git describe
or the stable kernel git describe. Any delta on top of
the git tree should also be reflected then in case of
custom private trees/releases.

Signed-off-by: Luis R. Rodriguez <lrodriguez@atheros.com>
Makefile
compat/main.c

index 3692f966770c3f20f0afebf10c3eded8e3f20537..0f583bb44a00b4ea29b2a68c0ea722538af054d3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,10 @@ export KLIB_BUILD ?=    $(KLIB)/build
 
 export PWD := $(shell pwd)
 
+ifeq ($(KERNELRELEASE),)
+export COMPAT_VERSION := $(shell git describe)
+endif
+
 # This generates a bunch of CONFIG_COMPAT_KERNEL_22 CONFIG_COMPAT_KERNEL_23 .. etc for
 # each kernel release you need an object for.
 ifneq ($(wildcard $(KLIB_BUILD)/Makefile),)
@@ -29,7 +33,10 @@ obj-y += compat/
 # This hack lets us put our include path first than the kernel's
 # when building our compat modules. Your own makefile would look
 # the same.
-NOSTDINC_FLAGS := -I$(M)/include/ -include $(M)/include/linux/compat-2.6.h $(CFLAGS)
+NOSTDINC_FLAGS := -I$(M)/include/ \
+       -include $(M)/include/linux/compat-2.6.h \
+       $(CFLAGS) \
+       -DCOMPAT_VERSION=\"$(COMPAT_VERSION)\"
 
 modules:
        $(MAKE) -C $(KLIB_BUILD) M=$(PWD) modules
index d7f713da3d41a9e8e26394359cb029bc578e8935..35a5ae8dc29c48c6398f5d1823a3c07f50c011b9 100644 (file)
@@ -4,6 +4,15 @@ MODULE_AUTHOR("Luis R. Rodriguez");
 MODULE_DESCRIPTION("Kernel compatibility module");
 MODULE_LICENSE("GPL");
 
+#ifndef COMPAT_VERSION
+#error "You need a COMPAT_VERSION"
+#endif
+
+static char *compat_version = COMPAT_VERSION;
+
+module_param(compat_version, charp, 0400);
+MODULE_PARM_DESC(compat_version, "Version of the kernel compat backport");
+
 static int __init compat_init(void)
 {
        /* pm-qos for kernels <= 2.6.24, this is a no-op on newer kernels */