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/gdbm.h.in | |
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/gdbm.h.in')
-rw-r--r-- | src/gdbm.h.in | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/gdbm.h.in b/src/gdbm.h.in index a3d0461..07d3d1f 100644 --- a/src/gdbm.h.in +++ b/src/gdbm.h.in @@ -49,6 +49,9 @@ extern "C" { # define GDBM_NOLOCK 0x040 /* Don't do file locking operations. */ # define GDBM_NOMMAP 0x080 /* Don't use mmap(). */ # define GDBM_CLOEXEC 0x100 /* Close the underlying fd on exec(3) */ +# define GDBM_BSEXACT 0x200 /* Don't adjust block_size. Bail out with + GDBM_BLOCK_SIZE_ERROR error if unable to + set it. */ /* Parameters to gdbm_store for simple insertion or replacement in the case that the key is already in the database. */ |