new db, directory: new directory api

Don't export struct dir to outside.
configure: -Werror=incompatible-pointer-types
new db: merge database.c into directory.c

wip.