1ZZIP_DISK_MMAP(3)            zziplib Function List           ZZIP_DISK_MMAP(3)
2
3
4

NAME

6       zzip_disk_mmap, zzip_disk_init, zzip_disk_new, zzip_disk_munmap,
7       zzip_disk_open, zzip_disk_buffer, zzip_disk_close - turn a filehandle
8       into a mmapped zip disk archive handle
9

SYNOPSIS

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__new__ ZZIP_DISK * zzip_disk_open((char *filename));
23
24       zzip__new__ ZZIP_DISK *
25                                                zzip_disk_buffer((void *buffer, size_t buflen));
26
27       int zzip_disk_close((ZZIP_DISK * disk));
28

DESCRIPTION

30       The zzip_disk_mmap function uses the given file-descriptor to detect
31       the length of the file and calls the system mmap(2) to put it in main
32       memory. If it is successful then a newly allocated ZZIP_DISK* is
33       returned with disk->buffer pointing to the mapview of the zipdisk
34       content.
35
36       The zzip_disk_init function does primary initialization of a
37       disk-buffer struct.
38
39       The zzip_disk_new function allocates a new disk-buffer with malloc(3)
40
41       The zzip_disk_munmap function is the inverse of zzip_disk_mmap and
42       using the system munmap(2) on the buffer area and free(3) on the
43       ZZIP_DISK structure.
44
45       The zzip_disk_open function opens the given archive by name and turn
46       the filehandle to zzip_disk_mmap for bringing it to main memory. If it
47       can not be mmap(2)'ed then we slurp the whole file into a newly
48       malloc(2)'ed memory block. Only if that fails too then we return null.
49       Since handling of disk->buffer is ambigous it should not be snatched
50       away please.
51
52       The zzip_disk_buffer function will attach a buffer with a zip image
53       that was acquired from another source than a file. Note that if
54       zzip_disk_mmap fails then zzip_disk_open will fall back and try to read
55       the full file to memory wrapping a ZZIP_DISK around the memory buffer
56       just as the zzip_disk_buffer function will do. Note that the
57       zzip_disk_buffer function will not own the buffer, it will neither be
58       written nor free()d.
59
60       The zzip_disk_close function will release all data needed to access a
61       (mmapped) zip archive, including any malloc()ed blocks, sharedmem
62       mappings and it dumps the handle struct as well.
63

AUTHOR

65       ยท   Guido Draheim <guidod@gmx.de>
66
68       Copyright (c) 2003,2004,2006 Guido Draheim All rights reserved, use
69       under the restrictions of the Lesser GNU General Public License or
70       alternatively the restrictions of the Mozilla Public License 1.1
71
72
73
74zziplib                             0.13.62                  ZZIP_DISK_MMAP(3)
Impressum