Use a special RTEMS-specific version of fopen to add the RTEMS TFTP
prefix to path names. This is a cleaner solution since it requires no changes to any other EPICS code and works for all places that files are opened.
This commit is contained in:
@@ -62,7 +62,7 @@ OS_CLASS = RTEMS
|
||||
|
||||
#--------------------------------------------------
|
||||
# Operating system flags
|
||||
OP_SYS_CPPFLAGS = -Dmain=rtems_main -DIOCSH_USE_READLINE
|
||||
OP_SYS_CPPFLAGS = -Dfopen=rtems_fopen -Dmain=rtems_main -DIOCSH_USE_READLINE
|
||||
OP_SYS_LDLIBS = -lreadline -lcurses
|
||||
OP_SYS_LDFLAGS = $(CPU_CFLAGS) -u Init -lCom \
|
||||
$(PROJECT_RELEASE)/lib/no-dpmem.rel \
|
||||
|
||||
@@ -276,40 +276,21 @@ static void ioccrfRegisterRTEMS (void)
|
||||
}
|
||||
|
||||
/*
|
||||
* Wrappers for EPICS routines which refer to file names.
|
||||
* Since RTEMS doesn't have NFS we fake it by making sure that
|
||||
* all paths refer to files in the TFTP area.
|
||||
*/
|
||||
long
|
||||
dbLoadDatabaseRTEMS (char *name)
|
||||
#ifdef fopen
|
||||
# undef fopen
|
||||
extern FILE *fopen (const char *, const char *);
|
||||
#endif
|
||||
FILE *rtems_fopen (const char *name, const char *mode)
|
||||
{
|
||||
FILE *fp;
|
||||
char *cp = rtems_tftp_path (name);
|
||||
int dbLoadDatabase (char *filename, char *path, char *substitutions);
|
||||
|
||||
dbLoadDatabase (cp, "/", NULL);
|
||||
free (cp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
long
|
||||
dbLoadRecordsRTEMS (char *name, char *substitutions)
|
||||
{
|
||||
char *cp = rtems_tftp_path (name);
|
||||
int dbLoadRecords (char* pfilename, char* substitutions);
|
||||
|
||||
dbLoadRecords (cp, substitutions);
|
||||
free (cp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
runScriptRTEMS (const char *name)
|
||||
{
|
||||
char *cp;
|
||||
|
||||
cp = rtems_tftp_path (name);
|
||||
ioccrf (cp);
|
||||
fp = fopen (cp, mode);
|
||||
free (cp);
|
||||
return fp;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -383,7 +364,7 @@ Init (rtems_task_argument ignored)
|
||||
ioccrfRegisterCommon ();
|
||||
ioccrfRegisterRTEMS ();
|
||||
registerRecordDeviceDriverRegister ();
|
||||
runScriptRTEMS ("st.cmd");
|
||||
ioccrf ("st.cmd");
|
||||
|
||||
/*
|
||||
* Everything's running!
|
||||
|
||||
Reference in New Issue
Block a user