zzip_disk_mmap (3)
Leading comments
Title: zzip_disk_mmap Author: [see the "Author" section] Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/> Date: 0.13.62 Manual: zziplib Function List Source: zziplib Language: English
NAME
zzip_disk_mmap, zzip_disk_init, zzip_disk_new, zzip_disk_munmap, zzip_disk_open, zzip_disk_buffer, zzip_disk_close - turn a filehandle into a mmapped zip disk archive handleSYNOPSIS
#include <zzip/mmapped.h>
-
zzip__new__ ZZIP_DISK * zzip_disk_mmap((int fd));
- int zzip_disk_init((ZZIP_DISK * disk, void *buffer, zzip_size_t buflen));
- zzip__new__ ZZIP_DISK * zzip_disk_new((void));
- int zzip_disk_munmap((ZZIP_DISK * disk));
- zzip__new__ ZZIP_DISK * zzip_disk_open((char *filename));
- zzip__new__ ZZIP_DISK * zzip_disk_buffer((void *buffer, size_t buflen));
- int zzip_disk_close((ZZIP_DISK * disk));
- int zzip_disk_init((ZZIP_DISK * disk, void *buffer, zzip_size_t buflen));
DESCRIPTION
The zzip_disk_init function does primary initialization of a disk-buffer struct.
The zzip_disk_new function allocates a new disk-buffer with malloc(3)
The zzip_disk_munmap function is the inverse of zzip_disk_mmap and using the system munmap(2) on the buffer area and free(3) on the ZZIP_DISK structure.
The zzip_disk_open function opens the given archive by name and turn the filehandle to zzip_disk_mmap for bringing it to main memory. If it can not be mmap(2)'ed then we slurp the whole file into a newly malloc(2)'ed memory block. Only if that fails too then we return null. Since handling of disk->buffer is ambigous it should not be snatched away please.
The zzip_disk_buffer function will attach a buffer with a zip image that was acquired from another source than a file. Note that if zzip_disk_mmap fails then zzip_disk_open will fall back and try to read the full file to memory wrapping a ZZIP_DISK around the memory buffer just as the zzip_disk_buffer function will do. Note that the zzip_disk_buffer function will not own the buffer, it will neither be written nor free()d.
The zzip_disk_close function will release all data needed to access a (mmapped) zip archive, including any malloc()ed blocks, sharedmem mappings and it dumps the handle struct as well.
AUTHOR
- * Guido Draheim <guidod@gmx.de>
COPYRIGHT
Copyright (c) 2003,2004,2006 Guido Draheim All rights reserved, use under the restrictions of the Lesser GNU General Public License or alternatively the restrictions of the Mozilla Public License 1.1