[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4FF3F2B6.5040909@parallels.com>
Date: Wed, 04 Jul 2012 11:37:26 +0400
From: Pavel Emelyanov <xemul@...allels.com>
To: Cyrill Gorcunov <gorcunov@...nvz.org>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
Al Viro <viro@...IV.linux.org.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
James Bottomley <jbottomley@...allels.com>
Subject: Re: [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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists