about getcwd

jennifer averett jennifer.averett at oarcorp.com
Mon Sep 10 14:51:31 UTC 2001


The inode number should not always be 1.  The  psxreaddir,
psxmount, and psxstat tests can be used to check if the
version you have of the imfs is broken  or not.  I saw no
tests in the suit that use getcwd

I do not think the imfs_dir_read sets dp->d_ino,
if you look closely at the code it sets a local variable
and this value is not passed out of the method.

According to the comment at the top, the if
needed if it is a mount point.  The node returned at a mount
point is not of the mounted filesystem, but of the file system
where the mount occured.

Jennifer

Tu Juan wrote:

> see this in getcwd.c:
>       /*
>        * If it's a mount point, have to stat each element because
>        * the inode number in the directory is for the entry in the
>        * parent directory, not the inode number of the mounted file.
>        */
>
>       save_errno = 0;
> if (s.st_dev == dev)   ---------------------- I always goes in here, then
> goto notfound.
>                                                                    I found
> that the dp->d_ino has been set  to 1 in imfs_dir_read (imfs_directory.c)
> {
>    for (;;)
>      {
>        if (!(dp = _readdir (dir)))
>   goto notfound;
>        if (dp->d_ino == ino)
>   break;
>      }
>  }
>     else   --------------------------- I have tested that this is work. I get the correct path.
>  for (;;)
>    {
>      if (!(dp = _readdir (dir)))
>        goto notfound;
>      if (ISDOT (dp))
>        continue;
>      bcopy (dp->d_name, bup, strlen (dp->d_name) + 1);
>
>      /* Save the first error for later. */
>      if (stat (up, &s))
>        {
>   if (!save_errno)
>     save_errno = errno;
>   errno = 0;
>   continue;
>        }
>      if (s.st_dev == dev && s.st_ino == ino)
>        break;
>    }
>
> My question is: Why we need this "if"? or I misunderstand something?
>
> ----- Original Message -----
> From: "Joel Sherrill" <joel.sherrill at OARcorp.com>
> To: "Tu Juan" <jtu at utstar.com>
> Cc: "jennifer averett" <jennifer.averett at OARcorp.com>; <rtems-users at OARcorp.com>
> Sent: Friday, September 07, 2001 12:30 PM
> Subject: Re: about getcwd
>
> >
> >
> > Tu Juan wrote:
> > >
> > > It doesn't work.
> >
> > Could you provide a more specific example of the failure?
> > A test case is very much appreciated.
> >
> > --joel
> >
> > > ----- Original Message -----
> > > From: "jennifer averett" <jennifer.averett at oarcorp.com>
> > > To: "Tu Juan" <jtu at utstar.com>
> > > Cc: <rtems-users at oarcorp.com>
> > > Sent: Friday, September 07, 2001 8:01 AM
> > > Subject: Re: about getcwd
> > >
> > > > I'm sorry but I'm afraid I do not understand the questi
> on.
> > > > Are you saying that the getcwd does not work or are you
> > > > asking how the code works?
> > > >
> > > > Jennifer
> > > >
> > > > Tu Juan wrote:
> > > >
> > > > >    Part 1.1    Type: Plain Text (text/plain)
> > > > >            Encoding: quoted-printable
> >
> > --
> > Joel Sherrill, Ph.D.             Director of Research & Development
> > joel at OARcorp.com                 On-Line Applications Research
> > Ask me about RTEMS: a free RTOS  Huntsville AL 35805
> > Support Available                (256) 722-9985




More information about the users mailing list