[svn-commits] fjoe: freebsd/trunk r7836 - in /freebsd/trunk: drivers/dahdi/ drivers/dahdi/w...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Jan 10 15:39:17 CST 2010


Author: fjoe
Date: Sun Jan 10 15:39:13 2010
New Revision: 7836

URL: http://svnview.digium.com/svn/dahdi?view=rev&rev=7836
Log:
Move common Linux kernel API emulation functions to main DAHDI module.

Added:
    freebsd/trunk/freebsd/dahdi/bsd-compat.c   (with props)
Modified:
    freebsd/trunk/drivers/dahdi/dahdi-base.c
    freebsd/trunk/drivers/dahdi/dahdi_dynamic.c
    freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c
    freebsd/trunk/drivers/dahdi/dahdi_dynamic_loc.c
    freebsd/trunk/drivers/dahdi/wcb4xxp/base.c
    freebsd/trunk/drivers/dahdi/wct4xxp/base.c
    freebsd/trunk/freebsd/dahdi/Makefile
    freebsd/trunk/include/dahdi/compat/bsd.h

Modified: freebsd/trunk/drivers/dahdi/dahdi-base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi-base.c?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi-base.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi-base.c Sun Jan 10 15:39:13 2010
@@ -48,9 +48,6 @@
 #include <sys/poll.h>
 #include <net/ppp_defs.h>
 #include <sys/selinfo.h>
-#include <sys/syscallsubr.h>
-
-#include <machine/stdarg.h>
 
 #include "version.h"
 
@@ -140,26 +137,7 @@
 } ;
 
 #if defined(__FreeBSD__)
-#if 0
-static void
-rlprintf(int pps, const char *fmt, ...)
-	__printflike(2, 3);
-
-static void rlprintf(int pps, const char *fmt, ...)
-{
-	va_list ap;
-	static struct timeval last_printf;
-	static int count;
-
-	if (ppsratecheck(&last_printf, &count, pps)) {
-		va_start(ap, fmt);
-		vprintf(fmt, ap);
-		va_end(ap);
-	}
-}
-
 #define DPRINTF(fmt, args...)	rlprintf(10, "%s: " fmt, __FUNCTION__, ##args)
-#endif
 
 MALLOC_DEFINE(M_DAHDI, "dahdi", "DAHDI interface data structures");
 
@@ -201,43 +179,6 @@
 	0x7bc7,	0x6a4e,	0x58d5,	0x495c,	0x3de3,	0x2c6a,	0x1ef1,	0x0f78
 };
 
-static int
-request_module(const char *fmt, ...)
-{
-	va_list ap;
-	char modname[128];
-	int fileid;
-
-	va_start(ap, fmt);
-	vsnprintf(modname, sizeof(modname), fmt, ap);
-	va_end(ap);
-
-	return kern_kldload(curthread, modname, &fileid);
-}
-
-/*
- * Concatenate src on the end of dst.  At most strlen(dst)+n+1 bytes
- * are written at dst (at most n+1 bytes being appended).  Return dst.
- */
-static char *
-strncat(char * __restrict dst, const char * __restrict src, size_t n)
-{
-	if (n != 0) {
-		char *d = dst;
-		const char *s = src;
-
-		while (*d != 0)
-			d++;
-		do {
-			if ((*d = *s++) == 0)
-				break;
-			d++;
-		} while (--n != 0);
-		*d = 0;
-	}
-	return (dst);
-}
-
 static struct cdev *dev_ctl = NULL;
 
 static struct cdevsw dahdi_devsw;
@@ -406,9 +347,6 @@
 {
 	return copyin(from, to, n);
 }
-
-#define try_module_get(m)	(1)
-#define module_put(m)		((void) (&m))
 
 #else /* !__FreeBSD__ */
 /* macro-oni for determining a unit (channel) number */

Modified: freebsd/trunk/drivers/dahdi/dahdi_dynamic.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi_dynamic.c?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi_dynamic.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi_dynamic.c Sun Jan 10 15:39:13 2010
@@ -28,32 +28,9 @@
 #include <sys/conf.h>
 #include <sys/ioccom.h>
 #include <sys/lock.h>
