Annotation of freem/src/global_bltin.h, revision 1.6

1.1       snw         1: /*
1.6     ! snw         2:  *   $Id: global_bltin.h,v 1.5 2025/04/08 16:46:11 snw Exp $
1.1       snw         3:  *    built-in global handler header
                      4:  *
                      5:  *  
1.2       snw         6:  *   Author: Serena Willis <snw@coherent-logic.com>
1.1       snw         7:  *    Copyright (C) 1998 MUG Deutschland
1.3       snw         8:  *    Copyright (C) 2020, 2025 Coherent Logic Development LLC
1.1       snw         9:  *
                     10:  *
                     11:  *   This file is part of FreeM.
                     12:  *
                     13:  *   FreeM is free software: you can redistribute it and/or modify
                     14:  *   it under the terms of the GNU Affero Public License as published by
                     15:  *   the Free Software Foundation, either version 3 of the License, or
                     16:  *   (at your option) any later version.
                     17:  *
                     18:  *   FreeM is distributed in the hope that it will be useful,
                     19:  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
                     20:  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     21:  *   GNU Affero Public License for more details.
                     22:  *
                     23:  *   You should have received a copy of the GNU Affero Public License
                     24:  *   along with FreeM.  If not, see <https://www.gnu.org/licenses/>.
                     25:  *
1.4       snw        26:  *   $Log: global_bltin.h,v $
1.6     ! snw        27:  *   Revision 1.5  2025/04/08 16:46:11  snw
        !            28:  *   Add global file header and offsets
        !            29:  *
1.5       snw        30:  *   Revision 1.4  2025/04/08 14:39:21  snw
                     31:  *   Initial work on global handler refactor
                     32:  *
1.4       snw        33:  *   Revision 1.3  2025/03/09 19:14:25  snw
                     34:  *   First phase of REUSE compliance and header reformat
                     35:  *
1.3       snw        36:  *
                     37:  * SPDX-FileCopyrightText:  (C) 2025 Coherent Logic Development LLC
                     38:  * SPDX-License-Identifier: AGPL-3.0-or-later
1.1       snw        39:  **/
1.4       snw        40: 
                     41: #if !defined(__FREEM_GLOBAL_BLTIN_H)
                     42: # define __FREEM_GLOBAL_BLTIN_H
                     43: 
1.5       snw        44: #include "version.h"
                     45: 
                     46: #define GBL_FORMAT_VERSION 2
                     47: #define GBL_MAGIC "FRMGL"
                     48: 
1.6     ! snw        49: #define GBL_HDR_OK 0
        !            50: #define GBL_HDR_NOTOPEN 1
        !            51: #define GBL_HDR_BADMAGIC 2
        !            52: #define GBL_HDR_BADVERSION 3
        !            53: #define GBL_HDR_BADBLOCKSIZE 4
        !            54: 
1.5       snw        55: typedef struct global_header {
                     56:     
                     57:     char magic[5]; /* FRMGL */
                     58:     int format_version;
                     59:     char host_triplet[40];
                     60: 
                     61:     unsigned long block_size;
                     62:     unsigned long last_transaction_id;
                     63: 
                     64:     long created;
                     65:     long last_backup;
                     66:     
                     67: } global_header;
                     68: 
1.4       snw        69: typedef struct global_handle {
                     70: 
                     71:     int fd; /* file descriptor */
1.5       snw        72: 
                     73:     global_header header;
1.4       snw        74:     long use_count; /* how many times has it been accessed? */
                     75:     long age;
                     76:     short opened;
                     77:     short locked;
                     78:     unsigned long last_block;
1.5       snw        79:     
1.4       snw        80:     short fast_path;
                     81:     
                     82:     char global_name[256];
                     83:     char global_path[4096];
                     84: 
                     85:     
                     86:     struct global_handle *next;   
                     87:     
                     88: } global_handle;
                     89: 
                     90: extern global_handle *global_handles_head;
                     91: 
                     92: #endif

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>