--- freem/src/global_bltin.h 2025/04/08 16:46:11 1.5 +++ freem/src/global_bltin.h 2025/04/08 21:41:13 1.7 @@ -1,5 +1,5 @@ /* - * $Id: global_bltin.h,v 1.5 2025/04/08 16:46:11 snw Exp $ + * $Id: global_bltin.h,v 1.7 2025/04/08 21:41:13 snw Exp $ * built-in global handler header * * @@ -24,6 +24,12 @@ * along with FreeM. If not, see . * * $Log: global_bltin.h,v $ + * Revision 1.7 2025/04/08 21:41:13 snw + * Make insert, update, and splitp global handler functions take a ptr to a global_handle instead of a file descriptor + * + * Revision 1.6 2025/04/08 20:00:56 snw + * Global handler now uses a header file and maintains the last journaling transaction ID + * * Revision 1.5 2025/04/08 16:46:11 snw * Add global file header and offsets * @@ -46,6 +52,12 @@ #define GBL_FORMAT_VERSION 2 #define GBL_MAGIC "FRMGL" +#define GBL_HDR_OK 0 +#define GBL_HDR_NOTOPEN 1 +#define GBL_HDR_BADMAGIC 2 +#define GBL_HDR_BADVERSION 3 +#define GBL_HDR_BADBLOCKSIZE 4 + typedef struct global_header { char magic[5]; /* FRMGL */ @@ -83,4 +95,18 @@ typedef struct global_handle { extern global_handle *global_handles_head; + +extern inline long gbl_path(char *key, char *buf); +extern int gbl_lock(global_handle *g, int type); +extern int gbl_unlock(global_handle *g); +extern void gbl_close(global_handle *g); +extern void gbl_close_all(void); +extern int gbl_write_initial_header(global_handle *g); +extern int gbl_write_header(global_handle *g, global_header *hdr); +extern int gbl_read_header(global_handle *g, global_header *h); +extern int gbl_update_tid(global_handle *g); +extern int gbl_create(global_handle *g); +extern short gbl_open(global_handle *g, short action); +extern global_handle *gbl_handle(char *key); + #endif