This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cyg_mtab_lookup()


On Monday, 24. June 2002 22:09, Nick Garnett wrote:
> Roland Caßebohm <roland.cassebohm@visionsystems.de> writes:
> > Hi,
> >
> > there is a problem with cyg_mtab_lookup(). If name has not a leading '/'
> > mte will not be initialized and LOCK_FS() will fail.
> >
> > In cyg_mtab_lookup():
> >
> >     // Unrooted file names go straight to current dir
> >     if( **name != '/' ) return 0;
> >
> >
> > In open():
> >
> >     ret = cyg_mtab_lookup( &dir, &name, &mte );
> >
> >     if( 0 != ret )
> >     {
> >         cyg_fd_free(fd);
> >         cyg_file_free(file);
> >         FILEIO_RETURN(ENOENT);
> >     }
> >
> >     LOCK_FS( mte );
>
> mte is initialized to the mte for the current directory at the start
> of open(). If the name does not start with a '/' then the values are
> left alone and we do all further work relative to the current
> directory. This is exactly what we want to happen.
>
> The current directory is set on system initialization, or when we
> mount the first file system. Until there are real filesystems, with
> real directories, only absolute pathnames can be used.

Ooops, I haven't seen this. My problem seems to be that the current directory 
is not initialized. It is a NULL pointer.
I think in the constructor 

Cyg_Fileio_Init_Class::Cyg_Fileio_Init_Class()
{
    cyg_fd_init();

    cyg_mtab_init();

    chdir("/");
}

the current directory should be initialized. I haven't a real filesystem, so 
chdir() can't find the "/" entry and left cdir_mtab_entry at NULL.

Roland

-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]