next up previous contents index
Next: 22. Database Structures Up: AppDevGuide Previous: 20. libCom OSI libraries   Contents   Index

Subsections


21. Registry

Under vxWorks osiFindGlobalSymbol() can be used to dynamically bind to record, device, and driver support and functions for use with subroutine records. However on most other systems this routine is not functional, so a registry facility is provided to implement the binding. Any item that is looked up by name at runtime must be registered for it to be visible to other code.

At compile time a perl script reads the IOCs database definition file and produces a C source file containing a routine which registers all record/device/driver/function support defined in that file.

21.1 Registry.h

int registryAdd(void *registryID,const char *name,void *data);
    void *registryFind(void *registryID,const char *name);
    int registrySetTableSize(int size);
    void registryFree();
    int registryDump(void);

This is the code which implements the symbol table. Each different type of symbol has its own unique ID. Everything to be registered is stored in the same gpHash table.

21.2 registryRecordType.h

typedef int (*computeSizeOffset)(dbRecordType *pdbRecordType);

typedef struct recordTypeLocation {
    struct rset *prset;
    computeSizeOffset sizeOffset;
} recordTypeLocation;

int registryRecordTypeAdd(const char *name, recordTypeLocation *prtl);
recordTypeLocation *registryRecordTypeFind(const char *name);

Provides addresses for both the record support entry table and the routine which computes the size and offset of each field.

21.3 registryDeviceSupport.h

int registryDeviceSupportAdd(const char *name, struct dset *pdset)
struct dset *registryDeviceSupportFind(const char *name);

This provides addresses for device support entry tables.

21.4 registryDriverSupport.h

int registryDriverSupportAdd(const char *name, struct drvet *pdrvet);
struct drvet *registryDriverSupportFind(const char *name);

int registerRecordDeviceDriver(DBBASE *pdbbase);

This provides addresses for driver support tables.

21.5 registryFunction.h

typedef void (*REGISTRYFUNCTION)(void);

typedef struct registryFunctionRef {
    const char *name;
    REGISTRYFUNCTION addr;
} registryFunctionRef;

int registryFunctionAdd(const char *name, REGISTRYFUNCTION func);
REGISTRYFUNCTION registryFunctionFind(const char *name);
int registryFunctionRefAdd(registryFunctionRef ref[], int nfunctions);

registryFunctionAdd registers a single function. registryFunctionRefAdd registers several functions.

If you use these routines to register functions directly instead of using a function() statement in a database definition file, the registered functions will not appear in the output from the dbDumpFunction command.

21.6 registerRecordDeviceDriver.c

A version of this is provided for vxWorks. This version makes it unnecessary to use registerRecordDeviceDriver.pl or register other external names. Thus for vxWorks everything can work almost exactly like it did in release 3.13.x

21.7 registerRecordDeviceDriver.pl

This is the perl script which creates a C source file that registers record/device/driver/function support. The following steps are take as part of the standard Make rules:


next up previous contents index
Next: 22. Database Structures Up: AppDevGuide Previous: 20. libCom OSI libraries   Contents   Index
Andrew Johnson 2014-02-11