[asterisk-bugs] [DAHDI-linux 0013608]: dahdi-linux does not compile out of the box

Asterisk Bug Tracker noreply at bugs.digium.com
Mon Oct 6 03:08:05 CDT 2008


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=13608 
====================================================================== 
Reported By:                Nik Soggia
Assigned To:                
====================================================================== 
Project:                    DAHDI-linux
Issue ID:                   13608
Category:                   dahdi (the module)
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     feedback
====================================================================== 
Date Submitted:             2008-10-03 04:41 CDT
Last Modified:              2008-10-06 03:08 CDT
====================================================================== 
Summary:                    dahdi-linux does not compile out of the box
Description: 
$ tar zxf dahdi-linux-2.0.0.tar.gz 
$ cd dahdi-linux-2.0.0/
$ make DYNFS=1
make -C /lib/modules/2.6.26.5/build ARCH=i386
SUBDIRS=/tmp/dahdi-linux-2.0.0/drivers/dahdi
DAHDI_INCLUDE=/tmp/dahdi-linux-2.0.0/include DAHDI_MODULES_EXTRA=" "
HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
make[1]: Entering directory `/usr/src/linux-2.6.26.5'
  CC [M]  /tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.o
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c: In function
'dahdi_ppp_xmit':
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: implicit
declaration of function 'print_debug_writebuf'
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: 'outbuf'
undeclared (first use in this function)
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: (Each
undeclared identifier is reported only once
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:1810: error: for each
function it appears in.)
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c: In function
'dahdi_chan_ioctl':
/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c:5009: error: 'struct
dahdi_chan' has no member named 'ec'
make[2]: *** [/tmp/dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.o] Error 1
make[1]: *** [_module_/tmp/dahdi-linux-2.0.0/drivers/dahdi] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.26.5'
make: *** [modules] Error 2
====================================================================== 

---------------------------------------------------------------------- 
 (0093203) Nik Soggia (reporter) - 2008-10-06 03:08
 http://bugs.digium.com/view.php?id=13608#c93203 
---------------------------------------------------------------------- 
Imho, this can't be a duplicate of issue 0013542, these errors complain
about using three variables that really aren't declared (and not simply
ifdef'ed out).
I think that, since you include "dahdi/kernel.h" using angle brackets and
not double quotes, some old header file in /usr/include (note the leading
slash) is taking precedence over the "local" one and since it still
contains a dahdi_chan struct member called "ec", your compiler is happy.

Here I tried to compile a fresh svn co, then I defined CONFIG_DAHDI_NET in
drivers/dahdi/dahdi_config.h and tried to compile again (no difference).

$ svn co http://svn.digium.com/view/dahdi/linux/trunk/
svn: PROPFIND request failed on '/view/dahdi/linux/trunk'
svn: PROPFIND of '/view/dahdi/linux/trunk': 301 Moved
(http://svn.digium.com)
$ svn co http://svn.digium.com/svn/dahdi/linux/trunk dahdi-kernel
$ cd dahdi-linux
$ ls -la /usr/include/dahdi 
ls: cannot access /usr/include/dahdi: No such file or directory
$ grep -F '*ec;' ./include/dahdi/*
$ grep -F '*ec_current;' ./include/dahdi/*
./include/dahdi/kernel.h:	const struct dahdi_echocan *ec_current;
$ make | tee pass1
make -C /lib/modules/2.6.26.5/build ARCH=i386
SUBDIRS=/tmp/dahdi-linux/drivers/dahdi
DAHDI_INCLUDE=/tmp/dahdi-linux/include DAHDI_MODULES_EXTRA=" "
HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
make[1]: Entering directory `/usr/src/linux-2.6.26.5'
  CC [M]  /tmp/dahdi-linux/drivers/dahdi/dahdi-base.o
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function
'dahdi_ppp_xmit':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: implicit
declaration of function 'print_debug_writebuf'
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: 'outbuf'
undeclared (first use in this function)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: (Each undeclared
identifier is reported only once
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: for each function
it appears in.)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function
'dahdi_chan_ioctl':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:5014: error: 'struct
dahdi_chan' has no member named 'ec'
make[2]: *** [/tmp/dahdi-linux/drivers/dahdi/dahdi-base.o] Error 1
make[1]: *** [_module_/tmp/dahdi-linux/drivers/dahdi] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.26.5'
make: *** [modules] Error 2
$ echo '#define CONFIG_DAHDI_NET 1' >>drivers/dahdi/dahdi_config.h 
$ make | tee pass 2
make -C /lib/modules/2.6.26.5/build ARCH=i386
SUBDIRS=/tmp/dahdi-linux/drivers/dahdi
DAHDI_INCLUDE=/tmp/dahdi-linux/include DAHDI_MODULES_EXTRA=" "
HOTPLUG_FIRMWARE=yes modules DAHDI_BUILD_ALL=m
make[1]: Entering directory `/usr/src/linux-2.6.26.5'
  CC [M]  /tmp/dahdi-linux/drivers/dahdi/dahdi-base.o
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function
'dahdi_ppp_xmit':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: 'outbuf'
undeclared (first use in this function)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: (Each undeclared
identifier is reported only once
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:1810: error: for each function
it appears in.)
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c: In function
'dahdi_chan_ioctl':
/tmp/dahdi-linux/drivers/dahdi/dahdi-base.c:5014: error: 'struct
dahdi_chan' has no member named 'ec'
make[2]: *** [/tmp/dahdi-linux/drivers/dahdi/dahdi-base.o] Error 1
make[1]: *** [_module_/tmp/dahdi-linux/drivers/dahdi] Error 2
make[1]: Leaving directory `/usr/src/linux-2.6.26.5'
make: *** [modules] Error 2
$ cd ..
$ wget -q
http://downloads.digium.com/pub/telephony/dahdi-linux/dahdi-linux-2.0.0.tar.gz
$ tar zxf dahdi-linux-2.0.0.tar.gz
$ ls -la dahdi-linux*/drivers/dahdi/dahdi-base.c
-rw-r--r-- 1 dahdi users 228021 2008-09-28 08:43
dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c
-rw-r--r-- 1 dahdi users 228297 2008-10-06 09:29
dahdi-linux/drivers/dahdi/dahdi-base.c
$ diff -Naub dahdi-linux*/drivers/dahdi/dahdi-base.c
--- dahdi-linux-2.0.0/drivers/dahdi/dahdi-base.c	2008-09-28
08:43:51.000000000 +0200
+++ dahdi-linux/drivers/dahdi/dahdi-base.c	2008-10-06 09:29:23.000000000
+0200
@@ -1532,8 +1532,8 @@
 	if (res)
 		return res;
 
