diff options
author | Matthew Wilcox <matthew@wil.cx> | 2005-03-31 06:25:26 -0800 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2005-03-31 06:25:26 -0800 |
commit | 28a60e50ba50594a870e47784cf845142c5ed661 (patch) | |
tree | 5a35896439bcef5c6c43a504c273bcf6d1842618 | |
parent | 1f2ad0e4a5499c03409dda5980a7c1bc48ac6aaa (diff) | |
download | history-28a60e50ba50594a870e47784cf845142c5ed661.tar.gz |
[NET]: Remove i_sock
Remove i_sock from struct inode. Also remove some checks for SOCKET_I()
returning NULL -- it can never return NULL for a valid inode.
Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | fs/inode.c | 1 | ||||
-rw-r--r-- | include/linux/fs.h | 1 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 5 | ||||
-rw-r--r-- | net/socket.c | 5 | ||||
-rw-r--r-- | net/unix/garbage.c | 2 |
5 files changed, 5 insertions, 9 deletions
diff --git a/fs/inode.c b/fs/inode.c index 90025a39a789f5..af8fd78d2099a0 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -118,7 +118,6 @@ static struct inode *alloc_inode(struct super_block *sb) inode->i_blkbits = sb->s_blocksize_bits; inode->i_flags = 0; atomic_set(&inode->i_count, 1); - inode->i_sock = 0; inode->i_op = &empty_iops; inode->i_fop = &empty_fops; inode->i_nlink = 1; diff --git a/include/linux/fs.h b/include/linux/fs.h index 723f41b51cedb4..5df687d940fa11 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -445,7 +445,6 @@ struct inode { unsigned long i_version; unsigned long i_blocks; unsigned short i_bytes; - unsigned char i_sock; spinlock_t i_lock; /* i_blocks, i_bytes, maybe i_size */ struct semaphore i_sem; struct rw_semaphore i_alloc_sem; diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 1d5089f92a5121..1d5905c90cd4bd 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -562,13 +562,12 @@ static struct sock *netlink_getsockbypid(struct sock *ssk, u32 pid) struct sock *netlink_getsockbyfilp(struct file *filp) { struct inode *inode = filp->f_dentry->d_inode; - struct socket *socket; struct sock *sock; - if (!inode->i_sock || !(socket = SOCKET_I(inode))) + if (!S_ISSOCK(inode->i_mode)) return ERR_PTR(-ENOTSOCK); - sock = socket->sk; + sock = SOCKET_I(inode)->sk; if (sock->sk_family != AF_NETLINK) return ERR_PTR(-EINVAL); diff --git a/net/socket.c b/net/socket.c index f2391d68fad3b4..2cd44990d8d3da 100644 --- a/net/socket.c +++ b/net/socket.c @@ -437,13 +437,13 @@ struct socket *sockfd_lookup(int fd, int *err) } inode = file->f_dentry->d_inode; - if (!inode->i_sock || !(sock = SOCKET_I(inode))) - { + if (!S_ISSOCK(inode->i_mode)) { *err = -ENOTSOCK; fput(file); return NULL; } + sock = SOCKET_I(inode); if (sock->file != file) { printk(KERN_ERR "socki_lookup: socket file changed!\n"); sock->file = file; @@ -471,7 +471,6 @@ static struct socket *sock_alloc(void) sock = SOCKET_I(inode); inode->i_mode = S_IFSOCK|S_IRWXUGO; - inode->i_sock = 1; inode->i_uid = current->fsuid; inode->i_gid = current->fsgid; diff --git a/net/unix/garbage.c b/net/unix/garbage.c index 3d5e1a5f433f0e..4bd95c8f5934a5 100644 --- a/net/unix/garbage.c +++ b/net/unix/garbage.c @@ -100,7 +100,7 @@ static struct sock *unix_get_socket(struct file *filp) /* * Socket ? */ - if (inode->i_sock) { + if (S_ISSOCK(inode->i_mode)) { struct socket * sock = SOCKET_I(inode); struct sock * s = sock->sk; |