aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/isofs/export.c67
1 files changed, 29 insertions, 38 deletions
diff --git a/fs/isofs/export.c b/fs/isofs/export.c
index 4af856a7fda7..511c3513433f 100644
--- a/fs/isofs/export.c
+++ b/fs/isofs/export.c
@@ -42,16 +42,6 @@ isofs_export_iget(struct super_block *sb,
42 return result; 42 return result;
43} 43}
44 44
45static struct dentry *
46isofs_export_get_dentry(struct super_block *sb, void *vobjp)
47{
48 __u32 *objp = vobjp;
49 unsigned long block = objp[0];
50 unsigned long offset = objp[1];
51 __u32 generation = objp[2];
52 return isofs_export_iget(sb, block, offset, generation);
53}
54
55/* This function is surprisingly simple. The trick is understanding 45/* This function is surprisingly simple. The trick is understanding
56 * that "child" is always a directory. So, to find its parent, you 46 * that "child" is always a directory. So, to find its parent, you
57 * simply need to find its ".." entry, normalize its block and offset, 47 * simply need to find its ".." entry, normalize its block and offset,
@@ -182,43 +172,44 @@ isofs_export_encode_fh(struct dentry *dentry,
182 return type; 172 return type;
183} 173}
184 174
175struct isofs_fid {
176 u32 block;
177 u16 offset;
178 u16 parent_offset;
179 u32 generation;
180 u32 parent_block;
181 u32 parent_generation;
182};
185 183
186static struct dentry * 184static struct dentry *isofs_fh_to_dentry(struct super_block *sb,
187isofs_export_decode_fh(struct super_block *sb, 185 struct fid *fid, int fh_len, int fh_type)
188 __u32 *fh32,
189 int fh_len,
190 int fileid_type,
191 int (*acceptable)(void *context, struct dentry *de),
192 void *context)
193{ 186{
194 __u16 *fh16 = (__u16*)fh32; 187 struct isofs_fid *ifid = (struct isofs_fid *)fid;
195 __u32 child[3]; /* The child is what triggered all this. */
196 __u32 parent[3]; /* The parent is just along for the ride. */
197 188
198 if (fh_len < 3 || fileid_type > 2) 189 if (fh_len < 3 || fh_type > 2)
199 return NULL; 190 return NULL;
200 191
201 child[0] = fh32[0]; 192 return isofs_export_iget(sb, ifid->block, ifid->offset,
202 child[1] = fh16[2]; /* fh16 [sic] */ 193 ifid->generation);
203 child[2] = fh32[2];
204
205 parent[0] = 0;
206 parent[1] = 0;
207 parent[2] = 0;
208 if (fileid_type == 2) {
209 if (fh_len > 2) parent[0] = fh32[3];
210 parent[1] = fh16[3]; /* fh16 [sic] */
211 if (fh_len > 4) parent[2] = fh32[4];
212 }
213
214 return sb->s_export_op->find_exported_dentry(sb, child, parent,
215 acceptable, context);
216} 194}
217 195
196static struct dentry *isofs_fh_to_parent(struct super_block *sb,
197 struct fid *fid, int fh_len, int fh_type)
198{
199 struct isofs_fid *ifid = (struct isofs_fid *)fid;
200
201 if (fh_type != 2)
202 return NULL;
203
204 return isofs_export_iget(sb,
205 fh_len > 2 ? ifid->parent_block : 0,
206 ifid->parent_offset,
207 fh_len > 4 ? ifid->parent_generation : 0);
208}
218 209
219struct export_operations isofs_export_ops = { 210struct export_operations isofs_export_ops = {
220 .decode_fh = isofs_export_decode_fh,
221 .encode_fh = isofs_export_encode_fh, 211 .encode_fh = isofs_export_encode_fh,
222 .get_dentry = isofs_export_get_dentry, 212 .fh_to_dentry = isofs_fh_to_dentry,
213 .fh_to_parent = isofs_fh_to_parent,
223 .get_parent = isofs_export_get_parent, 214 .get_parent = isofs_export_get_parent,
224}; 215};