Apache HTTPD
framework
httpd-2.4.62
srclib
apr-util
dbm
sdbm
sdbm_private.h
Go to the documentation of this file.
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
2
* contributor license agreements. See the NOTICE file distributed with
3
* this work for additional information regarding copyright ownership.
4
* The ASF licenses this file to You under the Apache License, Version 2.0
5
* (the "License"); you may not use this file except in compliance with
6
* the License. You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
/*
18
* sdbm - ndbm work-alike hashed database library
19
* based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978).
20
* author:
[email protected]
21
*/
22
23
#ifndef SDBM_PRIVATE_H
24
#define SDBM_PRIVATE_H
25
26
#include "apr.h"
27
#include "
apr_pools.h
"
28
#include "
apr_file_io.h
"
29
#include "
apr_errno.h
"
/* for apr_status_t */
30
31
#if 0
32
/* if the block/page size is increased, it breaks perl apr_sdbm_t compatibility */
33
#define DBLKSIZ 16384
34
#define PBLKSIZ 8192
35
#define PAIRMAX 8008
/* arbitrary on PBLKSIZ-N */
36
#else
37
#define DBLKSIZ 4096
38
#define PBLKSIZ 1024
39
#define PAIRMAX 1008
/* arbitrary on PBLKSIZ-N */
40
#endif
41
#define SPLTMAX 10
/* maximum allowed splits */
42
43
/* for apr_sdbm_t.flags */
44
#define SDBM_RDONLY 0x1
/* data base open read-only */
45
#define SDBM_SHARED 0x2
/* data base open for sharing */
46
#define SDBM_SHARED_LOCK 0x4
/* data base locked for shared read */
47
#define SDBM_EXCLUSIVE_LOCK 0x8
/* data base locked for write */
48
49
struct
apr_sdbm_t
{
50
apr_pool_t
*
pool
;
51
apr_file_t
*
dirf
;
/* directory file descriptor */
52
apr_file_t
*
pagf
;
/* page file descriptor */
53
apr_int32_t
flags
;
/* status/error flags, see below */
54
long
maxbno
;
/* size of dirfile in bits */
55
long
curbit
;
/* current bit number */
56
long
hmask
;
/* current hash mask */
57
long
blkptr
;
/* current block for nextkey */
58
int
keyptr
;
/* current key for nextkey */
59
long
blkno
;
/* current page to read/write */
60
long
pagbno
;
/* current page in pagbuf */
61
char
pagbuf
[
PBLKSIZ
];
/* page file block buffer */
62
long
dirbno
;
/* current block in dirbuf */
63
char
dirbuf
[
DBLKSIZ
];
/* directory file block buffer */
64
int
lckcnt
;
/* number of calls to sdbm_lock */
65
};
66
67
68
#define sdbm_hash apu__sdbm_hash
69
#define sdbm_nullitem apu__sdbm_nullitem
70
71
extern
const
apr_sdbm_datum_t
sdbm_nullitem
;
72
73
long
sdbm_hash
(
const
char
*
str
,
int
len
);
74
75
/*
76
* zero the cache
77
*/
78
#define SDBM_INVALIDATE_CACHE(db, finfo) \
79
do { db->dirbno = (!finfo.size) ? 0 : -1; \
80
db->pagbno = -1; \
81
db->maxbno = (long)(finfo.size * BYTESIZ); \
82
} while (0);
83
84
#endif
/* SDBM_PRIVATE_H */
len
const char apr_size_t len
Definition
ap_regex.h:187
apr_errno.h
APR Error Codes.
apr_file_io.h
APR File I/O Handling.
apr_pools.h
APR memory allocation.
size
apr_size_t size
Definition
apr_allocator.h:115
sdbm_hash
#define sdbm_hash
Definition
sdbm_private.h:68
sdbm_nullitem
#define sdbm_nullitem
Definition
sdbm_private.h:69
PBLKSIZ
#define PBLKSIZ
Definition
sdbm_private.h:38
DBLKSIZ
#define DBLKSIZ
Definition
sdbm_private.h:37
apr_file_t
Definition
apr_arch_file_io.h:97
apr_pool_t
Definition
apr_pools.c:562
apr_sdbm_datum_t
Definition
apr_sdbm.h:49
apr_sdbm_t
Definition
sdbm_private.h:49
apr_sdbm_t::pool
apr_pool_t * pool
Definition
sdbm_private.h:50
apr_sdbm_t::dirbuf
char dirbuf[4096]
Definition
sdbm_private.h:63
apr_sdbm_t::pagbno
long pagbno
Definition
sdbm_private.h:60
apr_sdbm_t::pagf
apr_file_t * pagf
Definition
sdbm_private.h:52
apr_sdbm_t::maxbno
long maxbno
Definition
sdbm_private.h:54
apr_sdbm_t::blkno
long blkno
Definition
sdbm_private.h:59
apr_sdbm_t::lckcnt
int lckcnt
Definition
sdbm_private.h:64
apr_sdbm_t::dirf
apr_file_t * dirf
Definition
sdbm_private.h:51
apr_sdbm_t::dirbno
long dirbno
Definition
sdbm_private.h:62
apr_sdbm_t::blkptr
long blkptr
Definition
sdbm_private.h:57
apr_sdbm_t::flags
apr_int32_t flags
Definition
sdbm_private.h:53
apr_sdbm_t::hmask
long hmask
Definition
sdbm_private.h:56
apr_sdbm_t::curbit
long curbit
Definition
sdbm_private.h:55
apr_sdbm_t::keyptr
int keyptr
Definition
sdbm_private.h:58
apr_sdbm_t::pagbuf
char pagbuf[1024]
Definition
sdbm_private.h:61
str
#define str
Definition
util_expr_scan.c:617
Generated by
1.9.8