linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Emelyanov <xemul@parallels.com>
To: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	Al Viro <viro@ZenIV.linux.org.uk>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	James Bottomley <jbottomley@parallels.com>
Subject: Re: [rfc 2/7] procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file
Date: Wed, 04 Jul 2012 11:37:26 +0400	[thread overview]
Message-ID: <4FF3F2B6.5040909@parallels.com> (raw)
In-Reply-To: <20120627110512.485189390@openvz.org>

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


  reply	other threads:[~2012-07-04  7:37 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-27 11:01 [rfc 0/7] [rfc] procfs, fdinfo seqfile providers Cyrill Gorcunov
2012-06-27 11:01 ` [rfc 1/7] procfs: Move /proc/pid/fd[info] handling code to fd.[ch] Cyrill Gorcunov
2012-06-27 11:01 ` [rfc 2/7] procfs: Convert /proc/pid/fdinfo/ handling routines to seq-file Cyrill Gorcunov
2012-07-04  7:37   ` Pavel Emelyanov [this message]
2012-07-04  8:03     ` Cyrill Gorcunov
2012-07-05 17:37     ` Cyrill Gorcunov
2012-06-27 11:01 ` [rfc 3/7] procfs: Add ability to plugin auxiliary fdinfo providers Cyrill Gorcunov
2012-07-04  7:39   ` Pavel Emelyanov
2012-07-04  7:50     ` Cyrill Gorcunov
2012-07-05 17:44     ` Cyrill Gorcunov
2012-06-27 11:01 ` [rfc 4/7] fs, eventfd: Add procfs fdinfo helper Cyrill Gorcunov
2012-06-27 11:01 ` [rfc 5/7] fs, epoll: " Cyrill Gorcunov
2012-07-19 14:52   ` Matthew Helsley
2012-07-19 15:03     ` Cyrill Gorcunov
2012-06-27 11:01 ` [rfc 6/7] fs, exportfs: Add export_encode_inode_fh helper Cyrill Gorcunov
2012-06-27 11:01 ` [rfc 7/7] fs, notify: Add procfs fdinfo helper Cyrill Gorcunov
2012-06-29 10:30   ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FF3F2B6.5040909@parallels.com \
    --to=xemul@parallels.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gorcunov@openvz.org \
    --cc=jbottomley@parallels.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ZenIV.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).