Commit 9484dc74 authored by yuan linyu's avatar yuan linyu Committed by David S. Miller

tun: delete original tun_get() and rename __tun_get() to tun_get()

it seems no need to keep tun_get() and __tun_get() at same time.
Signed-off-by: default avataryuan linyu <Linyu.Yuan@alcatel-sbell.com.cn>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ba581f77
...@@ -774,7 +774,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file, ...@@ -774,7 +774,7 @@ static int tun_attach(struct tun_struct *tun, struct file *file,
return err; return err;
} }
static struct tun_struct *__tun_get(struct tun_file *tfile) static struct tun_struct *tun_get(struct tun_file *tfile)
{ {
struct tun_struct *tun; struct tun_struct *tun;
...@@ -787,11 +787,6 @@ static struct tun_struct *__tun_get(struct tun_file *tfile) ...@@ -787,11 +787,6 @@ static struct tun_struct *__tun_get(struct tun_file *tfile)
return tun; return tun;
} }
static struct tun_struct *tun_get(struct file *file)
{
return __tun_get(file->private_data);
}
static void tun_put(struct tun_struct *tun) static void tun_put(struct tun_struct *tun)
{ {
dev_put(tun->dev); dev_put(tun->dev);
...@@ -1250,7 +1245,7 @@ static void tun_net_init(struct net_device *dev) ...@@ -1250,7 +1245,7 @@ static void tun_net_init(struct net_device *dev)
static unsigned int tun_chr_poll(struct file *file, poll_table *wait) static unsigned int tun_chr_poll(struct file *file, poll_table *wait)
{ {
struct tun_file *tfile = file->private_data; struct tun_file *tfile = file->private_data;
struct tun_struct *tun = __tun_get(tfile); struct tun_struct *tun = tun_get(tfile);
struct sock *sk; struct sock *sk;
unsigned int mask = 0; unsigned int mask = 0;
...@@ -1784,8 +1779,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile, ...@@ -1784,8 +1779,8 @@ static ssize_t tun_get_user(struct tun_struct *tun, struct tun_file *tfile,
static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from) static ssize_t tun_chr_write_iter(struct kiocb *iocb, struct iov_iter *from)
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct tun_struct *tun = tun_get(file);
struct tun_file *tfile = file->private_data; struct tun_file *tfile = file->private_data;
struct tun_struct *tun = tun_get(tfile);
ssize_t result; ssize_t result;
if (!tun) if (!tun)
...@@ -1969,7 +1964,7 @@ static ssize_t tun_chr_read_iter(struct kiocb *iocb, struct iov_iter *to) ...@@ -1969,7 +1964,7 @@ static ssize_t tun_chr_read_iter(struct kiocb *iocb, struct iov_iter *to)
{ {
struct file *file = iocb->ki_filp; struct file *file = iocb->ki_filp;
struct tun_file *tfile = file->private_data; struct tun_file *tfile = file->private_data;
struct tun_struct *tun = __tun_get(tfile); struct tun_struct *tun = tun_get(tfile);
ssize_t len = iov_iter_count(to), ret; ssize_t len = iov_iter_count(to), ret;
if (!tun) if (!tun)
...@@ -2046,7 +2041,7 @@ static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) ...@@ -2046,7 +2041,7 @@ static int tun_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len)
{ {
int ret; int ret;
struct tun_file *tfile = container_of(sock, struct tun_file, socket); struct tun_file *tfile = container_of(sock, struct tun_file, socket);
struct tun_struct *tun = __tun_get(tfile); struct tun_struct *tun = tun_get(tfile);
if (!tun) if (!tun)
return -EBADFD; return -EBADFD;
...@@ -2062,7 +2057,7 @@ static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len, ...@@ -2062,7 +2057,7 @@ static int tun_recvmsg(struct socket *sock, struct msghdr *m, size_t total_len,
int flags) int flags)
{ {
struct tun_file *tfile = container_of(sock, struct tun_file, socket); struct tun_file *tfile = container_of(sock, struct tun_file, socket);
struct tun_struct *tun = __tun_get(tfile); struct tun_struct *tun = tun_get(tfile);
int ret; int ret;
if (!tun) if (!tun)
...@@ -2094,7 +2089,7 @@ static int tun_peek_len(struct socket *sock) ...@@ -2094,7 +2089,7 @@ static int tun_peek_len(struct socket *sock)
struct tun_struct *tun; struct tun_struct *tun;
int ret = 0; int ret = 0;
tun = __tun_get(tfile); tun = tun_get(tfile);
if (!tun) if (!tun)
return 0; return 0;
...@@ -2490,7 +2485,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd, ...@@ -2490,7 +2485,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
ret = 0; ret = 0;
rtnl_lock(); rtnl_lock();
tun = __tun_get(tfile); tun = tun_get(tfile);
if (cmd == TUNSETIFF) { if (cmd == TUNSETIFF) {
ret = -EEXIST; ret = -EEXIST;
if (tun) if (tun)
...@@ -2837,15 +2832,16 @@ static int tun_chr_close(struct inode *inode, struct file *file) ...@@ -2837,15 +2832,16 @@ static int tun_chr_close(struct inode *inode, struct file *file)
} }
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static void tun_chr_show_fdinfo(struct seq_file *m, struct file *f) static void tun_chr_show_fdinfo(struct seq_file *m, struct file *file)
{ {
struct tun_file *tfile = file->private_data;
struct tun_struct *tun; struct tun_struct *tun;
struct ifreq ifr; struct ifreq ifr;
memset(&ifr, 0, sizeof(ifr)); memset(&ifr, 0, sizeof(ifr));
rtnl_lock(); rtnl_lock();
tun = tun_get(f); tun = tun_get(tfile);
if (tun) if (tun)
tun_get_iff(current->nsproxy->net_ns, tun, &ifr); tun_get_iff(current->nsproxy->net_ns, tun, &ifr);
rtnl_unlock(); rtnl_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment