[kgtp] r908 committed - Fix build error with Linux Kernel 3.0.x version....

  • From: kgtp@xxxxxxxxxxxxxx
  • To: kgtp@xxxxxxxxxxxxx
  • Date: Sat, 04 Feb 2012 08:34:06 +0000

Revision: 908
Author:   teawater
Date:     Sat Feb  4 00:32:45 2012
Log:      Fix build error with Linux Kernel 3.0.x version.
Thanks for report from sam.wanshan.

http://code.google.com/p/kgtp/source/detail?r=908

Modified:
 /trunk/Makefile
 /trunk/UPDATE
 /trunk/dkms.conf
 /trunk/gtp.c
 /trunk/perf_event.c

=======================================
--- /trunk/Makefile     Tue Jan 31 04:51:57 2012
+++ /trunk/Makefile     Sat Feb  4 00:32:45 2012
@@ -1,6 +1,6 @@
 obj-m := gtp.o

-MODULEVERSION := 20120131
+MODULEVERSION := 20120131+

 KERNELVERSION := $(shell uname -r)
 KERNELDIR := /lib/modules/$(KERNELVERSION)/build/
=======================================
--- /trunk/UPDATE       Tue Jan 31 05:59:13 2012
+++ /trunk/UPDATE       Sat Feb  4 00:32:45 2012
@@ -1,3 +1,8 @@
+*** 20120131+
+
+* Fix build error with Linux Kernel 3.0.x version.
+  Thanks for report from sam.wanshan.
+
 *** 20120131

 * https://lkml.org/lkml/2012/1/31/215
=======================================
--- /trunk/dkms.conf    Tue Jan 31 04:51:57 2012
+++ /trunk/dkms.conf    Sat Feb  4 00:32:45 2012
@@ -1,5 +1,5 @@
 PACKAGE_NAME="gtp"
-PACKAGE_VERSION="20120131"
+PACKAGE_VERSION="20120131+"
 CLEAN="make clean"
 MAKE[0]="make gtp.ko KERNELVERSION=$kernelver"
 BUILT_MODULE_NAME[0]="gtp"
=======================================
--- /trunk/gtp.c        Tue Jan 31 04:51:57 2012
+++ /trunk/gtp.c        Sat Feb  4 00:32:45 2012
@@ -20,7 +20,7 @@
  */

 /* If *10 means that this is not a release version.  */
-#define GTP_VERSION                    (20120131)
+#define GTP_VERSION                    (20120131 * 10)

 #include <linux/version.h>
 #ifndef RHEL_RELEASE_VERSION
@@ -5089,7 +5089,7 @@
                        continue;

                /* Get event.  */
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
                tve->pts->event =
                        perf_event_create_kernel_counter(&(tve->pts->attr),
                                                         tve->pts->cpu,
=======================================
--- /trunk/perf_event.c Tue Jan 31 01:17:50 2012
+++ /trunk/perf_event.c Sat Feb  4 00:32:45 2012
@@ -9,7 +9,7 @@

 #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0))

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 struct ring_buffer {
        atomic_t                        refcount;
        struct rcu_head                 rcu_head;
@@ -262,7 +262,7 @@
        return can_add_hw;
 }

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 #ifndef CONFIG_PERF_USE_VMALLOC
 static inline int page_order(struct ring_buffer *rb)
 {
@@ -324,7 +324,7 @@
                buf += size;
                handle->size -= size;
                if (!handle->size) {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
                        struct ring_buffer *buffer = handle->rb;
 #elif (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,35)) \
       || (RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6,1))
@@ -380,7 +380,7 @@
 }
 #endif

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,37))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))

 /*
  * If we inherit events we want to return the parent event id
@@ -485,7 +485,7 @@
                __perf_event__output_id_sample(handle, sample);
 }

-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,1))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
 static void gtp_perf_event_wakeup(struct perf_event *event)
 {
        wake_up_all(&event->waitq);
@@ -505,12 +505,12 @@
        atomic_set(&handle->buffer->poll, POLL_IN);
 #endif

-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,1))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
        if (handle->nmi) {
 #endif
                handle->event->pending_wakeup = 1;
                irq_work_queue(&handle->event->pending);
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,1))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
        } else
                gtp_perf_event_wakeup(handle->event);
 #endif
@@ -518,7 +518,7 @@

 static void perf_output_put_handle(struct perf_output_handle *handle)
 {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
        struct ring_buffer *buffer = handle->rb;
 #else
        struct perf_buffer *buffer = handle->buffer;
@@ -560,7 +560,7 @@

 static void gtp_perf_output_end(struct perf_output_handle *handle)
 {
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,1))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
        struct perf_event *event = handle->event;
        struct perf_buffer *buffer = handle->buffer;

@@ -579,7 +579,7 @@
        rcu_read_unlock();
 }

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 static unsigned long perf_data_size(struct ring_buffer *buffer)
 #else
 static unsigned long perf_data_size(struct perf_buffer *buffer)
@@ -591,7 +591,7 @@
 /*
  * Output
  */
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
static bool perf_output_space(struct ring_buffer *buffer, unsigned long tail,
                              unsigned long offset, unsigned long head)
 #else
@@ -625,7 +625,7 @@
  */
 static void perf_output_get_handle(struct perf_output_handle *handle)
 {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
        struct ring_buffer *buffer = handle->rb;
 #else
        struct perf_buffer *buffer = handle->buffer;
@@ -640,7 +640,7 @@
                                 struct perf_event *event, unsigned int size,
                                 int nmi, int sample)
 {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
        struct ring_buffer *buffer;
 #else
        struct perf_buffer *buffer;
@@ -661,7 +661,7 @@
        if (event->parent)
                event = event->parent;

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
        buffer = rcu_dereference(event->rb);
 #else
        buffer = rcu_dereference(event->buffer);
@@ -669,13 +669,13 @@
        if (!buffer)
                goto out;

-#if (LINUX_VERSION_CODE > KERNEL_VERSION(3,0,0))
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
        handle->rb   = buffer;
 #else
        handle->buffer       = buffer;
 #endif
        handle->event        = event;
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,0,1))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
        handle->nmi  = nmi;
        handle->sample       = sample;
 #endif

Other related posts:

  • » [kgtp] r908 committed - Fix build error with Linux Kernel 3.0.x version.... - kgtp