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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux