version 1.8, 2025/04/09 00:43:07
|
version 1.13, 2025/04/13 04:22:43
|
Line 24
|
Line 24
|
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* along with FreeM. If not, see <https://www.gnu.org/licenses/>. |
* |
* |
* $Log$ |
* $Log$ |
|
* Revision 1.13 2025/04/13 04:22:43 snw |
|
* Fix snprintf calls |
|
* |
|
* Revision 1.12 2025/04/11 16:23:18 snw |
|
* Avoid re-reading the same block consecutively when possible |
|
* |
|
* 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 |
* Revision 1.8 2025/04/09 00:43:07 snw |
* Exit with fatal error if a header mismatch found |
* Exit with fatal error if a header mismatch found |
* |
* |
Line 61
|
Line 76
|
#define GBL_HDR_BADVERSION 3 |
#define GBL_HDR_BADVERSION 3 |
#define GBL_HDR_BADBLOCKSIZE 4 |
#define GBL_HDR_BADBLOCKSIZE 4 |
|
|
|
#define ROOT 0L |
|
|
|
/* end of line symbol in global module is 30, which is a code not */ |
|
/* otherwise used in subscripts */ |
|
#define g_EOL 30 |
|
|
|
#define EOL1 EOL |
|
|
|
/* numerics (('.'<<1)&037)==28 ; (('-'<<1)&037)==26; */ |
|
#define POINT 28 |
|
#define MINUS 26 |
|
|
|
/* ALPHA and OMEGA are dummy subscripts in $order processing */ |
|
/* ALPHA sorts before all other subscripts */ |
|
/* OMEGA sorts after all other subscripts */ |
|
/* e.g. ("abc") -> "abc",OMEGA ; ("abc","") -> "abc",ALPHA */ |
|
#define OMEGA 29 |
|
#define ALPHA 31 |
|
|
|
/* length of blocks. status bytes defined as offset to blocklength */ |
|
/* BLOCKLEN 1024 is defined in mpsdef0 include file */ |
|
#define DATALIM (BLOCKLEN-11) |
|
#define LLPTR (BLOCKLEN-10) |
|
#define NRBLK LLPTR |
|
#define COLLA (BLOCKLEN- 7) |
|
#define RLPTR (BLOCKLEN- 6) |
|
#define FREE RLPTR |
|
#define BTYP (BLOCKLEN- 3) |
|
#define OFFS (BLOCKLEN- 2) |
|
|
|
/* length of blockpointers in bytes */ |
|
#define PLEN 3 |
|
|
|
#define EMPTY 0 |
|
#define FBLK 1 |
|
#define POINTER 2 |
|
#define BOTTOM 6 |
|
#define DATA 8 |
|
|
typedef struct global_header { |
typedef struct global_header { |
|
|
char magic[5]; /* FRMGL */ |
char magic[5]; /* FRMGL */ |
Line 81 typedef struct global_handle {
|
Line 135 typedef struct global_handle {
|
int fd; /* file descriptor */ |
int fd; /* file descriptor */ |
|
|
global_header header; |
global_header header; |
long use_count; /* how many times has it been accessed? */ |
|
long age; |
long age; |
|
long last_read_time; |
|
|
short opened; |
short opened; |
short locked; |
short locked; |
unsigned long last_block; |
unsigned long last_block; |
|
short have_cached_block; |
|
unsigned long cached_block_num; |
|
|
|
char *last_block_accessed; |
|
|
|
unsigned long use_count; /* how many times has it been accessed? */ |
|
unsigned long read_ops; |
|
unsigned long write_ops; |
|
unsigned long memory_reads; |
|
unsigned long splits; |
|
unsigned long cache_misses; |
|
unsigned long cache_hits; |
|
|
short fast_path; |
short fast_path; |
|
|
Line 98 typedef struct global_handle {
|
Line 166 typedef struct global_handle {
|
} global_handle; |
} global_handle; |
|
|
extern global_handle *global_handles_head; |
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 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_lock(global_handle *g, int type); |
extern int gbl_unlock(global_handle *g); |
extern int gbl_unlock(global_handle *g); |
extern void gbl_close(global_handle *g); |
extern void gbl_close(global_handle *g); |
Line 111 extern int gbl_read_header(global_handle
|
Line 182 extern int gbl_read_header(global_handle
|
extern int gbl_update_tid(global_handle *g); |
extern int gbl_update_tid(global_handle *g); |
extern int gbl_create(global_handle *g); |
extern int gbl_create(global_handle *g); |
extern short gbl_open(global_handle *g, short action); |
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); |
extern global_handle *gbl_handle(char *key); |
|
|
#endif |
#endif |