1 .\" $NetBSD: cdbw.3,v 1.8 2014/02/06 15:50:40 rmind Exp $
3 .\" Copyright (c) 2010 The NetBSD Foundation, Inc.
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to The NetBSD Foundation
7 .\" by Joerg Sonnenberger.
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
12 .\" 1. Redistributions of source code must retain the above copyright
13 .\" notice, this list of conditions and the following disclaimer.
14 .\" 2. Redistributions in binary form must reproduce the above copyright
15 .\" notice, this list of conditions and the following disclaimer in
16 .\" the documentation and/or other materials provided with the
19 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 .Nm cdbw_stable_seeder ,
42 .Nd create constant databases
49 .Fa "struct cdbw *cdbw"
52 .Fa "const void *data"
57 .Fa "struct cdbw *cdbw"
58 .Fa "const void *data"
64 .Fa "struct cdbw *cdbw"
70 .Fo cdbw_stable_seeder
75 .Fa "struct cdbw *cdbw"
77 .Fa "const char descr[16]"
78 .Fa "uint32_t (*seedgen)(void)"
81 .Fn cdbw_close "struct cdbw *cdbw"
85 functions are used to create a constant databases for use with
87 Details about the file format, including overhead and limitations,
95 The function returns a handle to pass to the other functions.
98 frees all resources associated with the handle.
101 adds the given (key,value) pair after checking for a duplicate key.
103 adds the given value to the writer without adding a key reference.
104 The returned index can be used in subsequent calls to
106 to add one or more keys pointing to this value.
108 checks for duplicate keys and valid index arguments.
109 On success it adds the given key.
112 computes the database file and writes it to the given descriptor.
113 The function returns an error if the file cannot be written correctly.
116 parameter provides a human readable description of the database content.
119 parameter can be used to override the default PRNG.
120 The bitwise layout of the output depends on the chosen seed.
121 The function should return a different value for each invocation.
123 .Fn cdbw_stable_seeder
124 can be used to create reproducible output.
125 It may be slower than the default.
132 format first appeared in
139 functions have been written by
140 .An Joerg Sonnenberger Aq Mt joerg@NetBSD.org .