Home | History | Annotate | Download | only in hash
History log of /src/lib/libc/db/hash/hash.c
RevisionDateAuthorComments
 1.38  18-Nov-2015  christos Introduce a HASH_BSIZE macro to return the blocksize; in the 64K case this
returns 0xffff to avoid overflow. This is used where sizes are stored.
 1.37  18-Nov-2015  christos Account for the -1 hack to fit 0x10000 in a short in hash_page.c
 1.36  17-Nov-2015  christos PR/50441: Manuel Bouyer: hash seq enumeration skips keys on big data.
XXX: pullup-7
 1.35  22-Jun-2015  christos Fix hash iteration that deletes the current element under the cursor by
adjusting the position of the iterator appropriately.
XXX: pullup 7
 1.34  22-Jun-2015  christos Delay moving to the next key until the next iteration. This avoids returning
invalid data to the user if the user deletes the current key, but it also
fails to iterate over some keys as will be shown by a unit test. From FreeBSD.
 1.33  01-Dec-2013  christos branches: 1.33.4;
- centralize opening of regular and temp files to avoid code duplication
- don't cast malloc
- use malloc sizeof(*var) instead of sizeof(type)
 1.32  13-Mar-2012  christos branches: 1.32.2;
PR/45989: Martin Husemann: lint invocation does include -w only on i386

- turn lint -w for all the platforms after fixing the lint warnings.
- add _DIAGASSERTS() for casts that would assign values to types that
would not fit.
- change types, add casts
- change into ansii prototypes
- turn on _DIAGNOSTIC for libc (during current, to be eliminated for release
builds)

approved by core@
 1.31  12-Feb-2009  lukem branches: 1.31.6;
fix -Wsign-compare issues
 1.30  11-Sep-2008  joerg branches: 1.30.6; 1.30.8;
Consistently include "nbtool_config.h" when cross-compiling.
 1.29  10-Sep-2008  joerg In preparation for providing a db fallback in libnbcompat, remove
sccsid and conditionals around __RCSID. lint understands __RCSID enough
to ignore it, undefining LIBC_SCCS is superseded by MKSTRIPIDENT.
No functional changes.
 1.28  26-Aug-2008  joerg Convert db from UCB types to POSIX types. Prefer uint8_t for u_char as
it is mostly about the wire format.

Patched libc.so is bit-identical.

OK matt@
 1.27  03-Feb-2007  christos branches: 1.27.12;
cleanup:
- remove __P
- remove unneeded casts
- add _DIAGASSERT
- add more diagnostics for integer overflow
- fix size_t/int confusion
- make debugging and statistics code compile
 1.26  19-Mar-2006  rtr retrun -> return
 1.25  19-Mar-2006  christos Coverity CID 518: Avoid NULL pointer deref.
 1.24  19-Mar-2006  christos Coverity CID 508: Avoid memory leak.
 1.23  29-Nov-2005  christos WARNS=4
 1.22  16-Oct-2005  christos Initialize a variable that might confuse gcc as uninitialized.
 1.21  29-Mar-2005  christos Don't refuse to create a hash database on 0 length files. Treat
them as new files the same way that the btree code does. Note that
we do the fstat() after the open() instead of re-using the previous
result of the stat() to avoid races (we open with O_EXLOCK when we care).
 1.20  06-Mar-2005  christos branches: 1.20.2;
Revert previous commit at 1.17. a maximum BSIZE of 65536 ends up stored
as a 0 in the page, but it is supported and it does work.
 1.19  19-Jan-2005  mycroft hash already uses FD_CLOEXEC -- pay attention to the return value and make it
a hard failure.

Also make btree and recno uses FD_CLOEXEC.
 1.18  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.17  11-Dec-2002  christos Only allow BSIZE to 1^16 - 1:
- fix off by one error
- limit the default from the filesystem
 1.16  12-Jan-2002  aymeric use %p instead of %x when displaying a pointer
 1.15  09-Dec-1998  christos branches: 1.15.12;
delint
 1.14  14-Oct-1998  kleink Need "namespace.h".
 1.13  30-Jun-1998  thorpej Use pread(2) and pwrite(2) where appropriate.
 1.12  07-May-1998  kleink Change the file mode argument to dbopen() and the db backends from int to
