--- lbbs/include/file_loader.h 2025/05/16 12:22:35 1.1 +++ lbbs/include/file_loader.h 2025/11/04 14:58:55 1.7 @@ -1,18 +1,10 @@ -/*************************************************************************** - file_loader.h - description - ------------------- - Copyright : (C) 2004-2025 by Leaflet - Email : leaflet@leafok.com - ***************************************************************************/ - -/*************************************************************************** - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 3 of the License, or * - * (at your option) any later version. * - * * - ***************************************************************************/ +/* SPDX-License-Identifier: GPL-3.0-or-later */ +/* + * file_loader + * - shared memory based file loader + * + * Copyright (C) 2004-2025 Leaflet + */ #ifndef _FILE_LOADER_H_ #define _FILE_LOADER_H_ @@ -20,21 +12,13 @@ #include "common.h" #include -struct file_mmap_t -{ - size_t size; - void *p_data; - long line_offsets[MAX_FILE_LINES]; - long line_total; -}; -typedef struct file_mmap_t FILE_MMAP; - -extern int file_loader_init(int max_file_mmap_count); +extern int file_loader_init(void); extern void file_loader_cleanup(void); -extern int load_file_mmap(const char *filename); -extern int unload_file_mmap(const char *filename); +extern int load_file(const char *filename); +extern int unload_file(const char *filename); -extern const FILE_MMAP *get_file_mmap(const char *filename); +extern const void *get_file_shm_readonly(const char *filename, size_t *p_data_len, long *p_line_total, const void **pp_data, const long **pp_line_offsets); +extern int detach_file_shm(const void *p_shm); #endif //_FILE_LOADER_H_