[Asterisk-cvs] zaptel zaptel.c,1.48,1.49

markster at lists.digium.com markster at lists.digium.com
Thu Nov 27 00:20:34 CST 2003


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv2227

Modified Files:
	zaptel.c 
Log Message:
Centralize compile stuff


Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- zaptel.c	21 Nov 2003 14:56:21 -0000	1.48
+++ zaptel.c	27 Nov 2003 06:46:57 -0000	1.49
@@ -57,6 +57,10 @@
 #include <linux/if_ppp.h>
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#define NEW_HDLC_INTERFACE
+#endif
+
 #define __ECHO_STATE_MUTE			(1 << 8)
 #define ECHO_STATE_IDLE				(0)
 #define ECHO_STATE_PRETRAINING		(1 | (__ECHO_STATE_MUTE))
@@ -1138,7 +1142,7 @@
 #endif
 
 #ifdef CONFIG_ZAPATA_NET
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 static int zt_net_open(struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
@@ -1151,6 +1155,8 @@
 #else
 static int zt_net_open(hdlc_device *hdlc)
 {
+	hdlc_device *hdlc = dev_to_hdlc(dev);
+	struct zt_chan *ms = hdlc_to_ztchan(hdlc);
 	int res;
 #endif
 	if (!ms) {
@@ -1183,7 +1189,7 @@
 	return 0;
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 static int zt_net_stop(struct net_device *dev)
 {
 	hdlc_device *hdlc = dev_to_hdlc(dev);
@@ -1193,7 +1199,7 @@
 #endif
 	struct zt_chan *ms = hdlc_to_ztchan(hdlc);
 	if (!ms) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 		printk("zt_net_stop: nothing??\n");
 		return 0;
 #else
@@ -1202,7 +1208,7 @@
 #endif
 	}
 	if (!(ms->flags & ZT_FLAG_NETDEV)) {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 		printk("zt_net_stop: %s is not a net device!\n", ms->name);
 		return 0;
 #else
@@ -1213,14 +1219,14 @@
 	/* Not much to do here.  Just deallocate the buffers */
 	zt_reallocbufs(ms, 0, 0);
 	MOD_DEC_USE_COUNT;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 	return 0;
 #else
 	return;
 #endif
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 /* kernel 2.4.20+ has introduced attach function, dunno what to do,
  just copy sources from dscc4 to be sure and ready for further mastering,
  NOOP right now (i.e. really a stub)  --byg */
@@ -1260,7 +1266,7 @@
 	return tmp;
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 static int zt_xmit(struct sk_buff *skb, struct net_device *dev)
 {
 	/* FIXME: this construction seems to be not very optimal for me but I could find nothing better at the moment (Friday, 10PM :( )  --byg */
@@ -1329,7 +1335,7 @@
 	return retval;
 }
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 static int zt_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 {
 	return hdlc_ioctl(dev, ifr, cmd);
@@ -2929,7 +2935,7 @@
 				chans[ch.chan]->hdlcnetdev->chan = chans[ch.chan];
 				chans[ch.chan]->hdlcnetdev->netdev.ioctl = zt_net_ioctl;
 				chans[ch.chan]->hdlcnetdev->netdev.netdev.do_ioctl = zt_net_ioctl;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 				chans[ch.chan]->hdlcnetdev->netdev.netdev.open = zt_net_open;
 				chans[ch.chan]->hdlcnetdev->netdev.netdev.stop = zt_net_stop;
 				chans[ch.chan]->hdlcnetdev->netdev.xmit = zt_xmit;
@@ -5372,7 +5378,7 @@
 			break;
 #ifdef CONFIG_ZAPATA_NET
 		if (skb && (ms->flags & ZT_FLAG_NETDEV))
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,20)
+#ifdef NEW_HDLC_INTERFACE
 		{
 			skb->mac.raw = skb->data;
 			skb->dev = &ms->hdlcnetdev->netdev.netdev;




More information about the svn-commits mailing list