aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-13 13:24:59 -0400
commit6aa20a2235535605db6d6d2bd850298b2fe7f31e (patch)
treedf0b855043407b831d57f2f2c271f8aab48444f4 /drivers/net/tun.c
parent7a291083225af6e22ffaa46b3d91cfc1a1ccaab4 (diff)
drivers/net: Trim trailing whitespace
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/tun.c')
-rw-r--r--drivers/net/tun.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 329d9feb9b89..20db30891db0 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -177,7 +177,7 @@ static struct net_device_stats *tun_net_stats(struct net_device *dev)
177static void tun_net_init(struct net_device *dev) 177static void tun_net_init(struct net_device *dev)
178{ 178{
179 struct tun_struct *tun = netdev_priv(dev); 179 struct tun_struct *tun = netdev_priv(dev);
180 180
181 switch (tun->flags & TUN_TYPE_MASK) { 181 switch (tun->flags & TUN_TYPE_MASK) {
182 case TUN_TUN_DEV: 182 case TUN_TUN_DEV:
183 /* Point-to-Point TUN Device */ 183 /* Point-to-Point TUN Device */
@@ -186,7 +186,7 @@ static void tun_net_init(struct net_device *dev)
186 dev->mtu = 1500; 186 dev->mtu = 1500;
187 187
188 /* Zero header length */ 188 /* Zero header length */
189 dev->type = ARPHRD_NONE; 189 dev->type = ARPHRD_NONE;
190 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST; 190 dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
191 dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */ 191 dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
192 break; 192 break;
@@ -206,7 +206,7 @@ static void tun_net_init(struct net_device *dev)
206 206
207/* Poll */ 207/* Poll */
208static unsigned int tun_chr_poll(struct file *file, poll_table * wait) 208static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
209{ 209{
210 struct tun_struct *tun = file->private_data; 210 struct tun_struct *tun = file->private_data;
211 unsigned int mask = POLLOUT | POLLWRNORM; 211 unsigned int mask = POLLOUT | POLLWRNORM;
212 212
@@ -216,7 +216,7 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
216 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name); 216 DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name);
217 217
218 poll_wait(file, &tun->read_wait, wait); 218 poll_wait(file, &tun->read_wait, wait);
219 219
220 if (!skb_queue_empty(&tun->readq)) 220 if (!skb_queue_empty(&tun->readq))
221 mask |= POLLIN | POLLRDNORM; 221 mask |= POLLIN | POLLRDNORM;
222 222
@@ -240,7 +240,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
240 240
241 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) 241 if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV)
242 align = NET_IP_ALIGN; 242 align = NET_IP_ALIGN;
243 243
244 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) { 244 if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
245 tun->stats.rx_dropped++; 245 tun->stats.rx_dropped++;
246 return -ENOMEM; 246 return -ENOMEM;
@@ -267,29 +267,29 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
267 267
268 if (tun->flags & TUN_NOCHECKSUM) 268 if (tun->flags & TUN_NOCHECKSUM)
269 skb->ip_summed = CHECKSUM_UNNECESSARY; 269 skb->ip_summed = CHECKSUM_UNNECESSARY;
270 270
271 netif_rx_ni(skb); 271 netif_rx_ni(skb);
272 tun->dev->last_rx = jiffies; 272 tun->dev->last_rx = jiffies;
273 273
274 tun->stats.rx_packets++; 274 tun->stats.rx_packets++;
275 tun->stats.rx_bytes += len; 275 tun->stats.rx_bytes += len;
276 276
277 return count; 277 return count;
278} 278}
279 279
280static inline size_t iov_total(const struct iovec *iv, unsigned long count) 280static inline size_t iov_total(const struct iovec *iv, unsigned long count)
281{ 281{
282 unsigned long i; 282 unsigned long i;
283 size_t len; 283 size_t len;
284 284
285 for (i = 0, len = 0; i < count; i++) 285 for (i = 0, len = 0; i < count; i++)
286 len += iv[i].iov_len; 286 len += iv[i].iov_len;
287 287
288 return len; 288 return len;
289} 289}
290 290
291/* Writev */ 291/* Writev */
292static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv, 292static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv,
293 unsigned long count, loff_t *pos) 293 unsigned long count, loff_t *pos)
294{ 294{
295 struct tun_struct *tun = file->private_data; 295 struct tun_struct *tun = file->private_data;
@@ -303,7 +303,7 @@ static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv,
303} 303}
304 304
305/* Write */ 305/* Write */
306static ssize_t tun_chr_write(struct file * file, const char __user * buf, 306static ssize_t tun_chr_write(struct file * file, const char __user * buf,
307 size_t count, loff_t *pos) 307 size_t count, loff_t *pos)
308{ 308{
309 struct iovec iv = { (void __user *) buf, count }; 309 struct iovec iv = { (void __user *) buf, count };
@@ -326,11 +326,11 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
326 /* Packet will be striped */ 326 /* Packet will be striped */
327 pi.flags |= TUN_PKT_STRIP; 327 pi.flags |= TUN_PKT_STRIP;
328 } 328 }
329 329
330 if (memcpy_toiovec(iv, (void *) &pi, sizeof(pi))) 330 if (memcpy_toiovec(iv, (void *) &pi, sizeof(pi)))
331 return -EFAULT; 331 return -EFAULT;
332 total += sizeof(pi); 332 total += sizeof(pi);
333 } 333 }
334 334
335 len = min_t(int, skb->len, len); 335 len = min_t(int, skb->len, len);
336 336
@@ -427,7 +427,7 @@ static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv,
427} 427}
428 428
429/* Read */ 429/* Read */
430static ssize_t tun_chr_read(struct file * file, char __user * buf, 430static ssize_t tun_chr_read(struct file * file, char __user * buf,
431 size_t count, loff_t *pos) 431 size_t count, loff_t *pos)
432{ 432{
433 struct iovec iv = { buf, count }; 433 struct iovec iv = { buf, count };
@@ -480,8 +480,8 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
480 if (tun->owner != -1 && 480 if (tun->owner != -1 &&
481 current->euid != tun->owner && !capable(CAP_NET_ADMIN)) 481 current->euid != tun->owner && !capable(CAP_NET_ADMIN))
482 return -EPERM; 482 return -EPERM;
483 } 483 }
484 else if (__dev_get_by_name(ifr->ifr_name)) 484 else if (__dev_get_by_name(ifr->ifr_name))
485 return -EINVAL; 485 return -EINVAL;
486 else { 486 else {
487 char *name; 487 char *name;
@@ -501,9 +501,9 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
501 /* TAP device */ 501 /* TAP device */
502 flags |= TUN_TAP_DEV; 502 flags |= TUN_TAP_DEV;
503 name = "tap%d"; 503 name = "tap%d";
504 } else 504 } else
505 goto failed; 505 goto failed;
506 506
507 if (*ifr->ifr_name) 507 if (*ifr->ifr_name)
508 name = ifr->ifr_name; 508 name = ifr->ifr_name;
509 509
@@ -533,7 +533,7 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
533 err = register_netdevice(tun->dev); 533 err = register_netdevice(tun->dev);
534 if (err < 0) 534 if (err < 0)
535 goto err_free_dev; 535 goto err_free_dev;
536 536
537 list_add(&tun->list, &tun_dev_list); 537 list_add(&tun->list, &tun_dev_list);
538 } 538 }
539 539
@@ -557,7 +557,7 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
557 return err; 557 return err;
558} 558}
559 559
560static int tun_chr_ioctl(struct inode *inode, struct file *file, 560static int tun_chr_ioctl(struct inode *inode, struct file *file,
561 unsigned int cmd, unsigned long arg) 561 unsigned int cmd, unsigned long arg)
562{ 562{
563 struct tun_struct *tun = file->private_data; 563 struct tun_struct *tun = file->private_data;
@@ -711,14 +711,14 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
711 DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on); 711 DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on);
712 712
713 if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0) 713 if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0)
714 return ret; 714 return ret;
715 715
716 if (on) { 716 if (on) {
717 ret = f_setown(file, current->pid, 0); 717 ret = f_setown(file, current->pid, 0);
718 if (ret) 718 if (ret)
719 return ret; 719 return ret;
720 tun->flags |= TUN_FASYNC; 720 tun->flags |= TUN_FASYNC;
721 } else 721 } else
722 tun->flags &= ~TUN_FASYNC; 722 tun->flags &= ~TUN_FASYNC;
723 723
724 return 0; 724 return 0;
@@ -762,7 +762,7 @@ static int tun_chr_close(struct inode *inode, struct file *file)
762} 762}
763 763
764static struct file_operations tun_fops = { 764static struct file_operations tun_fops = {
765 .owner = THIS_MODULE, 765 .owner = THIS_MODULE,
766 .llseek = no_llseek, 766 .llseek = no_llseek,
767 .read = tun_chr_read, 767 .read = tun_chr_read,
768 .readv = tun_chr_readv, 768 .readv = tun_chr_readv,
@@ -772,7 +772,7 @@ static struct file_operations tun_fops = {
772 .ioctl = tun_chr_ioctl, 772 .ioctl = tun_chr_ioctl,
773 .open = tun_chr_open, 773 .open = tun_chr_open,
774 .release = tun_chr_close, 774 .release = tun_chr_close,
775 .fasync = tun_chr_fasync 775 .fasync = tun_chr_fasync
776}; 776};
777 777
778static struct miscdevice tun_miscdev = { 778static struct miscdevice tun_miscdev = {
@@ -883,7 +883,7 @@ static void tun_cleanup(void)
883{ 883{
884 struct tun_struct *tun, *nxt; 884 struct tun_struct *tun, *nxt;
885 885
886 misc_deregister(&tun_miscdev); 886 misc_deregister(&tun_miscdev);
887 887
888 rtnl_lock(); 888 rtnl_lock();
889 list_for_each_entry_safe(tun, nxt, &tun_dev_list, list) { 889 list_for_each_entry_safe(tun, nxt, &tun_dev_list, list) {
@@ -891,7 +891,7 @@ static void tun_cleanup(void)
891 unregister_netdevice(tun->dev); 891 unregister_netdevice(tun->dev);
892 } 892 }
893 rtnl_unlock(); 893 rtnl_unlock();
894 894
895} 895}
896 896
897module_init(tun_init); 897module_init(tun_init);