summaryrefslogtreecommitdiff
path: root/zaptel.c
diff options
context:
space:
mode:
authormarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-11-27 06:46:57 +0000
committermarkster <markster@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2003-11-27 06:46:57 +0000
commit0976ff411e20f0a250a4900ca0596640c2860fdc (patch)
tree2747a5909e58ca33338e5181eaa2cdc16f630408 /zaptel.c
parent83cdd96c6b999f327aab0c8fbbf1a4eed7d36076 (diff)
Centralize compile stuff
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@285 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'zaptel.c')
-rwxr-xr-xzaptel.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/zaptel.c b/zaptel.c
index 0631ca5..2c63800 100755
--- a/zaptel.c
+++ b/zaptel.c
@@ -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 @@ char *zt_lboname(int x)
#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 @@ static int zt_net_open(struct net_device *dev)
#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 @@ static int zt_net_open(hdlc_device *hdlc)
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 @@ static void zt_net_close(hdlc_device *hdlc)
#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 @@ static void zt_net_close(hdlc_device *hdlc)
#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 @@ static void zt_net_close(hdlc_device *hdlc)
/* 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 @@ static struct zt_hdlc *zt_hdlc_alloc(void)
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 @@ static int zt_xmit(hdlc_device *hdlc, struct sk_buff *skb)
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 @@ static int zt_ctl_ioctl(struct inode *inode, struct file *file, unsigned int cmd
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 @@ out in the later versions, and is put back now. */
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;