`clever' C preprocessor trick now causes problems

Till Straumann strauman at SLAC.Stanford.EDU
Tue Sep 25 02:21:49 UTC 2001


norume at young.usask.ca wrote:

> Quoting Till Straumann <strauman at SLAC.Stanford.EDU>:
>
>

-- snip --

>
>
> >
> > In this case, neither gcc nor EPICS seems to be the problem but the
> > rudimentary
> > implementation of filesystems in RTEMS and the lack of directory support
> > in
> > TFTPfs.
>
> True, but the TFTP filesystem does support directories the the extent that the startup scripts use them.  Here's the startup script from exampleApp:
> ============================================================
> dbLoadDatabase("../../dbd/example.dbd",0,0)
> registerRecordDeviceDriver(pdbbase)
> dbLoadRecords("../../db/dbExample1.db","user=norume")
> dbLoadRecords("../../db/dbExample2.db","user=norume,no=1,scan=1 second")
> dbLoadRecords("../../db/dbExample2.db","user=norume,no=2,scan=2 second")
> dbLoadRecords("../../db/dbExample2.db","user=norume,no=3,scan=5 second")
> iocInit()
> #seq sncExample,"user=norume"
> ============================================================
>
> On my TFTP server these appear as:
> /tftpboot/epics/norumx3/bin/example.bt
> /tftpboot/epics/norumx3/dbd/example.dbd
> /tftpboot/epics/norumx3/db/dbExample1.db
> /tftpboot/epics/norumx3/db/dbExample2.db
> /tftpboot/epics/norumx3/st.cmd
>

Sure - but this doesn't work _without_ your 'pre-fopen' hack on the
pathnames, i.e. the TFTPfs does not support directories (i.e.
rtems_filesystem_node_type() never returns RTEMS_FILESYSTEM_DIRECTORY
and hence a chdir() is impossible. Therefore, it's also impossible to support
relative paths.

Here's an idea how (very rudimentary) relative path support could be added
to TFTPfs:

- TFTPfs'  rtems_filesystem_node_type() returns 'RTEMS_FILESYSTEM_DIRECTORY'
   to any call with a pathname argument ending with a slash ('/').  It also stores (a
   copy of) the pathname in the node_access field. (hence the freenode method
   would have to be implemented also).

- TFTPfs' rtems_filesystem_evaluate_path() assembles the absolute path
   from the prefix (stored in cwd's node_access) and the relative path argument.
   It then eliminates all occurrences of '.' and '..' before proceeding.

   Note: this works only as long as no mount points or links are crossed (which
   are not implemented by TFTPfs anyway).

The iocsh should then do a eg. chdir("/TFTP/BOOTP_HOST/epics/norumx3/blah/blah/")
when initializing. This will record "/BOOTP_HOST/epics/norumx3/blah/blah"
in the cwd structure.

Regards, Till.




More information about the users mailing list