From c0cbbd8bee930e69eac8e4a7d58a0403b9906864 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Tue, 24 Oct 2017 10:44:47 -0500 Subject: [PATCH] ioc/dbStatic: add dbGetDevLink() --- src/ioc/db/dbAccess.c | 12 ++++++++++++ src/ioc/dbStatic/devSup.h | 7 +++++++ 2 files changed, 19 insertions(+) diff --git a/src/ioc/db/dbAccess.c b/src/ioc/db/dbAccess.c index 973a66836..e1e354370 100644 --- a/src/ioc/db/dbAccess.c +++ b/src/ioc/db/dbAccess.c @@ -709,6 +709,18 @@ void dbInitEntryFromRecord(struct dbCommon *prec, DBENTRY *pdbentry) pdbentry->precnode = ppvt->recnode; } +struct link* dbGetDevLink(struct dbCommon* prec) +{ + DBLINK *plink = 0; + DBENTRY entry; + dbInitEntryFromRecord(prec, &entry); + if(dbFindField(&entry, "INP")==0 || dbFindField(&entry, "OUT")==0) { + plink = (DBLINK*)entry.pfield; + } + dbFinishEntry(&entry); + return plink; +} + long dbValueSize(short dbr_type) { /* sizes for value associated with each DBR request type */ diff --git a/src/ioc/dbStatic/devSup.h b/src/ioc/dbStatic/devSup.h index aa3aa5c3d..63ffb36ce 100644 --- a/src/ioc/dbStatic/devSup.h +++ b/src/ioc/dbStatic/devSup.h @@ -22,6 +22,7 @@ struct dbCommon; struct devSup; struct ioscan_head; /* aka IOSCANPVT */ +struct link; /* aka DBLINK */ #ifdef __cplusplus extern "C" { @@ -112,6 +113,12 @@ typedef struct dsxt { /* device support extension table */ /* Recordtypes are *not* allowed to extend this table */ } dsxt; +/** Fetch INP or OUT link (or NULL if record type has neither). + * + * Recommended for use in device support init_record() + */ +epicsShareFunc struct link* dbGetDevLink(struct dbCommon* prec); + epicsShareExtern dsxt devSoft_DSXT; /* Allow anything table */ epicsShareFunc void devExtend(dsxt *pdsxt);