Josef 'Jeff' Sipek 16f1820028 fs: introduce vfs_path_lookup
Stackable file systems, among others, frequently need to lookup paths or
path components starting from an arbitrary point in the namespace
(identified by a dentry and a vfsmount).  Currently, such file systems use
lookup_one_len, which is frowned upon [1] as it does not pass the lookup
intent along; not passing a lookup intent, for example, can trigger BUG_ON's
when stacking on top of NFSv4.

The first patch introduces a new lookup function to allow lookup starting
from an arbitrary point in the namespace.  This approach has been suggested
by Christoph Hellwig [2].

The second patch changes sunrpc to use vfs_path_lookup.

The third patch changes nfsctl.c to use vfs_path_lookup.

The fourth patch marks link_path_walk static.

The fifth, and last patch, unexports path_walk because it is no longer
unnecessary to call it directly, and using the new vfs_path_lookup is
cleaner.

For example, the following snippet of code, looks up "some/path/component"
in a directory pointed to by parent_{dentry,vfsmnt}:

err = vfs_path_lookup(parent_dentry, parent_vfsmnt,
		      "some/path/component", 0, &nd);
if (!err) {
	/* exits */

	...

	/* once done, release the references */
	path_release(&nd);
} else if (err == -ENOENT) {
	/* doesn't exist */
} else {
	/* other error */
}

VFS functions such as lookup_create can be used on the nameidata structure
to pass the create intent to the file system.

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: Neil Brown <neilb@suse.de>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-07-19 10:04:45 -07:00
..
2007-07-16 16:03:25 -05:00
2007-07-16 09:05:43 -07:00
2007-05-17 05:23:04 -07:00
2007-05-08 11:14:59 -07:00
2007-07-17 10:23:06 -07:00
2007-07-16 09:05:41 -07:00
2007-07-19 10:04:41 -07:00
2007-07-16 09:05:48 -07:00
2007-07-19 10:04:41 -07:00
2007-07-16 09:05:52 -07:00
2007-07-19 10:04:41 -07:00
2007-05-17 05:23:04 -07:00
2007-05-17 05:23:04 -07:00
2007-07-16 09:05:50 -07:00
2007-07-19 10:04:41 -07:00
2006-10-04 06:51:26 -06:00
2007-07-10 08:03:34 +02:00
2007-07-16 09:05:50 -07:00
2007-07-19 10:04:43 -07:00
2007-07-19 10:04:45 -07:00
2006-12-07 08:39:25 -08:00
2007-05-18 13:09:34 -07:00
2007-05-15 08:54:00 -07:00
2007-07-19 10:04:45 -07:00
2007-05-21 09:18:19 -07:00
2007-05-08 11:15:01 -07:00
2007-05-08 11:15:09 -07:00
2007-07-16 09:05:48 -07:00
2007-07-18 08:50:18 -04:00
2007-05-09 06:44:57 +02:00
2007-07-18 19:17:19 -04:00
2007-05-11 08:29:36 -07:00
2007-07-19 10:04:45 -07:00
2007-07-10 08:04:16 +02:00
2006-10-01 00:39:19 -07:00
2007-07-10 08:04:15 +02:00
2007-05-09 07:10:02 +02:00
2007-07-16 09:05:46 -07:00
2007-05-18 13:09:34 -07:00