aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/tun.c
diff options
context:
space:
mode:
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 329d9fe..20db308 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)
static void tun_net_init(struct net_device *dev)
{
struct tun_struct *tun = netdev_priv(dev);
-
+
switch (tun->flags & TUN_TYPE_MASK) {
case TUN_TUN_DEV:
/* Point-to-Point TUN Device */
@@ -186,7 +186,7 @@ static void tun_net_init(struct net_device *dev)
dev->mtu = 1500;
/* Zero header length */
- dev->type = ARPHRD_NONE;
+ dev->type = ARPHRD_NONE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP | IFF_MULTICAST;
dev->tx_queue_len = TUN_READQ_SIZE; /* We prefer our own queue length */
break;
@@ -206,7 +206,7 @@ static void tun_net_init(struct net_device *dev)
/* Poll */
static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
-{
+{
struct tun_struct *tun = file->private_data;
unsigned int mask = POLLOUT | POLLWRNORM;
@@ -216,7 +216,7 @@ static unsigned int tun_chr_poll(struct file *file, poll_table * wait)
DBG(KERN_INFO "%s: tun_chr_poll\n", tun->dev->name);
poll_wait(file, &tun->read_wait, wait);
-
+
if (!skb_queue_empty(&tun->readq))
mask |= POLLIN | POLLRDNORM;
@@ -240,7 +240,7 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV)
align = NET_IP_ALIGN;
-
+
if (!(skb = alloc_skb(len + align, GFP_KERNEL))) {
tun->stats.rx_dropped++;
return -ENOMEM;
@@ -267,29 +267,29 @@ static __inline__ ssize_t tun_get_user(struct tun_struct *tun, struct iovec *iv,
if (tun->flags & TUN_NOCHECKSUM)
skb->ip_summed = CHECKSUM_UNNECESSARY;
-
+
netif_rx_ni(skb);
tun->dev->last_rx = jiffies;
-
+
tun->stats.rx_packets++;
tun->stats.rx_bytes += len;
return count;
-}
+}
static inline size_t iov_total(const struct iovec *iv, unsigned long count)
{
unsigned long i;
size_t len;
- for (i = 0, len = 0; i < count; i++)
+ for (i = 0, len = 0; i < count; i++)
len += iv[i].iov_len;
return len;
}
/* Writev */
-static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv,
+static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv,
unsigned long count, loff_t *pos)
{
struct tun_struct *tun = file->private_data;
@@ -303,7 +303,7 @@ static ssize_t tun_chr_writev(struct file * file, const struct iovec *iv,
}
/* Write */
-static ssize_t tun_chr_write(struct file * file, const char __user * buf,
+static ssize_t tun_chr_write(struct file * file, const char __user * buf,
size_t count, loff_t *pos)
{
struct iovec iv = { (void __user *) buf, count };
@@ -326,11 +326,11 @@ static __inline__ ssize_t tun_put_user(struct tun_struct *tun,
/* Packet will be striped */
pi.flags |= TUN_PKT_STRIP;
}
-
+
if (memcpy_toiovec(iv, (void *) &pi, sizeof(pi)))
return -EFAULT;
total += sizeof(pi);
- }
+ }
len = min_t(int, skb->len, len);
@@ -427,7 +427,7 @@ static ssize_t tun_chr_readv(struct file *file, const struct iovec *iv,
}
/* Read */
-static ssize_t tun_chr_read(struct file * file, char __user * buf,
+static ssize_t tun_chr_read(struct file * file, char __user * buf,
size_t count, loff_t *pos)
{
struct iovec iv = { buf, count };
@@ -480,8 +480,8 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
if (tun->owner != -1 &&
current->euid != tun->owner && !capable(CAP_NET_ADMIN))
return -EPERM;
- }
- else if (__dev_get_by_name(ifr->ifr_name))
+ }
+ else if (__dev_get_by_name(ifr->ifr_name))
return -EINVAL;
else {
char *name;
@@ -501,9 +501,9 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
/* TAP device */
flags |= TUN_TAP_DEV;
name = "tap%d";
- } else
+ } else
goto failed;
-
+
if (*ifr->ifr_name)
name = ifr->ifr_name;
@@ -533,7 +533,7 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
err = register_netdevice(tun->dev);
if (err < 0)
goto err_free_dev;
-
+
list_add(&tun->list, &tun_dev_list);
}
@@ -557,7 +557,7 @@ static int tun_set_iff(struct file *file, struct ifreq *ifr)
return err;
}
-static int tun_chr_ioctl(struct inode *inode, struct file *file,
+static int tun_chr_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
struct tun_struct *tun = file->private_data;
@@ -711,14 +711,14 @@ static int tun_chr_fasync(int fd, struct file *file, int on)
DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on);
if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0)
- return ret;
-
+ return ret;
+
if (on) {
ret = f_setown(file, current->pid, 0);
if (ret)
return ret;
tun->flags |= TUN_FASYNC;
- } else
+ } else
tun->flags &= ~TUN_FASYNC;
return 0;
@@ -762,7 +762,7 @@ static int tun_chr_close(struct inode *inode, struct file *file)
}
static struct file_operations tun_fops = {
- .owner = THIS_MODULE,
+ .owner = THIS_MODULE,
.llseek = no_llseek,
.read = tun_chr_read,
.readv = tun_chr_readv,
@@ -772,7 +772,7 @@ static struct file_operations tun_fops = {
.ioctl = tun_chr_ioctl,
.open = tun_chr_open,
.release = tun_chr_close,
- .fasync = tun_chr_fasync
+ .fasync = tun_chr_fasync
};
static struct miscdevice tun_miscdev = {
@@ -883,7 +883,7 @@ static void tun_cleanup(void)
{
struct tun_struct *tun, *nxt;
- misc_deregister(&tun_miscdev);
+ misc_deregister(&tun_miscdev);
rtnl_lock();
list_for_each_entry_safe(tun, nxt, &tun_dev_list, list) {
@@ -891,7 +891,7 @@ static void tun_cleanup(void)
unregister_netdevice(tun->dev);
}
rtnl_unlock();
-
+
}
module_init(tun_init);