2 * $Id: dbd_dbcheck.c,v 1.4 2009-05-06 11:54:24 franklahm Exp $
4 * Copyright (C) Joerg Lenneis 2003
5 * All Rights Reserved. See COPYING.
10 #endif /* HAVE_CONFIG_H */
15 #include <sys/param.h>
17 #include <netatalk/endian.h>
18 #include <atalk/logger.h>
19 #include <atalk/cnid_dbd_private.h>
25 int dbd_check_indexes(DBD *dbd, char *dbdir)
27 u_int32_t c_didname = 0, c_devino = 0, c_cnid = 0;
29 LOG(log_note, logtype_cnid, "CNID database at `%s' is being checked (quick)", dbdir);
31 if (dbif_count(dbd, DBIF_CNID, &c_cnid))
34 if (dbif_count(dbd, DBIF_IDX_DEVINO, &c_devino))
37 /* bailout after the first error */
38 if ( c_cnid != c_devino) {
39 LOG(log_error, logtype_cnid, "CNID database at `%s' corrupted (%u/%u)", dbdir, c_cnid, c_devino);
43 if (dbif_count(dbd, DBIF_IDX_DIDNAME, &c_didname))
46 if ( c_cnid != c_didname) {
47 LOG(log_error, logtype_cnid, "CNID database at `%s' corrupted (%u/%u)", dbdir, c_cnid, c_didname);
51 LOG(log_note, logtype_cnid, "CNID database at `%s' seems ok, %u entries.", dbdir, c_cnid);