-/*
- * $Id: cnid_cdb_lookup.c,v 1.4 2009-10-29 13:17:29 didg Exp $
- */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
/* This returns the CNID corresponding to a particular file. It will
* also fix up the various databases if there's a problem. */
-cnid_t cnid_cdb_lookup(struct _cnid_db *cdb, const struct stat *st, const cnid_t did,
- char *name, const size_t len)
+cnid_t cnid_cdb_lookup(struct _cnid_db *cdb, const struct stat *st, cnid_t did,
+ const char *name, size_t len)
{
unsigned char *buf;
CNID_private *db;
cnid_t id_devino, id_didname,id = 0;
int rc;
- if (!cdb || !(db = cdb->_private) || !st || !name) {
+ if (!cdb || !(db = cdb->cnid_db_private) || !st || !name) {
return 0;
}
- if ((buf = make_cnid_data(st, did, name, len)) == NULL) {
+ if ((buf = make_cnid_data(cdb->cnid_db_flags, st, did, name, len)) == NULL) {
LOG(log_error, logtype_default, "cnid_lookup: Pathname is too long");
return 0;
}
type_devino = ntohl(type_devino);
}
- buf = make_cnid_data(st, did, name, len);
+ buf = make_cnid_data(cdb->cnid_db_flags, st, did, name, len);
key.data = buf +CNID_DID_OFS;
key.size = CNID_DID_LEN + len + 1;
cnid_cdb_update(cdb, id, st, did, name, len);
#ifdef DEBUG
- LOG(log_debug, logtype_default, "cnid_lookup: Looked up did %u, name %s, as %u (needed update)", ntohl(did), name, ntohl(id));
+ LOG(log_debug9, logtype_default, "cnid_lookup: Looked up did %u, name %s, as %u (needed update)", ntohl(did), name, ntohl(id));
#endif
return id;
}