1ZZIP_DISK_MMAP(3) zziplib Function List ZZIP_DISK_MMAP(3)
2
3
4
6 zzip_disk_mmap, zzip_disk_init, zzip_disk_new, zzip_disk_munmap,
7 zzip_disk_open, zzip_disk_close - turn a filehandle into a mmapped zip
8 disk archive handle
9
11 #include <zzip/mmapped.h>
12
13 zzip__new__ ZZIP_DISK* zzip_disk_mmap((int fd));
14
15 int
16 zzip_disk_init((ZZIP_DISK* disk, void* buffer, zzip_size_t buflen));
17
18 zzip__new__ ZZIP_DISK* zzip_disk_new((void));
19
20 int zzip_disk_munmap((ZZIP_DISK* disk));
21
22 ZZIP_DISK* zzip__new__ zzip_disk_open((char* filename));
23
24 int zzip_disk_close((ZZIP_DISK* disk));
25
27 The zzip_disk_mmap function uses the given file-descriptor to detect
28 the length of the file and calls the system mmap(2) to put it in main
29 memory. If it is successful then a newly allocated ZZIP_DISK* is
30 returned with disk->buffer pointing to the mapview of the zipdisk
31 content.
32
33 The zzip_disk_init function does primary initialization of a
34 disk-buffer struct.
35
36 The zzip_disk_new function allocates a new disk-buffer with malloc(3)
37
38 The zzip_disk_munmap function is the inverse of zzip_disk_mmap and
39 using the system munmap(2) on the buffer area and free(3) on the
40 ZZIP_DISK structure.
41
42 The zzip_disk_open function opens the given archive by name and turn
43 the filehandle to zzip_disk_mmap for bringing it to main memory. If it
44 can not be mmap(2)´ed then we slurp the whole file into a newly
45 malloc(2)´ed memory block. Only if that fails too then we return null.
46 Since handling of disk->buffer is ambigous it should not be snatched
47 away please.
48
49 The zzip_disk_close function will release all data needed to access a
50 (mmapped) zip archive, including any malloc()ed blocks, sharedmem
51 mappings and it dumps the handle struct as well.
52
54 · Guido Draheim <guidod@gmx.de>
55
57 Copyright (c) 2003,2004,2006 Guido Draheim All rights reserved, use
58 under the restrictions of the Lesser GNU General Public License or
59 alternatively the restrictions of the Mozilla Public License 1.1
60
61
62
63zziplib 0.13.49 ZZIP_DISK_MMAP(3)