mode_t.
 1.11  13-Jul-1997  christos Fix RCSID's
Fix gcc warnings.
 1.10  07-Nov-1996  jtc Rename the errno field in struct htab to err, as the former name
conflicts with a macro implementation of errno.h's errno.
 1.9  03-May-1996  cgd merge DB 1.85 changes
 1.8  27-Feb-1995  cgd add unintrusive Ids
 1.7  18-Aug-1994  cgd branches: 1.7.2; 1.7.4;
clean up import
 1.6  13-Jan-1994  cgd fix sall memory leak. from Christopher Jon Kane <kane@kidd.vet.purdue.edu>
 1.5  20-Oct-1993  cgd update to v1.72 of new DB code
 1.4  09-Sep-1993  cgd upgrade new DB code to version 1.7
 1.3  26-Aug-1993  jtc Declare rcsid strings so they are stored in text segment.
 1.2  01-Aug-1993  mycroft Add RCS identifiers.
 1.1  14-Jun-1993  cgd branches: 1.1.1;
update db code to v1.6 from vangogh, and put it in "db" rather than "DB"
 1.1.1.1  17-Aug-1994  cgd update to db 1.79
 1.7.4.1  02-May-1995  jtc #include "namespace.h"
 1.7.2.2  18-Aug-1994  cgd clean up import
 1.7.2.1  18-Aug-1994  cgd file hash.c was added on branch netbsd-1-0 on 1994-08-18 00:40:50 +0000
 1.15.12.2  19-Dec-2002  thorpej Sync with HEAD.
 1.15.12.1  28-Jan-2002  nathanw Catch up to -current.
 1.20.2.1  30-Mar-2005  tron Pull up revision 1.21 (requested by christos in ticket #78):
Don't refuse to create a hash database on 0 length files. Treat
them as new files the same way that the btree code does. Note that
we do the fstat() after the open() instead of re-using the previous
result of the stat() to avoid races (we open with O_EXLOCK when we care).
 1.27.12.2  24-Sep-2008  wrstuden Merge in changes between wrstuden-revivesa-base-2 and
wrstuden-revivesa-base-3.
 1.27.12.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.30.8.1  13-May-2009  jym Sync with HEAD.

Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
 1.30.6.2  11-Sep-2008  joerg Consistently include "nbtool_config.h" when cross-compiling.
 1.30.6.1  11-Sep-2008  joerg file hash.c was added on branch christos-time_t on 2008-09-11 12:58:01 +0000
 1.31.6.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.31.6.1  17-Apr-2012  yamt sync with head
 1.32.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.4.2  22-Nov-2015  bouyer Pull up following revision(s) (requested by christos in ticket #1046):
lib/libc/db/hash/hash_page.c: revision 1.27
lib/libc/db/hash/hash_page.c: revision 1.28
lib/libc/db/hash/hash.h: revision 1.16
lib/libc/db/hash/hash.c: revision 1.36
lib/libc/db/hash/hash.c: revision 1.37
lib/libc/db/hash/hash.c: revision 1.38
lib/libc/db/hash/hash_bigkey.c: revision 1.25
Account for the -1 hack to fit 0x10000 in a short in hash_page.c
Introduce a HASH_BSIZE macro to return the blocksize; in the 64K case this
returns 0xffff to avoid overflow. This is used where sizes are stored.
If MAX_BSIZE == hashp->BSIZE (65536) then it does not fit in a short, and
we end up storing 0... This means that every entry needs a page. We store
MAX_BSIZE - 1 here, but it would be better to always store (avail - 1) here
so that we don't waste a byte and be consistent.
PR/50441: Manuel Bouyer: hash seq enumeration skips keys on big data.
XXX: pullup-7
 1.33.4.1  06-Aug-2015  snj Pull up following revision(s) (requested by christos in ticket #921):
lib/libc/db/hash/hash.c: revision 1.34
lib/libc/db/hash/hash.c: revision 1.35
Delay moving to the next key until the next iteration. This avoids returning
invalid data to the user if the user deletes the current key, but it also
fails to iterate over some keys as will be shown by a unit test. From FreeBSD.
--
Fix hash iteration that deletes the current element under the cursor by
adjusting the position of the iterator appropriately.

RSS XML Feed