[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unresolved: htonl(), htons(), __memcpy3d



Aiee :)

   Hello!

On Thu, Feb 22, 2001 at 05:44:35AM -0500, Mike Brown wrote:
> The below file contains a few trivial modifications to hello.c from the
> The Linux Kernel Module Programming Guide but the example shows my
> problem.  I'm running linux-2.4.2, gcc 2.95.2.  Here's the output from
> gcc:

   I'm running 2.2 kernel series, but don't care about this, right here.
   (I mean that the same can be applied to 2.[24] kernel too).

> gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c testprog.c -I/usr/src/linux/include
> testprog.c: In function `init_module':
> testprog.c:20: warning: implicit declaration of function
> `printk_R1b7d4074'
> testprog.c:16: warning: unused variable `tmp2'
> testprog.c:15: warning: unused variable `tmp1'

   Don't care about unused vars warnings (That depend upon you ;)).
   You have to compile the module giving -O2 optimization switch to gcc in
   order to consider inline function and other stuff.

   You can find a little patch (diff file) attached to this email
   (Have to say to the list to forgive me, but it's just half than a K)
   which should solve the little issue:

   Just include <linux/config.h> by yourself as the first include file, then
   check for CONFIG_MODVERSIONS right after.
   Quite all (?) the kernel header files depend about modversioning (well, at 
   least those which exports functions, macros to the world)

   You have to had also <linux/sched.h> for __cpu_to_be32 and __cpu_to_be16
   which are macro (IIRC) called by htons/htonl (though they aren't declared
   there, but in other includes)

> -Michael F. Brown, UMass Lowell Computer Science
> 
> phone:  (978) 934-5354
> email:  mbrown@cs.uml.edu

   Hope this could help.

bye bye

                     -- gg sullivan

-- 
Lorenzo Cavallaro	`Gigi Sullivan' <sullivan@sikurezza.org>

LibRNet Project Home Page: http://www.sikurezza.org/sullivan
LibRNet Mailing List: librnet-subscribe@egroups.com

Until I loved, life had no beauty;
I did not know I lived until I had loved. (Theodor Korner)
--- module.c.orig	Thu Feb 22 12:32:37 2001
+++ module.c	Thu Feb 22 12:43:22 2001
@@ -1,13 +1,13 @@
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <linux/string.h>
-
-#include <linux/byteorder/generic.h>
+#include <linux/config.h>
 
-#if CONFIG_MODVERSIONS==1
+#if (CONFIG_MODVERSIONS == 1)
 #define MODVERSIONS
 #include <linux/modversions.h>
 #endif
+
+#include <linux/sched.h>
+#include <linux/module.h>
+#include <linux/string.h>
 
 int init_module()
 {