aboutsummaryrefslogtreecommitdiffstats
path: root/net/socket.c
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-01 18:02:01 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-01 18:02:01 -0400
commite3ee3b78f83688a0ae4315e8be71b2eac559904a (patch)
treedeb03bcdd020262af450ed23382d7c921263f5cf /net/socket.c
parent91cb70c1769d9b72dd1efe40c31f01005820b09e (diff)
parent6b39374a27eb4be7e9d82145ae270ba02ea90dc8 (diff)
/spare/repo/netdev-2.6 branch 'master'
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/socket.c b/net/socket.c
index 6f2a17881972..94fe638b4d72 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -70,6 +70,8 @@
70#include <linux/seq_file.h> 70#include <linux/seq_file.h>
71#include <linux/wanrouter.h> 71#include <linux/wanrouter.h>
72#include <linux/if_bridge.h> 72#include <linux/if_bridge.h>
73#include <linux/if_frad.h>
74#include <linux/if_vlan.h>
73#include <linux/init.h> 75#include <linux/init.h>
74#include <linux/poll.h> 76#include <linux/poll.h>
75#include <linux/cache.h> 77#include <linux/cache.h>
@@ -272,7 +274,7 @@ int move_addr_to_user(void *kaddr, int klen, void __user *uaddr, int __user *ule
272 274
273#define SOCKFS_MAGIC 0x534F434B 275#define SOCKFS_MAGIC 0x534F434B
274 276
275static kmem_cache_t * sock_inode_cachep; 277static kmem_cache_t * sock_inode_cachep __read_mostly;
276 278
277static struct inode *sock_alloc_inode(struct super_block *sb) 279static struct inode *sock_alloc_inode(struct super_block *sb)
278{ 280{
@@ -331,7 +333,7 @@ static struct super_block *sockfs_get_sb(struct file_system_type *fs_type,
331 return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC); 333 return get_sb_pseudo(fs_type, "socket:", &sockfs_ops, SOCKFS_MAGIC);
332} 334}
333 335
334static struct vfsmount *sock_mnt; 336static struct vfsmount *sock_mnt __read_mostly;
335 337
336static struct file_system_type sock_fs_type = { 338static struct file_system_type sock_fs_type = {
337 .name = "sockfs", 339 .name = "sockfs",
@@ -404,6 +406,7 @@ int sock_map_fd(struct socket *sock)
404 file->f_mode = FMODE_READ | FMODE_WRITE; 406 file->f_mode = FMODE_READ | FMODE_WRITE;
405 file->f_flags = O_RDWR; 407 file->f_flags = O_RDWR;
406 file->f_pos = 0; 408 file->f_pos = 0;
409 file->private_data = sock;
407 fd_install(fd, file); 410 fd_install(fd, file);
408 } 411 }
409 412
@@ -436,6 +439,9 @@ struct socket *sockfd_lookup(int fd, int *err)
436 return NULL; 439 return NULL;
437 } 440 }
438 441
442 if (file->f_op == &socket_file_ops)
443 return file->private_data; /* set in sock_map_fd */
444
439 inode = file->f_dentry->d_inode; 445 inode = file->f_dentry->d_inode;
440 if (!S_ISSOCK(inode->i_mode)) { 446 if (!S_ISSOCK(inode->i_mode)) {
441 *err = -ENOTSOCK; 447 *err = -ENOTSOCK;
@@ -720,8 +726,8 @@ static ssize_t sock_aio_write(struct kiocb *iocb, const char __user *ubuf,
720 return __sock_sendmsg(iocb, sock, &x->async_msg, size); 726 return __sock_sendmsg(iocb, sock, &x->async_msg, size);
721} 727}
722 728
723ssize_t sock_sendpage(struct file *file, struct page *page, 729static ssize_t sock_sendpage(struct file *file, struct page *page,
724 int offset, size_t size, loff_t *ppos, int more) 730 int offset, size_t size, loff_t *ppos, int more)
725{ 731{
726 struct socket *sock; 732 struct socket *sock;
727 int flags; 733 int flags;
@@ -944,7 +950,7 @@ static int sock_mmap(struct file * file, struct vm_area_struct * vma)
944 return sock->ops->mmap(file, sock, vma); 950 return sock->ops->mmap(file, sock, vma);
945} 951}
946 952
947int sock_close(struct inode *inode, struct file *filp) 953static int sock_close(struct inode *inode, struct file *filp)
948{ 954{
949 /* 955 /*
950 * It was possible the inode is NULL we were 956 * It was possible the inode is NULL we were
@@ -2023,9 +2029,6 @@ int sock_unregister(int family)
2023 return 0; 2029 return 0;
2024} 2030}
2025 2031
2026
2027extern void sk_init(void);
2028
2029void __init sock_init(void) 2032void __init sock_init(void)
2030{ 2033{
2031 /* 2034 /*