-	fasthdlc_init(&ms->rxhdlc, (chan->flags & DAHDI_FLAG_HDLC56) ?
FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
-	fasthdlc_init(&ms->txhdlc, (chan->flags & DAHDI_FLAG_HDLC56) ?
FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
+	fasthdlc_init(&ms->rxhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ?
FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
+	fasthdlc_init(&ms->txhdlc, (ms->flags & DAHDI_FLAG_HDLC56) ?
FASTHDLC_MODE_56 : FASTHDLC_MODE_64);
 	ms->infcs = PPP_INITFCS;
 
 	netif_start_queue(ztchan_to_dev(ms));
@@ -1637,7 +1637,7 @@
 	return kzalloc(sizeof(struct dahdi_hdlc), GFP_KERNEL);
 }
 
-static inline print_debug_writebuf(struct dahdi_chan* ss, struct sk_buff
*skb,
+static inline void print_debug_writebuf(struct dahdi_chan* ss, struct
sk_buff *skb,
 		int oldbuf)
 {
 #ifdef CONFIG_DAHDI_DEBUG
@@ -1711,7 +1711,7 @@
 		dev->trans_start = jiffies;
 		stats->tx_packets++;
 		stats->tx_bytes += ss->writen[oldbuf];
-		print_debug_writebuf(ss, skb, outbuf);
+		print_debug_writebuf(ss, skb, oldbuf);
 		retval = 0;
 		/* Free the SKB */
 		dev_kfree_skb_any(skb);
@@ -2042,7 +2042,7 @@
 
 #ifdef CONFIG_DAHDI_DEBUG
 	module_printk(KERN_NOTICE, "dahdi_chan_write(unit: %d, res: %d,
outwritebuf: %d amnt: %d\n",
-		      unit, chan->res, chan->outwritebuf, amnt);
+		      unit, res, chan->outwritebuf, amnt);
 #endif
 #if 0
  	if ((unit == 24) || (unit == 48) || (unit == 16) || (unit == 47)) {
@@ -3675,7 +3675,7 @@
 		if (chan->span->chans[x]->master == chan) {
 #ifdef CONFIG_DAHDI_DEBUG
 			module_printk(KERN_NOTICE, "Channel %s, slave to %s, last is %s, its
next will be %d\n",
-				      chan->span->chans[x].name, chan->name, last->name, x);
+				      chan->span->chans[x]->name, chan->name, last->name, x);
 #endif
 			last->nextslave = x;
 			last = chan->span->chans[x];
@@ -3966,7 +3966,7 @@
 			chans[ch.chan]->rxhooksig = DAHDI_RXSIG_INITIAL;
 		}
 #ifdef CONFIG_DAHDI_DEBUG
-		module_printk(KERN_NOTICE, "Configured channel %s, flags %04x, sig
%04x\n", chans[ch.chan]->name, chans[ch.chan]->flags,
chans[ch.chan]->sig);
+		module_printk(KERN_NOTICE, "Configured channel %s, flags %04lx, sig
%04x\n", chans[ch.chan]->name, chans[ch.chan]->flags,
chans[ch.chan]->sig);
 #endif
 		spin_unlock_irqrestore(&chans[ch.chan]->lock, flags);
 
@@ -4274,7 +4274,12 @@
 			return -EINVAL;
 		if (stack.bi.bufsize * stack.bi.numbufs > DAHDI_MAX_BUF_SPACE)
 			return -EINVAL;
-		chan->rxbufpolicy = stack.bi.rxbufpolicy & 0x1;
+		/* It does not make sense to allow user mode to change the
+		 * receive buffering policy.  DAHDI always provides received
+		 * buffers to upper layers immediately.  Transmission is
+		 * different since we might want to allow the kernel to build
+		 * up a buffer in order to prevent underruns from the
+		 * interrupt context. */
 		chan->txbufpolicy = stack.bi.txbufpolicy & 0x1;
 		if ((rv = dahdi_reallocbufs(chan,  stack.bi.bufsize,
stack.bi.numbufs)))
 			return (rv);
@@ -7060,7 +7065,7 @@
 		if (skb && (ms->flags & DAHDI_FLAG_NETDEV))
 #ifdef NEW_HDLC_INTERFACE
 		{
-#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,22)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
 			skb->mac.raw = skb->data;
 #else
 			skb_reset_mac_header(skb);
$ ### END OF LONG NOTE ### 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2008-10-06 03:08 Nik Soggia     Note Added: 0093203                          
======================================================================




More information about the asterisk-bugs mailing list