+#include <sys/module.h>
 #include <sys/mutex.h>
-#include <sys/syscallsubr.h>
 #include <sys/systm.h>
-#include <sys/taskqueue.h>
-
-#include <machine/stdarg.h>
-
-#if 0
-static void
-rlprintf(int pps, const char *fmt, ...)
-	__printflike(2, 3);
-
-static void
-rlprintf(int pps, const char *fmt, ...)
-{
-	va_list ap;
-	static struct timeval last_printf;
-	static int count;
-
-	if (ppsratecheck(&last_printf, &count, pps)) {
-		va_start(ap, fmt);
-		vprintf(fmt, ap);
-		va_end(ap);
-	}
-}
-#endif
 #else /* !__FreeBSD__ */
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -69,126 +46,6 @@
 #endif /* !__FreeBSD__ */
 
 #include <dahdi/kernel.h>
-
-#if defined(__FreeBSD__)
-#define LINUX_VERSION_CODE	0
-
-static int
-request_module(const char *fmt, ...)
-{
-	va_list ap;
-	char modname[128];
-	int fileid;
-
-	va_start(ap, fmt);
-	vsnprintf(modname, sizeof(modname), fmt, ap);
-	va_end(ap);
-
-	return kern_kldload(curthread, modname, &fileid);
-}
-
-struct tasklet_struct {
-	struct task task;
-
-	void (*func)(unsigned long);
-	unsigned long data;
-};
-
-static void
-tasklet_run(void *context, int pending)
-{
-	struct tasklet_struct *t = (struct tasklet_struct *) context;
-	t->func(t->data);
-}
-
-static void
-tasklet_init(struct tasklet_struct *t, void (*func)(unsigned long), unsigned long data)
-{
-	TASK_INIT(&t->task, 0, tasklet_run, t);
-	t->func = func;
-	t->data = data;
-}
-
-static void
-tasklet_hi_schedule(struct tasklet_struct *t)
-{
-	taskqueue_enqueue_fast(taskqueue_fast, &t->task);
-}
-
-static void
-tasklet_disable(struct tasklet_struct *t)
-{
-	// nothing to do
-}
-
-static void
-tasklet_kill(struct tasklet_struct *t)
-{
-	taskqueue_drain(taskqueue_fast, &t->task);
-}
-
-struct timer_list {
-	struct mtx mtx;
-	struct callout callout;
-
-	unsigned long expires;
-	void (*function)(unsigned long);
-	unsigned long data;
-};
-
-static void
-run_timer(void *arg)
-{
-	struct timer_list *t = (struct timer_list *) arg;
-	void (*function)(unsigned long);
-
-	mtx_lock_spin(&t->mtx);
-	if (callout_pending(&t->callout)) {
-		/* callout was reset */
-		mtx_unlock_spin(&t->mtx);
-		return;
-	}
-	if (!callout_active(&t->callout)) {
-		/* callout was stopped */
-		mtx_unlock_spin(&t->mtx);
-		return;
-	}
-	callout_deactivate(&t->callout);
-
-	function = t->function;
-	mtx_unlock_spin(&t->mtx);
-
-	function(t->data);
-}
-
-static void
-init_timer(struct timer_list *t)
-{
-	mtx_init(&t->mtx, "dahdi_dynamic lock", NULL, MTX_SPIN);
-	callout_init(&t->callout, CALLOUT_MPSAFE);
-	t->expires = 0;
-	t->function = 0;
-	t->data = 0;
-}
-
-static void
-mod_timer(struct timer_list *t, unsigned long expires)
-{
-	mtx_lock_spin(&t->mtx);
-	callout_reset(&t->callout, expires - jiffies, run_timer, t);
-	mtx_unlock_spin(&t->mtx);
-}
-
-static void
-del_timer(struct timer_list *t)
-{
-	mtx_lock_spin(&t->mtx);
-	callout_stop(&t->callout);
-	mtx_unlock_spin(&t->mtx);
-
-	mtx_destroy(&t->mtx);
-}
-#endif /* __FreeBSD__ */
 
 /*
  * Tasklets provide better system interactive response at the cost of the

Modified: freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi_dynamic_eth.c Sun Jan 10 15:39:13 2010
@@ -28,41 +28,9 @@
 #include <sys/conf.h>
 #include <sys/module.h>
 
-#include <machine/stdarg.h>
-
 #include "ng_dahdi_netdev.h"
 
 #define ETH_ALEN ETHER_ADDR_LEN
-#define LINUX_VERSION_CODE -1
-
-#define try_module_get(m)	(1)
-#define module_put(m)
-
-#if _BYTE_ORDER == _LITTLE_ENDIAN
-#define __constant_htons(x)	((uint16_t) (((uint16_t) (x)) << 8 | ((uint16_t) (x)) >> 8))
-#else
-#define __constant_htons(x)	(x)
-#endif
-
-#if 0
-static void
-rlprintf(int pps, const char *fmt, ...)
-	__printflike(2, 3);
-
-static void
-rlprintf(int pps, const char *fmt, ...)
-{
-	va_list ap;
-	static struct timeval last_printf;
-	static int count;
-
-	if (ppsratecheck(&last_printf, &count, pps)) {
-		va_start(ap, fmt);
-		vprintf(fmt, ap);
-		va_end(ap);
-	}
-}
-#endif
 #else /* !__FreeBSD__ */
 #include <linux/kernel.h>
 #include <linux/errno.h>

