aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/exportfs.h
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2007-10-21 19:42:05 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-22 11:13:19 -0400
commit2596110a3994593f6aa3e2bb76345ad4791b1a14 (patch)
tree0f1773238265f83e1b5640256176851a60ff5ea8 /include/linux/exportfs.h
parent6e91ea2bb0b6a3ddf6d4faeb54a9c20d4e20bc42 (diff)
exportfs: add new methods
Add the guts for the new filesystem API to exportfs. There's now a fh_to_dentry method that returns a dentry for the object looked for given a filehandle fragment, and a fh_to_parent operation that returns the dentry for the encoded parent directory in case the file handle contains it. There are default implementations for these methods that only take a callback for an nfs-enhanced iget variant and implement the rest of the semantics. Signed-off-by: Christoph Hellwig <hch@lst.de> Cc: Neil Brown <neilb@suse.de> Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: <linux-ext4@vger.kernel.org> Cc: Dave Kleikamp <shaggy@austin.ibm.com> Cc: Anton Altaparmakov <aia21@cantab.net> Cc: David Chinner <dgc@sgi.com> Cc: Timothy Shimmin <tes@sgi.com> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Cc: Hugh Dickins <hugh@veritas.com> Cc: Chris Mason <mason@suse.com> Cc: Jeff Mahoney <jeffm@suse.com> Cc: "Vladimir V. Saveliev" <vs@namesys.com> Cc: Steven Whitehouse <swhiteho@redhat.com> Cc: Mark Fasheh <mark.fasheh@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/exportfs.h')
-rw-r--r--include/linux/exportfs.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
index 06178a1336ff..b44f6b6871c8 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
@@ -4,6 +4,7 @@
4#include <linux/types.h> 4#include <linux/types.h>
5 5
6struct dentry; 6struct dentry;
7struct inode;
7struct super_block; 8struct super_block;
8struct vfsmount; 9struct vfsmount;
9 10
@@ -101,6 +102,21 @@ struct fid {
101 * the filehandle fragment. encode_fh() should return the number of bytes 102 * the filehandle fragment. encode_fh() should return the number of bytes
102 * stored or a negative error code such as %-ENOSPC 103 * stored or a negative error code such as %-ENOSPC
103 * 104 *
105 * fh_to_dentry:
106 * @fh_to_dentry is given a &struct super_block (@sb) and a file handle
107 * fragment (@fh, @fh_len). It should return a &struct dentry which refers
108 * to the same file that the file handle fragment refers to. If it cannot,
109 * it should return a %NULL pointer if the file was found but no acceptable
110 * &dentries were available, or an %ERR_PTR error code indicating why it
111 * couldn't be found (e.g. %ENOENT or %ENOMEM). Any suitable dentry can be
112 * returned including, if necessary, a new dentry created with d_alloc_root.
113 * The caller can then find any other extant dentries by following the
114 * d_alias links.
115 *
116 * fh_to_parent:
117 * Same as @fh_to_dentry, except that it returns a pointer to the parent
118 * dentry if it was encoded into the filehandle fragment by @encode_fh.
119 *
104 * get_name: 120 * get_name:
105 * @get_name should find a name for the given @child in the given @parent 121 * @get_name should find a name for the given @child in the given @parent
106 * directory. The name should be stored in the @name (with the 122 * directory. The name should be stored in the @name (with the
@@ -139,6 +155,10 @@ struct export_operations {
139 void *context); 155 void *context);
140 int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len, 156 int (*encode_fh)(struct dentry *de, __u32 *fh, int *max_len,
141 int connectable); 157 int connectable);
158 struct dentry * (*fh_to_dentry)(struct super_block *sb, struct fid *fid,
159 int fh_len, int fh_type);
160 struct dentry * (*fh_to_parent)(struct super_block *sb, struct fid *fid,
161 int fh_len, int fh_type);
142 int (*get_name)(struct dentry *parent, char *name, 162 int (*get_name)(struct dentry *parent, char *name,
143 struct dentry *child); 163 struct dentry *child);
144 struct dentry * (*get_parent)(struct dentry *child); 164 struct dentry * (*get_parent)(struct dentry *child);
@@ -161,4 +181,14 @@ extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
161 int fh_len, int fileid_type, int (*acceptable)(void *, struct dentry *), 181 int fh_len, int fileid_type, int (*acceptable)(void *, struct dentry *),
162 void *context); 182 void *context);
163 183
184/*
185 * Generic helpers for filesystems.
186 */
187extern struct dentry *generic_fh_to_dentry(struct super_block *sb,
188 struct fid *fid, int fh_len, int fh_type,
189 struct inode *(*get_inode) (struct super_block *sb, u64 ino, u32 gen));
190extern struct dentry *generic_fh_to_parent(struct super_block *sb,
191 struct fid *fid, int fh_len, int fh_type,
192 struct inode *(*get_inode) (struct super_block *sb, u64 ino, u32 gen));
193
164#endif /* LINUX_EXPORTFS_H */ 194#endif /* LINUX_EXPORTFS_H */