@@ -13,19 +13,6 @@ static int get_name(struct dentry *dentry, char *name,
1313 struct dentry * child );
1414
1515
16- static struct dentry * exportfs_get_dentry (struct super_block * sb , void * obj )
17- {
18- struct dentry * result = ERR_PTR (- ESTALE );
19-
20- if (sb -> s_export_op -> get_dentry ) {
21- result = sb -> s_export_op -> get_dentry (sb , obj );
22- if (!result )
23- result = ERR_PTR (- ESTALE );
24- }
25-
26- return result ;
27- }
28-
2916static int exportfs_get_name (struct dentry * dir , char * name ,
3017 struct dentry * child )
3118{
@@ -214,125 +201,6 @@ reconnect_path(struct super_block *sb, struct dentry *target_dir)
214201 return 0 ;
215202}
216203
217- /**
218- * find_exported_dentry - helper routine to implement export_operations->decode_fh
219- * @sb: The &super_block identifying the filesystem
220- * @obj: An opaque identifier of the object to be found - passed to
221- * get_inode
222- * @parent: An optional opqaue identifier of the parent of the object.
223- * @acceptable: A function used to test possible &dentries to see if they are
224- * acceptable
225- * @context: A parameter to @acceptable so that it knows on what basis to
226- * judge.
227- *
228- * find_exported_dentry is the central helper routine to enable file systems
229- * to provide the decode_fh() export_operation. It's main task is to take
230- * an &inode, find or create an appropriate &dentry structure, and possibly
231- * splice this into the dcache in the correct place.
232- *
233- * The decode_fh() operation provided by the filesystem should call
234- * find_exported_dentry() with the same parameters that it received except
235- * that instead of the file handle fragment, pointers to opaque identifiers
236- * for the object and optionally its parent are passed. The default decode_fh
237- * routine passes one pointer to the start of the filehandle fragment, and
238- * one 8 bytes into the fragment. It is expected that most filesystems will
239- * take this approach, though the offset to the parent identifier may well be
240- * different.
241- *
242- * find_exported_dentry() will call get_dentry to get an dentry pointer from
243- * the file system. If any &dentry in the d_alias list is acceptable, it will
244- * be returned. Otherwise find_exported_dentry() will attempt to splice a new
245- * &dentry into the dcache using get_name() and get_parent() to find the
246- * appropriate place.
247- */
248-
249- struct dentry *
250- find_exported_dentry (struct super_block * sb , void * obj , void * parent ,
251- int (* acceptable )(void * context , struct dentry * de ),
252- void * context )
253- {
254- struct dentry * result , * alias ;
255- int err = - ESTALE ;
256-
257- /*
258- * Attempt to find the inode.
259- */
260- result = exportfs_get_dentry (sb , obj );
261- if (IS_ERR (result ))
262- return result ;
263-
264- if (S_ISDIR (result -> d_inode -> i_mode )) {
265- if (!(result -> d_flags & DCACHE_DISCONNECTED )) {
266- if (acceptable (context , result ))
267- return result ;
268- err = - EACCES ;
269- goto err_result ;
270- }
271-
272- err = reconnect_path (sb , result );
273- if (err )
274- goto err_result ;
275- } else {
276- struct dentry * target_dir , * nresult ;
277- char nbuf [NAME_MAX + 1 ];
278-
279- alias = find_acceptable_alias (result , acceptable , context );
280- if (alias )
281- return alias ;
282-
283- if (parent == NULL )
284- goto err_result ;
285-
286- target_dir = exportfs_get_dentry (sb ,parent );
287- if (IS_ERR (target_dir )) {
288- err = PTR_ERR (target_dir );
289- goto err_result ;
290- }
291-
292- err = reconnect_path (sb , target_dir );
293- if (err ) {
294- dput (target_dir );
295- goto err_result ;
296- }
297-
298- /*
299- * As we weren't after a directory, have one more step to go.
300- */
301- err = exportfs_get_name (target_dir , nbuf , result );
302- if (!err ) {
303- mutex_lock (& target_dir -> d_inode -> i_mutex );
304- nresult = lookup_one_len (nbuf , target_dir ,
305- strlen (nbuf ));
306- mutex_unlock (& target_dir -> d_inode -> i_mutex );
307- if (!IS_ERR (nresult )) {
308- if (nresult -> d_inode ) {
309- dput (result );
310- result = nresult ;
311- } else
312- dput (nresult );
313- }
314- }
315- dput (target_dir );
316- }
317-
318- alias = find_acceptable_alias (result , acceptable , context );
319- if (alias )
320- return alias ;
321-
322- /* drat - I just cannot find anything acceptable */
323- dput (result );
324- /* It might be justifiable to return ESTALE here,
325- * but the filehandle at-least looks reasonable good
326- * and it may just be a permission problem, so returning
327- * -EACCESS is safer
328- */
329- return ERR_PTR (- EACCES );
330-
331- err_result :
332- dput (result );
333- return ERR_PTR (err );
334- }
335-
336204struct getdents_callback {
337205 char * name ; /* name that was found. It already points to a
338206 buffer NAME_MAX+1 is size */
@@ -462,38 +330,6 @@ static int export_encode_fh(struct dentry *dentry, struct fid *fid,
462330 return type ;
463331}
464332
465-
466- /**
467- * export_decode_fh - default export_operations->decode_fh function
468- * @sb: The superblock
469- * @fh: pointer to the file handle fragment
470- * @fh_len: length of file handle fragment
471- * @acceptable: function for testing acceptability of dentrys
472- * @context: context for @acceptable
473- *
474- * This is the default decode_fh() function.
475- * a fileid_type of 1 indicates that the filehandlefragment
476- * just contains an object identifier understood by get_dentry.
477- * a fileid_type of 2 says that there is also a directory
478- * identifier 8 bytes in to the filehandlefragement.
479- */
480- static struct dentry * export_decode_fh (struct super_block * sb , __u32 * fh , int fh_len ,
481- int fileid_type ,
482- int (* acceptable )(void * context , struct dentry * de ),
483- void * context )
484- {
485- __u32 parent [2 ];
486- parent [0 ] = parent [1 ] = 0 ;
487- if (fh_len < 2 || fileid_type > 2 )
488- return NULL ;
489- if (fileid_type == 2 ) {
490- if (fh_len > 2 ) parent [0 ] = fh [2 ];
491- if (fh_len > 3 ) parent [1 ] = fh [3 ];
492- }
493- return find_exported_dentry (sb , fh , parent ,
494- acceptable , context );
495- }
496-
497333int exportfs_encode_fh (struct dentry * dentry , struct fid * fid , int * max_len ,
498334 int connectable )
499335{
@@ -517,19 +353,6 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
517353 struct dentry * result , * alias ;
518354 int err ;
519355
520- /*
521- * Old way of doing things. Will go away soon.
522- */
523- if (!nop -> fh_to_dentry ) {
524- if (nop -> decode_fh ) {
525- return nop -> decode_fh (mnt -> mnt_sb , fid -> raw , fh_len ,
526- fileid_type , acceptable , context );
527- } else {
528- return export_decode_fh (mnt -> mnt_sb , fid -> raw , fh_len ,
529- fileid_type , acceptable , context );
530- }
531- }
532-
533356 /*
534357 * Try to get any dentry for the given file handle from the filesystem.
535358 */
@@ -652,6 +475,4 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
652475}
653476EXPORT_SYMBOL_GPL (exportfs_decode_fh );
654477
655- EXPORT_SYMBOL (find_exported_dentry );
656-
657478MODULE_LICENSE ("GPL" );
0 commit comments