aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h100
1 files changed, 52 insertions, 48 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3f825b085c8d..4edba067a717 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1065,71 +1065,75 @@ int sync_inode(struct inode *inode, struct writeback_control *wbc);
1065 * with a particular exported file system - particularly enabling nfsd and 1065 * with a particular exported file system - particularly enabling nfsd and
1066 * the filesystem to co-operate when dealing with file handles. 1066 * the filesystem to co-operate when dealing with file handles.
1067 * 1067 *
1068 * export_operations contains two basic operation for dealing with file handles, 1068 * export_operations contains two basic operation for dealing with file
1069 * decode_fh() and encode_fh(), and allows for some other operations to be defined 1069 * handles, decode_fh() and encode_fh(), and allows for some other
1070 * which standard helper routines use to get specific information from the 1070 * operations to be defined which standard helper routines use to get
1071 * filesystem. 1071 * specific information from the filesystem.
1072 * 1072 *
1073 * nfsd encodes information use to determine which filesystem a filehandle 1073 * nfsd encodes information use to determine which filesystem a filehandle
1074 * applies to in the initial part of the file handle. The remainder, termed a 1074 * applies to in the initial part of the file handle. The remainder, termed
1075 * file handle fragment, is controlled completely by the filesystem. 1075 * a file handle fragment, is controlled completely by the filesystem. The
1076 * The standard helper routines assume that this fragment will contain one or two 1076 * standard helper routines assume that this fragment will contain one or
1077 * sub-fragments, one which identifies the file, and one which may be used to 1077 * two sub-fragments, one which identifies the file, and one which may be
1078 * identify the (a) directory containing the file. 1078 * used to identify the (a) directory containing the file.
1079 * 1079 *
1080 * In some situations, nfsd needs to get a dentry which is connected into a 1080 * In some situations, nfsd needs to get a dentry which is connected into a
1081 * specific part of the file tree. To allow for this, it passes the function 1081 * specific part of the file tree. To allow for this, it passes the
1082 * acceptable() together with a @context which can be used to see if the dentry 1082 * function acceptable() together with a @context which can be used to see
1083 * is acceptable. As there can be multiple dentrys for a given file, the filesystem 1083 * if the dentry is acceptable. As there can be multiple dentrys for a
1084 * should check each one for acceptability before looking for the next. As soon 1084 * given file, the filesystem should check each one for acceptability before
1085 * as an acceptable one is found, it should be returned. 1085 * looking for the next. As soon as an acceptable one is found, it should
1086 * be returned.
1086 * 1087 *
1087 * decode_fh: 1088 * decode_fh:
1088 * @decode_fh is given a &struct super_block (@sb), a file handle fragment (@fh, @fh_len) 1089 * @decode_fh is given a &struct super_block (@sb), a file handle fragment
1089 * and an acceptability testing function (@acceptable, @context). It should return 1090 * (@fh, @fh_len) and an acceptability testing function (@acceptable,
1090 * a &struct dentry which refers to the same file that the file handle fragment refers 1091 * @context). It should return a &struct dentry which refers to the same
1091 * to, and which passes the acceptability test. If it cannot, it should return 1092 * file that the file handle fragment refers to, and which passes the
1092 * a %NULL pointer if the file was found but no acceptable &dentries were available, or 1093 * acceptability test. If it cannot, it should return a %NULL pointer if
1093 * a %ERR_PTR error code indicating why it couldn't be found (e.g. %ENOENT or %ENOMEM). 1094 * the file was found but no acceptable &dentries were available, or a
1095 * %ERR_PTR error code indicating why it couldn't be found (e.g. %ENOENT or
1096 * %ENOMEM).
1094 * 1097 *
1095 * encode_fh: 1098 * encode_fh:
1096 * @encode_fh should store in the file handle fragment @fh (using at most @max_len bytes) 1099 * @encode_fh should store in the file handle fragment @fh (using at most
1097 * information that can be used by @decode_fh to recover the file refered to by the 1100 * @max_len bytes) information that can be used by @decode_fh to recover the
1098 * &struct dentry @de. If the @connectable flag is set, the encode_fh() should store 1101 * file refered to by the &struct dentry @de. If the @connectable flag is
1099 * sufficient information so that a good attempt can be made to find not only 1102 * set, the encode_fh() should store sufficient information so that a good
1100 * the file but also it's place in the filesystem. This typically means storing 1103 * attempt can be made to find not only the file but also it's place in the
1101 * a reference to de->d_parent in the filehandle fragment. 1104 * filesystem. This typically means storing a reference to de->d_parent in
1102 * encode_fh() should return the number of bytes stored or a negative error code 1105 * the filehandle fragment. encode_fh() should return the number of bytes
1103 * such as %-ENOSPC 1106 * stored or a negative error code such as %-ENOSPC
1104 * 1107 *
1105 * get_name: 1108 * get_name:
1106 * @get_name should find a name for the given @child in the given @parent directory. 1109 * @get_name should find a name for the given @child in the given @parent
1107 * The name should be stored in the @name (with the understanding that it is already 1110 * directory. The name should be stored in the @name (with the
1108 * pointing to a a %NAME_MAX+1 sized buffer. get_name() should return %0 on success, 1111 * understanding that it is already pointing to a a %NAME_MAX+1 sized
1109 * a negative error code or error. 1112 * buffer. get_name() should return %0 on success, a negative error code
1110 * @get_name will be called without @parent->i_sem held. 1113 * or error. @get_name will be called without @parent->i_sem held.
1111 * 1114 *
1112 * get_parent: 1115 * get_parent:
1113 * @get_parent should find the parent directory for the given @child which is also 1116 * @get_parent should find the parent directory for the given @child which
1114 * a directory. In the event that it cannot be found, or storage space cannot be 1117 * is also a directory. In the event that it cannot be found, or storage
1115 * allocated, a %ERR_PTR should be returned. 1118 * space cannot be allocated, a %ERR_PTR should be returned.
1116 * 1119 *
1117 * get_dentry: 1120 * get_dentry:
1118 * Given a &super_block (@sb) and a pointer to a file-system specific inode identifier, 1121 * Given a &super_block (@sb) and a pointer to a file-system specific inode
1119 * possibly an inode number, (@inump) get_dentry() should find the identified inode and 1122 * identifier, possibly an inode number, (@inump) get_dentry() should find
1120 * return a dentry for that inode. 1123 * the identified inode and return a dentry for that inode. Any suitable
1121 * Any suitable dentry can be returned including, if necessary, a new dentry created 1124 * dentry can be returned including, if necessary, a new dentry created with
1122 * with d_alloc_root. The caller can then find any other extant dentrys by following the 1125 * d_alloc_root. The caller can then find any other extant dentrys by
1123 * d_alias links. If a new dentry was created using d_alloc_root, DCACHE_NFSD_DISCONNECTED 1126 * following the d_alias links. If a new dentry was created using
1124 * should be set, and the dentry should be d_rehash()ed. 1127 * d_alloc_root, DCACHE_NFSD_DISCONNECTED should be set, and the dentry
1128 * should be d_rehash()ed.
1125 * 1129 *
1126 * If the inode cannot be found, either a %NULL pointer or an %ERR_PTR code can be returned. 1130 * If the inode cannot be found, either a %NULL pointer or an %ERR_PTR code
1127 * The @inump will be whatever was passed to nfsd_find_fh_dentry() in either the 1131 * can be returned. The @inump will be whatever was passed to
1128 * @obj or @parent parameters. 1132 * nfsd_find_fh_dentry() in either the @obj or @parent parameters.
1129 * 1133 *
1130 * Locking rules: 1134 * Locking rules:
1131 * get_parent is called with child->d_inode->i_sem down 1135 * get_parent is called with child->d_inode->i_sem down
1132 * get_name is not (which is possibly inconsistent) 1136 * get_name is not (which is possibly inconsistent)
1133 */ 1137 */
1134 1138
1135struct export_operations { 1139struct export_operations {