[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/handhelds/apps/AccessPoint/kernel telos_ap.c, 1.9, 1.10

steve ayer ayer1 at users.sourceforge.net
Mon Jun 1 12:42:49 PDT 2009


Update of /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/apps/AccessPoint/kernel
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4560

Modified Files:
	telos_ap.c 
Log Message:

updated access to net_device priv field, which was cleaned up in
kernel 2.6.29 to a use a portable function over a direct void * field
reference.

tested.


Index: telos_ap.c
===================================================================
RCS file: /cvsroot/tinyos/tinyos-1.x/contrib/handhelds/apps/AccessPoint/kernel/telos_ap.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** telos_ap.c	21 Oct 2008 17:10:17 -0000	1.9
--- telos_ap.c	1 Jun 2009 19:42:46 -0000	1.10
***************
*** 457,461 ****
--- 457,465 ----
  telos_xmit(struct sk_buff *skb, struct net_device *dev)
  {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 	struct telos_ap *telos = (struct telos_ap*)(netdev_priv(dev));
+ #else
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
+ #endif
  	// printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
***************
*** 522,526 ****
--- 526,534 ----
  telos_close(struct net_device *dev)
  {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 	struct telos_ap *telos = (struct telos_ap*)(netdev_priv(dev));
+ #else
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
+ #endif
  	// printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
***************
*** 543,547 ****
--- 551,559 ----
  telos_open(struct net_device *dev)
  {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 	struct telos_ap *telos = (struct telos_ap*)(netdev_priv(dev));
+ #else
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
+ #endif
  //	printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
***************
*** 559,563 ****
--- 571,579 ----
  telos_change_mtu(struct net_device *dev, int new_mtu)
  {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 	struct telos_ap *telos = (struct telos_ap*)(netdev_priv(dev));
+ #else
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
+ #endif
  	// printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
***************
*** 575,580 ****
  telos_get_stats(struct net_device *dev)
  {
! 	static struct net_device_stats stats;
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
  	// printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
--- 591,600 ----
  telos_get_stats(struct net_device *dev)
  {
! #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
! 	struct telos_ap *telos = (struct telos_ap*)(netdev_priv(dev));
! #else
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
+ #endif
+ 	static struct net_device_stats stats;
  	// printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
***************
*** 598,602 ****
--- 618,626 ----
  telos_init(struct net_device *dev)
  {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 	struct telos_ap *telos = (struct telos_ap*)(netdev_priv(dev));
+ #else
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
+ #endif
  	// printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
***************
*** 610,614 ****
--- 634,642 ----
  telos_uninit(struct net_device *dev)
  {
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 	struct telos_ap *telos = (struct telos_ap*)(netdev_priv(dev));
+ #else
  	struct telos_ap *telos = (struct telos_ap*)(dev->priv);
+ #endif
  	// printk(KERN_WARNING "%s: %p\n", __FUNCTION__, telos);
  
***************
*** 700,704 ****
--- 728,736 ----
  			break;
  
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 		telos = (netdev_priv(dev));
+ #else
  		telos = dev->priv;
+ #endif
  		if (telos->tty)
  			continue;
***************
*** 729,734 ****
  			break;
  
  		telos = dev->priv;
! 
  		if (telos->tty)
  			continue;
--- 761,769 ----
  			break;
  
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 		telos = (netdev_priv(dev));
+ #else
  		telos = dev->priv;
! #endif
  		if (telos->tty)
  			continue;
***************
*** 761,767 ****
  		dev = telos_ap_devs[i];
  		if (score > 1) {
! 			telos = dev->priv;
! 			telos->flags &= (1 << TELOSF_INUSE);
! 			return telos;
  		}
  	}
--- 796,806 ----
  		dev = telos_ap_devs[i];
  		if (score > 1) {
! #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
! 		  telos = (netdev_priv(dev));
! #else
! 		  telos = dev->priv;
! #endif
! 		  telos->flags &= (1 << TELOSF_INUSE);
! 		  return telos;
  		}
  	}
***************
*** 772,781 ****
  
  	if (dev) {
! 		telos = dev->priv;
! 		if (test_bit(TELOSF_INUSE, &telos->flags)) {
! 			unregister_netdevice(dev);
! 			dev = NULL;
! 			telos_ap_devs[i] = NULL;
! 		}
  	}
  	
--- 811,824 ----
  
  	if (dev) {
! #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
! 	  telos = (netdev_priv(dev));
! #else
! 	  telos = dev->priv;
! #endif
! 	  if (test_bit(TELOSF_INUSE, &telos->flags)) {
! 	    unregister_netdevice(dev);
! 	    dev = NULL;
! 	    telos_ap_devs[i] = NULL;
! 	  }
  	}
  	
***************
*** 790,794 ****
--- 833,841 ----
  	}
  
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 	telos = (netdev_priv(dev));
+ #else
  	telos = dev->priv;
+ #endif
  
  	/* Initialize channel control data */
***************
*** 1117,1122 ****
  	case TCGETS:
  	case TCGETA:
  		return n_tty_ioctl(tty, file, cmd, arg);
! 
  	default:
  		return -ENOIOCTLCMD;
--- 1164,1172 ----
  	case TCGETS:
  	case TCGETA:
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)
+ 		return n_tty_ioctl_helper(tty, file, cmd, arg);
+ #else
  		return n_tty_ioctl(tty, file, cmd, arg);
! #endif
  	default:
  		return -ENOIOCTLCMD;
***************
*** 1215,1219 ****
--- 1265,1273 ----
  			if (!dev)
  				continue;
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 			telos = (netdev_priv(dev));
+ #else
  			telos = dev->priv;
+ #endif
  			spin_lock_bh(&telos->lock);
  			if (telos->tty) {
***************
*** 1232,1236 ****
--- 1286,1294 ----
  		telos_ap_devs[i] = NULL;
  
+ #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,28)		
+ 		telos = (netdev_priv(dev));
+ #else
  		telos = dev->priv;
+ #endif
  		if (telos->tty) {
  			printk(KERN_ERR "%s: tty discipline still running\n",



More information about the Tinyos-contrib-commits mailing list