Modified: freebsd/trunk/drivers/dahdi/dahdi_dynamic_loc.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/dahdi_dynamic_loc.c?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/drivers/dahdi/dahdi_dynamic_loc.c (original)
+++ freebsd/trunk/drivers/dahdi/dahdi_dynamic_loc.c Sun Jan 10 15:39:13 2010
@@ -51,9 +51,6 @@
 #include <sys/conf.h>
 #include <sys/module.h>
 #include <sys/systm.h>
-
-#define try_module_get(m)	(1)
-#define module_put(m)
 #else /* !__FreeBSD__ */
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -287,6 +284,7 @@
 
 DEV_MODULE(dahdi_dynamic_loc, dahdi_dynamic_loc_modevent, NULL);
 MODULE_VERSION(dahdi_dynamic_loc, 1);
+MODULE_DEPEND(dahdi_dynamic_loc, dahdi, 1, 1, 1);
 MODULE_DEPEND(dahdi_dynamic_loc, dahdi_dynamic, 1, 1, 1);
 #else /* !__FreeBSD__ */
 module_init(ztdlocal_init);

Modified: freebsd/trunk/drivers/dahdi/wcb4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wcb4xxp/base.c?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/drivers/dahdi/wcb4xxp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wcb4xxp/base.c Sun Jan 10 15:39:13 2010
@@ -29,7 +29,6 @@
 #include <sys/systm.h>
 
 #include <machine/bus.h>
-#include <machine/stdarg.h>
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
@@ -46,6 +45,8 @@
 #define mmiowb()
 
 #define printk_ratelimit()	1
+
+#define DPRINTF(dev, fmt, args...)	device_rlprintf(10, dev, fmt, ##args)
 
 #else /* !__FreeBSD__ */
 #include <linux/autoconf.h>
@@ -204,27 +205,6 @@
  */
 
 #if defined(__FreeBSD__)
