Re: [rfc 2/7] procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file

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

 



> @@ -130,7 +159,31 @@ static const struct dentry_operations ti
>  
>  static int proc_fd_link(struct dentry *dentry, struct path *path)
>  {
> -	return proc_fd_info(dentry->d_inode, path, NULL);
> +       struct inode *inode = dentry->d_inode;
> +       struct task_struct *task = get_proc_task(inode);
> +       struct files_struct *files = NULL;
> +       int fd = proc_fd(inode);
> +       struct file *file;
> +       int err = -ENOENT;
> +
> +       if (task) {
> +	       files = get_files_struct(task);
> +	       put_task_struct(task);
> +       }
> +
> +       if (files) {
> +	       spin_lock(&files->file_lock);
> +	       file = fcheck_files(files, fd);
> +	       if (file) {
> +		       *path = file->f_path;
> +		       path_get(&file->f_path);
> +	       }
> +	       spin_unlock(&files->file_lock);
> +	       put_files_struct(files);
> +	       err = 0;
> +       }
> +
> +       return err;
>  }
>  
>  static struct dentry *
> @@ -245,22 +298,6 @@ out_no_task:
>  	return retval;
>  }
>  
> -static ssize_t proc_fdinfo_read(struct file *file, char __user *buf,
> -				size_t len, loff_t *ppos)
> -{
> -	char tmp[PROC_FDINFO_MAX];
> -	int err = proc_fd_info(file->f_path.dentry->d_inode, NULL, tmp);
> -	if (!err)
> -		err = simple_read_from_buffer(buf, len, ppos, tmp, strlen(tmp));
> -	return err;
> -}
> -

I believe we can still have the proc_fdinfo_read and proc_fd_link code non-splitted.
Just push a callback pointer ino the proc_fd_info (as usual -- we an opaque void *argument).

Thanks,
Pavel

--
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