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_mmap function may return null on errors (errno).
37
38       The zzip_disk_init function does primary initialization of a
39       disk-buffer struct.
40
41       The zzip_disk_init function always returns 0 as success.
42
43       The zzip_disk_new function allocates a new disk-buffer with malloc(3)
44
45       The zzip_disk_new function may return null on errors (errno).
46
47       The zzip_disk_munmap function is the inverse of zzip_disk_mmap and
48       using the system munmap(2) on the buffer area and free(3) on the
49       ZZIP_DISK structure.
50
51       The zzip_disk_open function opens the given archive by name and turn
52       the filehandle to zzip_disk_mmap for bringing it to main memory. If it
53       can not be mmap(2)'ed then we slurp the whole file into a newly
54       malloc(2)'ed memory block. Only if that fails too then we return null.
55       Since handling of disk->buffer is ambiguous it should not be snatched
56       away please.
57
58       The zzip_disk_open function may return null on errors (errno).
59
60       The zzip_disk_buffer function will attach a buffer with a zip image
61       that was acquired from another source than a file. Note that if
62       zzip_disk_mmap fails then zzip_disk_open will fall back and try to read
63       the full file to memory wrapping a ZZIP_DISK around the memory buffer
64       just as the zzip_disk_buffer function will do. Note that the
65       zzip_disk_buffer function will not own the buffer, it will neither be
66       written nor free()d.
67
68       The zzip_disk_buffer function may return null (errno).
69
70       The zzip_disk_close function will release all data needed to access a
71       (mmapped) zip archive, including any malloc()ed blocks, sharedmem
72       mappings and it dumps the handle struct as well.
73
74       The zzip_disk_close function returns 0 on success (or whatever munmap
75       says).
76

AUTHOR

78       ยท   Guido Draheim <guidod@gmx.de>
79
81       Copyright (c)Guido Draheim, use under copyleft (LGPL,MPL)
82
83
84
85zziplib                             0.13.69                  ZZIP_DISK_MMAP(3)
Impressum