ChangeSet 1.2332, 2005/03/31 22:25:26-08:00, [EMAIL PROTECTED]

        [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 <[EMAIL PROTECTED]>
        Signed-off-by: David S. Miller <[EMAIL PROTECTED]>



 fs/inode.c               |    1 -
 include/linux/fs.h       |    1 -
 net/netlink/af_netlink.c |    5 ++---
 net/socket.c             |    5 ++---
 net/unix/garbage.c       |    2 +-
 5 files changed, 5 insertions(+), 9 deletions(-)


diff -Nru a/fs/inode.c b/fs/inode.c
--- a/fs/inode.c        2005-04-01 09:10:57 -08:00
+++ b/fs/inode.c        2005-04-01 09:10:57 -08:00
@@ -118,7 +118,6 @@
                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 -Nru a/include/linux/fs.h b/include/linux/fs.h
--- a/include/linux/fs.h        2005-04-01 09:10:56 -08:00
+++ b/include/linux/fs.h        2005-04-01 09:10:56 -08:00
@@ -445,7 +445,6 @@
        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 -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
--- a/net/netlink/af_netlink.c  2005-04-01 09:10:57 -08:00
+++ b/net/netlink/af_netlink.c  2005-04-01 09:10:57 -08:00
@@ -562,13 +562,12 @@
 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 -Nru a/net/socket.c b/net/socket.c
--- a/net/socket.c      2005-04-01 09:10:57 -08:00
+++ b/net/socket.c      2005-04-01 09:10:57 -08:00
@@ -437,13 +437,13 @@
        }
 
        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 @@
        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 -Nru a/net/unix/garbage.c b/net/unix/garbage.c
--- a/net/unix/garbage.c        2005-04-01 09:10:56 -08:00
+++ b/net/unix/garbage.c        2005-04-01 09:10:56 -08:00
@@ -100,7 +100,7 @@
        /*
         *      Socket ?
         */
-       if (inode->i_sock) {
+       if (S_ISSOCK(inode->i_mode)) {
                struct socket * sock = SOCKET_I(inode);
                struct sock * s = sock->sk;
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to