lkml.org 
[lkml]   [2012]   [Jul]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [rfc 2/7] procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file
> @@ -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



\
 
 \ /
  Last update: 2012-07-04 10:21    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site