Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Aug 2006 14:44:44 GMT
From:      Paolo Pisati <piso@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 105222 for review
Message-ID:  <200608281444.k7SEiiDE024521@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=105222

Change 105222 by piso@piso_newluxor on 2006/08/28 14:43:56

	Move malloc&c redefinition for kernel land to alias_local.h

Affected files ...

.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#5 edit
.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_local.h#4 edit
.. //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_proxy.c#5 edit

Differences ...

==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_db.c#5 (text+ko) ====

@@ -145,6 +145,7 @@
 #ifdef _KERNEL
 #include <machine/stdarg.h>
 #include <sys/param.h>
+#include <sys/kernel.h>
 #else
 #include <stdarg.h>
 #include <sys/types.h>
@@ -157,9 +158,6 @@
 
 #ifdef _KERNEL
 #include <sys/systm.h>
-#include <sys/kernel.h>
-#include <sys/types.h>
-#include <sys/malloc.h>
 #include <sys/module.h>
 #include <sys/syslog.h>
 #else 
@@ -353,16 +351,8 @@
 /* Kernel module definition. */
 #ifdef	_KERNEL
 MALLOC_DEFINE(M_ALIAS, "libalias", "packet aliasing");
-
 MODULE_VERSION(libalias, 1);
 
-/* Use kernel allocator. */
-#if defined(_SYS_MALLOC_H_)
-#define	malloc(x)	malloc(x, M_ALIAS, M_NOWAIT|M_ZERO)
-#define	calloc(x, n)	malloc(x*n)
-#define	free(x)		free(x, M_ALIAS)
-#endif
-
 static int
 alias_mod_handler(module_t mod, int type, void *data)
 {

==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_local.h#4 (text+ko) ====

@@ -52,15 +52,25 @@
 
 #ifdef _KERNEL
 #include <sys/param.h>
+#include <sys/malloc.h>
+#include <sys/kernel.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
 #include <sys/proc.h>
 #include <sys/condvar.h>
 #endif
 
+#ifdef _KERNEL
 /* XXX: LibAliasSetTarget() uses this constant. */
-#ifdef _KERNEL
 #define	INADDR_NONE	0xffffffff
+MALLOC_DECLARE(M_ALIAS);
+
+/* Use kernel allocator. */
+#if defined(_SYS_MALLOC_H_)
+#define	malloc(x)	malloc(x, M_ALIAS, M_NOWAIT|M_ZERO)
+#define	calloc(x, n)	malloc(x*n)
+#define	free(x)		free(x, M_ALIAS)
+#endif
 #endif
 
 /* Sizes of input and output link tables */

==== //depot/projects/soc2005/libalias/sys/netinet/libalias/alias_proxy.c#5 (text+ko) ====

@@ -156,15 +156,6 @@
 static void	ProxyEncodeIpHeader(struct ip *, int);
 
 #ifdef	_KERNEL
-
-/* Use kernel allocator. */
-#if defined(_SYS_MALLOC_H_)
-MALLOC_DECLARE(M_ALIAS);
-#define	malloc(x)	malloc(x, M_ALIAS, M_NOWAIT|M_ZERO)
-#define	calloc(x, n)	malloc(x*n)
-#define	free(x)		free(x, M_ALIAS)
-#endif
-
 static int
 inet_aton(cp, addr)
         const char *cp;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608281444.k7SEiiDE024521>