From 80f25d9ed6ea4af860f3127bad4cf43bbd258b5c Mon Sep 17 00:00:00 2001 From: markster Date: Tue, 6 Jan 2004 13:26:44 +0000 Subject: Clean build on Linux 2.6, will need lots of testing git-svn-id: http://svn.digium.com/svn/zaptel/trunk@292 5390a7c7-147a-4af0-8ec9-7488f05a26cb --- ztd-eth.c | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) (limited to 'ztd-eth.c') diff --git a/ztd-eth.c b/ztd-eth.c index fd602e5..65fcdc9 100755 --- a/ztd-eth.c +++ b/ztd-eth.c @@ -64,7 +64,7 @@ static struct ztdeth { struct zt_span *ztdeth_getspan(unsigned char *addr, unsigned short subaddr) { - long flags; + unsigned long flags; struct ztdeth *z; struct zt_span *span = NULL; spin_lock_irqsave(&zlock, flags); @@ -99,7 +99,7 @@ static int ztdeth_notifier(struct notifier_block *block, unsigned long event, vo { struct net_device *dev = ptr; struct ztdeth *z; - long flags; + unsigned long flags; switch(event) { case NETDEV_GOING_DOWN: case NETDEV_DOWN: @@ -133,7 +133,7 @@ static int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen) struct ztdeth *z; struct sk_buff *skb; struct ztdeth_header *zh; - long flags; + unsigned long flags; spin_lock_irqsave(&zlock, flags); z = pvt; @@ -164,11 +164,9 @@ static int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen) } static struct packet_type ztdeth_ptype = { - __constant_htons(ETH_P_ZTDETH), /* Protocol */ - NULL, /* Device (NULL = wildcard) */ - ztdeth_rcv, /* Receiver */ - NULL, /* Data */ - NULL /* Next */ + type: __constant_htons(ETH_P_ZTDETH), /* Protocol */ + dev: NULL, /* Device (NULL = wildcard) */ + func: ztdeth_rcv, /* Receiver */ }; static int digit2int(char d) @@ -231,7 +229,7 @@ static int hex2int(char *s) static void ztdeth_destroy(void *pvt) { struct ztdeth *z = pvt; - long flags; + unsigned long flags; struct ztdeth *prev=NULL, *cur; spin_lock_irqsave(&zlock, flags); cur = zdevs; @@ -255,7 +253,7 @@ static void *ztdeth_create(struct zt_span *span, char *addr) char src[256]; char tmp[256], *tmp2, *tmp3; int res,x; - long flags; + unsigned long flags; z = kmalloc(sizeof(struct ztdeth), GFP_KERNEL); if (z) { @@ -264,27 +262,32 @@ static void *ztdeth_create(struct zt_span *span, char *addr) /* Address should be /[/subaddr] */ strncpy(tmp, addr, sizeof(tmp) - 1); - tmp2 = strtok(tmp, "/"); + tmp2 = strchr(tmp, '/'); if (tmp2) { - strncpy(z->ethdev, tmp2, sizeof(z->ethdev) - 1); + *tmp2 = '\0'; + tmp2++; + strncpy(z->ethdev, tmp, sizeof(z->ethdev) - 1); } else { printk("Invalid TDMoE address (no device) '%s'\n", addr); kfree(z); return NULL; } - tmp2 = strtok(NULL, "/"); if (tmp2) { /* We don't have SSCANF :( Gotta do this the hard way */ - tmp3 = strtok(tmp2, ":"); + tmp3 = strchr(tmp2, ':'); for (x=0;x<6;x++) { - if (tmp3) { - res = hex2int(tmp3); + if (tmp2) { + if (tmp3) { + *tmp3 = '\0'; + *tmp3++; + } + res = hex2int(tmp2); if (res < 0) break; z->addr[x] = res & 0xff; } else break; - tmp3 = strtok(NULL, ":"); + tmp2 = tmp3; } if (x != 6) { printk("TDMoE: Invalid MAC address in: %s\n", addr); -- cgit v1.2.3