IMFS: yet another trouble.

jennifer averett jennifer.averett at oarcorp.com
Mon Nov 27 20:52:07 UTC 2000



Sergei Organov wrote:

> Hello,
>
> Using the latest snapshot and attempting to mount my own file-system, I've got
> the following trouble:
>
> When I 'cd' to the directory my file-system is mounted upon and then do
> 'cd ..', the IMFS asks my 'eval_path' routine to evaluate "..". Obviously, ".."
> doesn't belong to my file-system, so I can't return my handlers. Could anybody
> please tell what my 'eval_path' is supposed to do in this case?
>

Your path evaluaton should be capable of going between your filesystem and
the filesystem you are mounted upon.  Below is how the IMFS handles
this situation.  Since your filesystem is never the root filesystem it doesn't have
to check "Am I at the root of all filesystems?".  The mount entry is given to
the mounted filesytem at mount time via the fsmount_me method.  That should
later be used to get into and out of the mounted filesystem.
This information should be kept by the filesytem (I'd suggest in it's root node access
information)

      case IMFS_UP_DIR:

         /*
          *  Am I at the root of this mounted filesystem?
          */

         if (pathloc->node_access ==
            pathloc->mt_entry->mt_fs_root.node_access) {

           /*
            *  Am I at the root of all filesystems?
            */

           if ( pathloc->node_access == rtems_filesystem_root.node_access ) {
             break;       /* Throw out the .. in this case */
           } else {
             newloc = pathloc->mt_entry->mt_point_node;
             *pathloc = newloc;
             return (*pathloc->ops->evalpath)(&(pathname[i-len]),flags,pathloc);
           }
     } else {


>
> Also, could you please guide me what to do with 'mt_fs_root.node_access' field
> in the 'mount_me' handler? Is it safe to just set it to NULL?

The root node should contain all information that the filesytem needs to identify
this fileystem instance (ie. can  there be multiple instances of your filesystem, if
so the your root nodes should uniquely identify an instance).  Note that mount,
unmount, and IMFS methods assume the only time that this is NULL is at the
true root node.  If mount is not valid from your filesystem and you are not using
any IMFS methods, you should be safe setting it to NULL.  But I would
suggest at a minimum setting it to the mount entry passed in at mount time.



> .

>
>
> Thanks in advance.
>
> Sergei Organov.



Jennifer




More information about the users mailing list