IMFS: yet another trouble.
Sergei Organov
osv at javad.ru
Tue Nov 28 09:33:20 UTC 2000
jennifer averett <jennifer.averett at oarcorp.com> writes:
> 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 {
Oh, yes. As always I've already found it myself yesterday. Now everything
works just great! I'd like to mention in addition that 'st_dev' and 'st_ino'
fields of 'struct stat' should be set in the file-system 'fstat' routine to
some unique values, otherwise 'getcwd()' doesn't work. It'd be fine to mention
this fact in the documentation if it's not already there (at least I didn't
find it).
> >
> > 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, mount is indeed not valid from my file-system because it even doesn't
support directories. And I don't use IMFS methods. I've set it to NULL because
I have no plans to support multiple mounts of the file-system and still
everything seem to work correctly. Now I've set it to the mount entry as
you suggest to be on the safe side, - at least this didn't break what worked
before :-)
Thanks again,
Sergei Organov.
More information about the users
mailing list