Files
epics-base/modules/database/src/ioc/db/dbCommonPvt.h
Michael Davidsaver 3d70e70640 Add dbPvt2Rec() cast
Reverse of dbRec2Pvt()

pacify -D_FORTIFY_SOURCE=3 and __builtin_object_size() as
"&precord->common" does not know than common as actually
the prefix of a variable sized struct.
2024-08-21 10:01:26 -05:00

36 lines
727 B
C

#ifndef DBCOMMONPVT_H
#define DBCOMMONPVT_H
#include <compilerDependencies.h>
#include <dbDefs.h>
#include "dbCommon.h"
struct epicsThreadOSD;
/** Base internal additional information for every record
*/
typedef struct dbCommonPvt {
struct dbRecordNode *recnode;
/* Thread which is currently processing this record */
struct epicsThreadOSD* procThread;
/* actually followed by:
* struct dbCommon common;
*/
} dbCommonPvt;
static EPICS_ALWAYS_INLINE
dbCommonPvt* dbRec2Pvt(struct dbCommon *prec)
{
return (dbCommonPvt*)((char*)prec - sizeof(dbCommonPvt));
}
static EPICS_ALWAYS_INLINE
dbCommon* dbPvt2Rec(struct dbCommonPvt *pvt)
{
return (dbCommon*)&pvt[1];
}
#endif // DBCOMMONPVT_H