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
14       zzip__new__ ZZIP_DISK *
15       zzip_disk_mmap(int fd)
16
17       int
18       zzip_disk_init(ZZIP_DISK * disk, void *buffer, zzip_size_t buflen)
19
20       zzip__new__ ZZIP_DISK *
21       zzip_disk_new(void)
22
23       int
24       zzip_disk_munmap(ZZIP_DISK * disk)
25
26       zzip__new__ ZZIP_DISK *
27       zzip_disk_open(char *filename)
28
29       zzip__new__ ZZIP_DISK *
30       zzip_disk_buffer(void *buffer, size_t buflen)
31       int
32       zzip_disk_close(ZZIP_DISK * disk)
33
34
35
36

DESCRIPTION

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

AUTHOR

88        Guido Draheim <guidod@gmx.de>
89
90
91
93        Copyright (c)Guido Draheim, use under copyleft (LGPL,MPL)
94
95
96
97
98
99zziplib                             0.13.72                  zzip_disk_mmap(3)
Impressum