From ca2003bb6338e9ee153fdd7cbc6e52328946f476 Mon Sep 17 00:00:00 2001 From: Andrew Johnson Date: Sat, 31 Mar 2018 15:42:35 +0100 Subject: [PATCH] dbLink: Clarify meaning of lset isConstant and isVolatile flags Modify dbIsLinkConnected() to check lset->isVolatile first. --- src/ioc/db/dbLink.c | 13 ++++++++++++- src/ioc/db/dbLink.h | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/ioc/db/dbLink.c b/src/ioc/db/dbLink.c index c90dcb3df..ed46a9b51 100644 --- a/src/ioc/db/dbLink.c +++ b/src/ioc/db/dbLink.c @@ -265,8 +265,19 @@ int dbIsLinkConnected(const struct link *plink) { lset *plset = plink->lset; - if (!plset || !plset->isConnected) + if (!plset) return FALSE; + if (!plset->isVolatile) + return TRUE; + + if (!plset->isConnected) { + struct dbCommon *precord = plink->precord; + + errlogPrintf("dbLink: Link type for '%s.%s' is volatile but has no" + " lset::isConnected() method\n", + precord->name, link_field_name(plink)); + return FALSE; + } return plset->isConnected(plink); } diff --git a/src/ioc/db/dbLink.h b/src/ioc/db/dbLink.h index ad4ac2f45..d6f39ca36 100644 --- a/src/ioc/db/dbLink.h +++ b/src/ioc/db/dbLink.h @@ -31,8 +31,8 @@ typedef long (*dbLinkUserCallback)(struct link *plink, void *priv); typedef struct lset { /* Characteristics of the link type */ - const unsigned isConstant:1; - const unsigned isVolatile:1; + const unsigned isConstant:1; /* 1 means value doesn't change */ + const unsigned isVolatile:1; /* 0 means link always connected */ /* Activation */ void (*openLink)(struct link *plink);