-static void
-device_rlprintf(int pps, device_t dev, const char *fmt, ...)
-	__printflike(3, 4);
-
-static void
-device_rlprintf(int pps, device_t dev, const char *fmt, ...)
-{
-	va_list ap;
-	static struct timeval last_printf;
-	static int count;
-
-	if (ppsratecheck(&last_printf, &count, pps)) {
-		va_start(ap, fmt);
-		device_print_prettyname(dev);
-		vprintf(fmt, ap);
-		va_end(ap);
-	}
-}
-
-#define DPRINTF(dev, fmt, args...)	device_rlprintf(10, dev, fmt, ##args)
-
 static inline unsigned char __pci_in8(struct b4xxp *b4, const unsigned int reg)
 {
         return bus_space_read_1(

Modified: freebsd/trunk/drivers/dahdi/wct4xxp/base.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/drivers/dahdi/wct4xxp/base.c?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/drivers/dahdi/wct4xxp/base.c (original)
+++ freebsd/trunk/drivers/dahdi/wct4xxp/base.c Sun Jan 10 15:39:13 2010
@@ -31,58 +31,14 @@
 #include <sys/module.h>
 #include <sys/rman.h>
 #include <sys/systm.h>
-#include <sys/time.h>
 
 #include <machine/bus.h>
-#include <machine/stdarg.h>
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
+#define DPRINTF(dev, fmt, args...)      device_rlprintf(20, dev, fmt, ##args)
+
 #define dahdi_msleep(msec)	DELAY((msec) * 1000)
-
-/*
- * Concatenate src on the end of dst.  At most strlen(dst)+n+1 bytes
- * are written at dst (at most n+1 bytes being appended).  Return dst.
- */
-static char *
-strncat(char * __restrict dst, const char * __restrict src, size_t n)
-{
-	if (n != 0) {
-		char *d = dst;
-		const char *s = src;
-
-		while (*d != 0)
-			d++;
-		do {
-			if ((*d = *s++) == 0)
-				break;
-			d++;
-		} while (--n != 0);
-		*d = 0;
-	}
-	return (dst);
-}
-
-static void
-device_rlprintf(int pps, device_t dev, const char *fmt, ...)
-	__printflike(3, 4);
-
-static void
-device_rlprintf(int pps, device_t dev, const char *fmt, ...)
-{
-	va_list ap;
-	static struct timeval last_printf;
-	static int count;
-
-	if (ppsratecheck(&last_printf, &count, pps)) {
-		va_start(ap, fmt);
-		device_print_prettyname(dev);
-		vprintf(fmt, ap);
-		va_end(ap);
-	}
-}
-
-#define DPRINTF(dev, fmt, args...)      device_rlprintf(20, dev, fmt, ##args)
 
 #else
 #include <linux/kernel.h>

Modified: freebsd/trunk/freebsd/dahdi/Makefile
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/Makefile?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/freebsd/dahdi/Makefile (original)
+++ freebsd/trunk/freebsd/dahdi/Makefile Sun Jan 10 15:39:13 2010
@@ -3,7 +3,7 @@
 .PATH: ${.CURDIR}/../../drivers/dahdi
 
 KMOD=		dahdi
-SRCS=		dahdi-base.c version.h
+SRCS=		dahdi-base.c bsd-compat.c version.h
 SRCS+=		device_if.h bus_if.h
 CLEANFILES=	version.h
 INCS=		user.h wctdm_user.h compat/types.h

Added: freebsd/trunk/freebsd/dahdi/bsd-compat.c
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/freebsd/dahdi/bsd-compat.c?view=auto&rev=7836
==============================================================================
--- freebsd/trunk/freebsd/dahdi/bsd-compat.c (added)
+++ freebsd/trunk/freebsd/dahdi/bsd-compat.c Sun Jan 10 15:39:13 2010
@@ -1,0 +1,201 @@
+/*
+ * Copyright (c) 2010 Max Khon <fjoe at FreeBSD.org>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $Id$
+ */
+
+#include <sys/types.h>
+#include <sys/bus.h>
+#include <sys/callout.h>
+#include <sys/syscallsubr.h>
+#include <sys/systm.h>
+#include <sys/taskqueue.h>
+
+#include <machine/stdarg.h>
+
+#include <dahdi/compat/bsd.h>
+
+static void
+tasklet_run(void *context, int pending)
+{
+	struct tasklet_struct *t = (struct tasklet_struct *) context;
+	t->func(t->data);
+}
+
+void
+tasklet_init(struct tasklet_struct *t, void (*func)(unsigned long), unsigned long data)
+{
+	TASK_INIT(&t->task, 0, tasklet_run, t);
+	t->func = func;
+	t->data = data;
+}
+
+void
+tasklet_hi_schedule(struct tasklet_struct *t)
+{
+	taskqueue_enqueue_fast(taskqueue_fast, &t->task);
+}
+
+void
+tasklet_disable(struct tasklet_struct *t)
+{
+	// nothing to do
+}
+
+void
+tasklet_kill(struct tasklet_struct *t)
+{
+	taskqueue_drain(taskqueue_fast, &t->task);
+}
+
+static void
+run_timer(void *arg)
+{
+	struct timer_list *t = (struct timer_list *) arg;
+	void (*function)(unsigned long);
+
+	mtx_lock_spin(&t->mtx);
+	if (callout_pending(&t->callout)) {
+		/* callout was reset */
+		mtx_unlock_spin(&t->mtx);
+		return;
+	}
+	if (!callout_active(&t->callout)) {
+		/* callout was stopped */
+		mtx_unlock_spin(&t->mtx);
+		return;
+	}
+	callout_deactivate(&t->callout);
+
+	function = t->function;
+	mtx_unlock_spin(&t->mtx);
+
+	function(t->data);
+}
+
+void
+init_timer(struct timer_list *t)
+{
+	mtx_init(&t->mtx, "dahdi timer lock", NULL, MTX_SPIN);
+	callout_init(&t->callout, CALLOUT_MPSAFE);
+	t->expires = 0;
+	t->function = 0;
+	t->data = 0;
+}
+
+void
+mod_timer(struct timer_list *t, unsigned long expires)
+{
+	mtx_lock_spin(&t->mtx);
+	callout_reset(&t->callout, expires - jiffies, run_timer, t);
+	mtx_unlock_spin(&t->mtx);
+}
+
+void
+add_timer(struct timer_list *t)
+{
+	mod_timer(t, t->expires);
+}
+
+void
+del_timer_sync(struct timer_list *t)
+{
+	mtx_lock_spin(&t->mtx);
+	callout_stop(&t->callout);
+	mtx_unlock_spin(&t->mtx);
+
+	mtx_destroy(&t->mtx);
+}
+
+void
+del_timer(struct timer_list *t)
+{
+	del_timer_sync(t);
+}
+
+int
+request_module(const char *fmt, ...)
+{
+	va_list ap;
+	char modname[128];
+	int fileid;
+
+	va_start(ap, fmt);
+	vsnprintf(modname, sizeof(modname), fmt, ap);
+	va_end(ap);
+
+	return kern_kldload(curthread, modname, &fileid);
+}
+
+void
+rlprintf(int pps, const char *fmt, ...)
+{
+	va_list ap;
+	static struct timeval last_printf;
+	static int count;
+
+	if (ppsratecheck(&last_printf, &count, pps)) {
+		va_start(ap, fmt);
+		vprintf(fmt, ap);
+		va_end(ap);
+	}
+}
+
+void
+device_rlprintf(int pps, device_t dev, const char *fmt, ...)
+{
+	va_list ap;
+	static struct timeval last_printf;
+	static int count;
+
+	if (ppsratecheck(&last_printf, &count, pps)) {
+		va_start(ap, fmt);
+		device_print_prettyname(dev);
+		vprintf(fmt, ap);
+		va_end(ap);
+	}
+}
+
+/*
+ * Concatenate src on the end of dst.  At most strlen(dst)+n+1 bytes
+ * are written at dst (at most n+1 bytes being appended).  Return dst.
+ */
+char *
+strncat(char * __restrict dst, const char * __restrict src, size_t n)
+{
+	if (n != 0) {
+		char *d = dst;
+		const char *s = src;
+
+		while (*d != 0)
+			d++;
+		do {
+			if ((*d = *s++) == 0)
+				break;
+			d++;
+		} while (--n != 0);
+		*d = 0;
+	}
+	return (dst);
+}

Propchange: freebsd/trunk/freebsd/dahdi/bsd-compat.c
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: freebsd/trunk/freebsd/dahdi/bsd-compat.c
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: freebsd/trunk/freebsd/dahdi/bsd-compat.c
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: freebsd/trunk/include/dahdi/compat/bsd.h
URL: http://svnview.digium.com/svn/dahdi/freebsd/trunk/include/dahdi/compat/bsd.h?view=diff&rev=7836&r1=7835&r2=7836
==============================================================================
--- freebsd/trunk/include/dahdi/compat/bsd.h (original)
+++ freebsd/trunk/include/dahdi/compat/bsd.h Sun Jan 10 15:39:13 2010
@@ -1,16 +1,19 @@
 #ifndef _DAHDI_COMPAT_BSD_H_
 #define _DAHDI_COMPAT_BSD_H_
 
+#include <sys/callout.h>
 #include <sys/lock.h>
 #include <sys/malloc.h>
 #include <sys/mutex.h>
 #include <sys/sx.h>
+#include <sys/taskqueue.h>
 #include <machine/atomic.h>
 
 struct module;
 
 #define EXPORT_SYMBOL(s)
 
+#define LINUX_VERSION_CODE	-1
 #define KERNEL_VERSION(x, y, z)	0
 
 #define copy_from_user(to, from, n)	(bcopy((from), (to), (n)), 0)
@@ -66,6 +69,14 @@
 #define atomic_add(v, p)	atomic_add_int(p, v)
 #define atomic_sub(v, p)	atomic_subtract_int(p, v)
 
+#define ATOMIC_INIT(v)		(v)
+
+#if _BYTE_ORDER == _LITTLE_ENDIAN
+#define __constant_htons(x)	((uint16_t) (((uint16_t) (x)) << 8 | ((uint16_t) (x)) >> 8))
+#else
+#define __constant_htons(x)	(x)
+#endif
+
 typedef struct mtx spinlock_t;
 
 #define DEFINE_SPINLOCK(name)				\
@@ -98,6 +109,43 @@
 	} while (0)
 #define write_unlock_irqrestore(rwlock, flags)		\
 	sx_xunlock(rwlock)
+
+struct tasklet_struct {
+	struct task task;
+
+	void (*func)(unsigned long);
+	unsigned long data;
+};
+
+void tasklet_init(struct tasklet_struct *t, void (*func)(unsigned long), unsigned long data);
+void tasklet_hi_schedule(struct tasklet_struct *t);
+void tasklet_disable(struct tasklet_struct *t);
+void tasklet_kill(struct tasklet_struct *t);
+
+struct timer_list {
+	struct mtx mtx;
+	struct callout callout;
+
+	unsigned long expires;
+	void (*function)(unsigned long);
+	unsigned long data;
+};
+
+void init_timer(struct timer_list *t);
+void mod_timer(struct timer_list *t, unsigned long expires);
+void add_timer(struct timer_list *t);
+void del_timer(struct timer_list *t);
+void del_timer_sync(struct timer_list *t);
+
+void rlprintf(int pps, const char *fmt, ...)
+	__printflike(2, 3);
+
+void
+device_rlprintf(int pps, device_t dev, const char *fmt, ...)
+	__printflike(3, 4);
+
+char *
+strncat(char * __restrict dst, const char * __restrict src, size_t n);
 
 #define WARN_ON(cond)					\
 	do {						\
@@ -176,9 +224,12 @@
 #define time_after(a, b)	((a) > (b))
 #define time_after_eq(a, b)	((a) >= (b))
 
+#define try_module_get(m)	(1)
+#define module_put(m)		((void) (m))
+#define THIS_MODULE		((struct module *) __FILE__)
+int request_module(const char *fmt, ...);
+
 #define DAHDI_IRQ_HANDLER(a)	static int a(void *dev_id)
-
-#define THIS_MODULE		((struct module *) __FILE__)
 
 #define PCI_ANY_ID (~0)
 




More information about the svn-commits mailing list