diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-07-15 14:46:08 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-07-15 14:57:40 +0300 |
commit | 44ca2b760b393e993b2a42fc489fa170910ad810 (patch) | |
tree | 12aa7390b19bed8aba2535cedb04376c45f820a5 /src/gdbmconst.h | |
parent | 5580c3248794803a8e45dd58b45933a32637954d (diff) | |
download | gdbm-44ca2b760b393e993b2a42fc489fa170910ad810.tar.gz gdbm-44ca2b760b393e993b2a42fc489fa170910ad810.tar.bz2 |
gdbm_open adjusts requested block size to accomodate integer number of directory offsets.
* src/gdbm.h.in (GDBM_BSEXACT): New flag.
* src/gdbmopen.c (compute_directory_size): New function.
(gdbm_open): When creating new database, adjust the requested
block size so that the block holds integer number of directory
indices. Disable this behavior if GDBM_BSEXACT flag is set
(this reverts to old behavior). Always unset GDBM_BSEXACT if
using block size returned by stat(2). This makes sure gdbm_open
succeeds on file systems reporting block sizes not divisible by
512.
* src/gdbmconst.h (GDBM_MIN_BLOCK_SIZE): New constant.
* src/gdbmimp.c (gdbm_import_from_file): Use GDBM_MIN_BLOCK_SIZE
instead of the hardcoded value.
* NEWS: Document GDBM_BSEXACT.
* doc/gdbm.texi: Likewise.
Diffstat (limited to 'src/gdbmconst.h')
-rw-r--r-- | src/gdbmconst.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gdbmconst.h b/src/gdbmconst.h index 56820db..66b0fb2 100644 --- a/src/gdbmconst.h +++ b/src/gdbmconst.h @@ -38,6 +38,9 @@ /* Size of a hash value, in bits */ #define GDBM_HASH_BITS 31 +/* Minimal acceptable block size */ +#define GDBM_MIN_BLOCK_SIZE 512 + /* In freeing blocks, we will ignore any blocks smaller (and equal) to IGNORE_SIZE number of bytes. */ #define IGNORE_SIZE 4 |