aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-08-06 01:43:59 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-16 12:16:42 -0500
commitcc3808f8c354889982e7e323050f1e50ad99a009 (patch)
tree60c07432cf9f5d4b7bac5a07abcb6bf81aa91b7b
parent6b18662e239a032f908b7f6e164bdf7e2e0a32c9 (diff)
switch sock_alloc_file() to alloc_file()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--net/socket.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/net/socket.c b/net/socket.c
index dbb3802a7645..eaaba3510e81 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -366,16 +366,8 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags)
366 if (unlikely(fd < 0)) 366 if (unlikely(fd < 0))
367 return fd; 367 return fd;
368 368
369 file = get_empty_filp();
370
371 if (unlikely(!file)) {
372 put_unused_fd(fd);
373 return -ENFILE;
374 }
375
376 dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name); 369 dentry = d_alloc(sock_mnt->mnt_sb->s_root, &name);
377 if (unlikely(!dentry)) { 370 if (unlikely(!dentry)) {
378 put_filp(file);
379 put_unused_fd(fd); 371 put_unused_fd(fd);
380 return -ENOMEM; 372 return -ENOMEM;
381 } 373 }
@@ -388,11 +380,19 @@ static int sock_alloc_file(struct socket *sock, struct file **f, int flags)
388 */ 380 */
389 dentry->d_flags &= ~DCACHE_UNHASHED; 381 dentry->d_flags &= ~DCACHE_UNHASHED;
390 d_instantiate(dentry, SOCK_INODE(sock)); 382 d_instantiate(dentry, SOCK_INODE(sock));
383 SOCK_INODE(sock)->i_fop = &socket_file_ops;
391 384
392 sock->file = file; 385 file = alloc_file(sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
393 init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
394 &socket_file_ops); 386 &socket_file_ops);
395 SOCK_INODE(sock)->i_fop = &socket_file_ops; 387 if (unlikely(!file)) {
388 /* drop dentry, keep inode */
389 atomic_inc(&path.dentry->d_inode->i_count);
390 dput(dentry);
391 put_unused_fd(fd);
392 return -ENFILE;
393 }
394
395 sock->file = file;
396 file->f_flags = O_RDWR | (flags & O_NONBLOCK); 396 file->f_flags = O_RDWR | (flags & O_NONBLOCK);
397 file->f_pos = 0; 397 file->f_pos = 0;
398 file->private_data = sock; 398 file->private_data = sock;