Use accessor in iocInit
This is simpler than using init hooks.
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "dbDefs.h"
|
||||
#include "dbmf.h"
|
||||
@@ -27,6 +26,7 @@
|
||||
#include "freeList.h"
|
||||
#include "gpHash.h"
|
||||
#include "macLib.h"
|
||||
#include "iocInit.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "dbBase.h"
|
||||
@@ -116,12 +116,6 @@ typedef struct tempListNode {
|
||||
static ELLLIST tempList = ELLLIST_INIT;
|
||||
static void *freeListPvt = NULL;
|
||||
static int duplicate = FALSE;
|
||||
static bool dbLoadRecordsAllowed = true;
|
||||
|
||||
void disableDbLoadRecords()
|
||||
{
|
||||
dbLoadRecordsAllowed = false;
|
||||
}
|
||||
|
||||
static void yyerrorAbort(char *str)
|
||||
{
|
||||
@@ -222,7 +216,7 @@ static long dbReadCOM(DBBASE **ppdbbase,const char *filename, FILE *fp,
|
||||
char *penv;
|
||||
char **macPairs;
|
||||
|
||||
if(!dbLoadRecordsAllowed)
|
||||
if(getIocState() != iocVirgin)
|
||||
return -2;
|
||||
|
||||
if(*ppdbbase == 0) *ppdbbase = dbAllocBase();
|
||||
|
||||
@@ -8,19 +8,12 @@
|
||||
\*************************************************************************/
|
||||
|
||||
#include "iocsh.h"
|
||||
#include "initHooks.h"
|
||||
|
||||
#define epicsExportSharedSymbols
|
||||
#include "dbStaticIocRegister.h"
|
||||
#include "dbStaticLib.h"
|
||||
#include "dbStaticPvt.h"
|
||||
|
||||
static void dbStaticIocRegisterInitHook(initHookState state)
|
||||
{
|
||||
if(state == initHookAtIocBuild)
|
||||
disableDbLoadRecords();
|
||||
}
|
||||
|
||||
/* common arguments */
|
||||
|
||||
static const iocshArg argPdbbase = { "pdbbase", iocshArgPdbbase};
|
||||
@@ -160,7 +153,6 @@ static void dbReportDeviceConfigCallFunc(const iocshArgBuf *args)
|
||||
|
||||
void dbStaticIocRegister(void)
|
||||
{
|
||||
initHookRegister(dbStaticIocRegisterInitHook);
|
||||
iocshRegister(&dbDumpPathFuncDef, dbDumpPathCallFunc);
|
||||
iocshRegister(&dbDumpRecordFuncDef, dbDumpRecordCallFunc);
|
||||
iocshRegister(&dbDumpMenuFuncDef, dbDumpMenuCallFunc);
|
||||
|
||||
@@ -25,7 +25,6 @@ dbDeviceMenu *dbGetDeviceMenu(DBENTRY *pdbentry);
|
||||
void dbFreeLinkContents(struct link *plink);
|
||||
void dbFreePath(DBBASE *pdbbase);
|
||||
int dbIsMacroOk(DBENTRY *pdbentry);
|
||||
void disableDbLoadRecords();
|
||||
|
||||
/*The following routines have different versions for run-time no-run-time*/
|
||||
long dbAllocRecord(DBENTRY *pdbentry,const char *precordName);
|
||||
|
||||
@@ -70,9 +70,7 @@
|
||||
#include "registryRecordType.h"
|
||||
#include "rsrv.h"
|
||||
|
||||
static enum {
|
||||
iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped
|
||||
} iocState = iocVirgin;
|
||||
static enum iocStateEnum iocState = iocVirgin;
|
||||
static enum {
|
||||
buildRSRV, buildIsolated
|
||||
} iocBuildMode;
|
||||
@@ -91,6 +89,11 @@ static void exitDatabase(void *dummy);
|
||||
int dbThreadRealtimeLock = 1;
|
||||
epicsExportAddress(int, dbThreadRealtimeLock);
|
||||
|
||||
enum iocStateEnum getIocState(void)
|
||||
{
|
||||
return iocState;
|
||||
}
|
||||
|
||||
/*
|
||||
* Initialize EPICS on the IOC.
|
||||
*/
|
||||
|
||||
@@ -13,10 +13,15 @@
|
||||
|
||||
#include "shareLib.h"
|
||||
|
||||
enum iocStateEnum {
|
||||
iocVirgin, iocBuilding, iocBuilt, iocRunning, iocPaused, iocStopped
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
epicsShareFunc enum iocStateEnum getIocState(void);
|
||||
epicsShareFunc int iocInit(void);
|
||||
epicsShareFunc int iocBuild(void);
|
||||
epicsShareFunc int iocBuildIsolated(void);
|
||||
|
||||
Reference in New Issue
Block a user