[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100707151738.GR11732@laptop>
Date: Thu, 8 Jul 2010 01:17:38 +1000
From: Nick Piggin <npiggin@...e.de>
To: "Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
Cc: hch@...radead.org, viro@...iv.linux.org.uk, adilger@....com,
corbet@....net, serue@...ibm.com, neilb@...e.de,
hooanon05@...oo.co.jp, bfields@...ldses.org,
linux-fsdevel@...r.kernel.org, sfrench@...ibm.com,
philippe.deniel@....FR, linux-kernel@...r.kernel.org
Subject: Re: [PATCH -V14 03/11] vfs: Add open by file handle support
On Tue, Jun 15, 2010 at 10:42:53PM +0530, Aneesh Kumar K.V wrote:
> diff --git a/fs/open.c b/fs/open.c
> index 43ac798..1c5daa3 100644
> --- a/fs/open.c
> +++ b/fs/open.c
> @@ -1168,3 +1168,201 @@ SYSCALL_DEFINE4(name_to_handle_at, int, dfd, const char __user *, name,
> return -ENOSYS;
> }
> #endif
> +
> +#ifdef CONFIG_EXPORTFS
> +static struct vfsmount *get_vfsmount_from_fd(int fd)
> +{
> + int fput_needed;
> + struct path *path;
> + struct file *filep;
> +
> + if (fd == AT_FDCWD) {
> + struct fs_struct *fs = current->fs;
> + read_lock(&fs->lock);
> + path = &fs->pwd;
> + mntget(path->mnt);
> + read_unlock(&fs->lock);
> + } else {
> + filep = fget_light(fd, &fput_needed);
> + if (!filep)
> + return ERR_PTR(-EBADF);
> + path = &filep->f_path;
> + mntget(path->mnt);
> + fput_light(filep, fput_needed);
> + }
> + return path->mnt;
> +}
The bulk of this this should probably be in fs/namei.c, factored with
path_init stuff if possible please.
--
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