Re: [RFC PATCH 4/6] networking: rework socket to fd mapping usingalloc-file

From: Miklos Szeredi
Date: Fri Dec 04 2009 - 02:10:06 EST


On Thu, 03 Dec 2009, Eric Paris wrote:
> @@ -391,32 +383,37 @@ static int sock_attach_fd(struct socket *sock, struct file *file, int flags)
> dentry->d_flags &= ~DCACHE_UNHASHED;
> d_instantiate(dentry, SOCK_INODE(sock));
>
> + file = alloc_file(sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
> + &socket_file_ops);
> + if (unlikely(!file)) {
> + rc = -ENFILE;
> + goto out_err;
> + }
> +
> sock->file = file;
> - init_file(file, sock_mnt, dentry, FMODE_READ | FMODE_WRITE,
> - &socket_file_ops);
> SOCK_INODE(sock)->i_fop = &socket_file_ops;
> file->f_flags = O_RDWR | (flags & O_NONBLOCK);
> - file->f_pos = 0;
> file->private_data = sock;
>
> - return 0;
> + return fd;
> +out_err:
> + if (fd >= 0)
> + put_unused_fd(fd);
> + if (dentry)
> + dput(dentry);

Could you please use separate labels intead of conditionals here?

Thanks,
Miklos
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/