FSEG-SPI
FLAM Segment Store Exit (FSEG) Service Provider Interface (SPI) Version: 5.2.1-42969
Provider entry point

The single exported function that a FSEG provider DLL/SO must implement. More...

Typedefs

typedef void TfFsegExit(void *pvGbl, void **ppHdl, int *piRetco, const unsigned int *piVersion, const unsigned int *piFunc, TuFsegPar *puPara, const unsigned int *piMsgSiz, char *pcMsg)
 FSEG provider entry point function type.

Detailed Description

The single exported function that a FSEG provider DLL/SO must implement.

Typedef Documentation

◆ TfFsegExit

typedef void TfFsegExit(void *pvGbl, void **ppHdl, int *piRetco, const unsigned int *piVersion, const unsigned int *piFunc, TuFsegPar *puPara, const unsigned int *piMsgSiz, char *pcMsg)

FSEG provider entry point function type.

This is the only symbol that a FSEG provider library must export. The default exported name is FSEG_DEFFUC_NAME ("FSEGUSR").

Parameter table
Parameter Direction Type Description
pvGbl in POINTER FLAM global handle (struct Fl5Gbl*);
NULL-safe. External providers may
ignore it. FLAM-internal providers
may cast it to struct Fl5Gbl* to use
FLAM logging and I/O services.
ppHdl in/out POINTER Provider handle. NULL on first OPN;
set by provider at OPN, freed at CLS.
piRetco out INTEGER Return code (0 = success).
piVersion in INTEGER Interface version (FSEG_VERSION).
Together with *piFunc, determines
the active TuFsegPar union member.
Providers should return an error from
OPN if the major version differs.
piFunc in INTEGER Function code (FSEG_FUNC_*).
puPara in/out POINTER Parameter union; member by *piFunc.
piMsgSiz in INTEGER Capacity of pcMsg buffer in bytes.
pcMsg out POINTER Error/info message (null-terminated).
Note
On a successful OPN with an informational message, the provider may write a non-empty string to pcMsg; FLAM will log it as an informational message. On error, set *piRetco != 0 and write a diagnostic string to pcMsg.
Lifecycle: *ppHdl is NULL on FSEG_FUNC_NEW; the provider allocates a handle and writes its address to *ppHdl. All subsequent calls pass the same handle until FSEG_FUNC_FRE, at which point the provider must free the handle and set *ppHdl to NULL. FSEG_FUNC_CLS closes the storage connection but does not free the handle.
Minimal skeleton
void FSEGUSR(
void* pvGbl,
void** ppHdl,
int* piRetco,
const unsigned int* piVersion,
const unsigned int* piFunc,
TuFsegPar* puPara,
const unsigned int* piMsgSiz,
char* pcMsg)
{
(void)pvGbl;
snprintf(pcMsg, *piMsgSiz, "FSEG version mismatch: %u", *piVersion);
*piRetco = 1;
return;
}
*piRetco = 0;
switch (*piFunc) {
case FSEG_FUNC_OPN: ... break;
case FSEG_FUNC_CLS: ... break;
case FSEG_FUNC_PUT: ... break;
case FSEG_FUNC_GET: ... break;
default:
snprintf(pcMsg, *piMsgSiz,
"Unknown function code %u", *piFunc);
*piRetco = 1;
}
}
#define FSEG_FUNC_CLS
Close / disconnect from storage. The provider handle is not freed; the handle returns to NEW state....
Definition FSEG.h:151
#define FSEG_FUNC_GET
Retrieve a segment by integer key (locate, no copy). OPEN state only.
Definition FSEG.h:156
#define FSEG_FUNC_OPN
Open storage / connect to archive namespace. Requires prior FSEG_FUNC_NEW (*ppHdl must not be NULL)....
Definition FSEG.h:146
#define FSEG_FUNC_PUT
Store a segment (integer key -> blob). OPEN state only.
Definition FSEG.h:153
union FsegPar TuFsegPar
Union of all FSEG function parameter structures.
#define FSEG_VER_MAJOR(v)
Extract major version from a version word.
Definition FSEG.h:241
#define FSEG_VERSION
Current FSEG interface version (major=2, minor=0).
Definition FSEG.h:239