--- freem/src/global_bltin.h 2025/04/09 00:43:07 1.8 +++ freem/src/global_bltin.h 2025/04/11 14:21:03 1.11 @@ -1,5 +1,5 @@ /* - * $Id: global_bltin.h,v 1.8 2025/04/09 00:43:07 snw Exp $ + * $Id: global_bltin.h,v 1.11 2025/04/11 14:21:03 snw Exp $ * built-in global handler header * * @@ -24,6 +24,15 @@ * along with FreeM. If not, see . * * $Log: global_bltin.h,v $ + * Revision 1.11 2025/04/11 14:21:03 snw + * Make all but one of the read/write calls in global_bltin use gbl_read_block or gbl_write_block + * + * Revision 1.10 2025/04/11 00:52:40 snw + * Replace all lseek/read calls in global handler to use gbl_read_block function + * + * Revision 1.9 2025/04/09 14:34:30 snw + * Further work on global_bltin.c refactor + * * Revision 1.8 2025/04/09 00:43:07 snw * Exit with fatal error if a header mismatch found * @@ -81,12 +90,19 @@ typedef struct global_handle { int fd; /* file descriptor */ global_header header; - long use_count; /* how many times has it been accessed? */ + long age; short opened; short locked; unsigned long last_block; + unsigned long use_count; /* how many times has it been accessed? */ + unsigned long read_ops; + unsigned long write_ops; + unsigned long splits; + unsigned long cache_misses; + unsigned long cache_hits; + short fast_path; char global_name[256]; @@ -98,9 +114,12 @@ typedef struct global_handle { } global_handle; extern global_handle *global_handles_head; - +extern unsigned long gbl_cache_misses; +extern unsigned long gbl_cache_hits; extern inline long gbl_path(char *key, char *buf); +extern void gbl_cache_hit(global_handle *g); +extern void gbl_cache_miss(global_handle *g); extern int gbl_lock(global_handle *g, int type); extern int gbl_unlock(global_handle *g); extern void gbl_close(global_handle *g); @@ -111,6 +130,8 @@ extern int gbl_read_header(global_handle 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 int gbl_read_block(global_handle *g, unsigned long blocknum, char *block); +extern int gbl_write_block(global_handle *g, unsigned long blocknum, char *block); extern global_handle *gbl_handle(char *key); #endif