-/*
- * $Id: cnid_cdb_update.c,v 1.2 2005-04-28 20:49:59 bfernhomberg Exp $
- */
-
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
/* cnid_update: takes the given cnid and updates the metadata. To
* handle the did/name data, there are a bunch of functions to get
* and set the various fields. */
-int cnid_cdb_update(struct _cnid_db *cdb, const cnid_t id, const struct stat *st,
- const cnid_t did, char *name, const int len
- /*, const char *info, const int infolen*/)
+int cnid_cdb_update(struct _cnid_db *cdb, cnid_t id, const struct stat *st,
+ cnid_t did, const char *name, size_t len)
{
- char *buf;
+ unsigned char *buf;
CNID_private *db;
DBT key, pkey, data;
int rc;
int notfound = 0;
char getbuf[CNID_HEADER_LEN + MAXPATHLEN +1];
- if (!cdb || !(db = cdb->_private) || !id || !st || !name || (db->flags & CNIDFLAG_DB_RO)) {
+ if (!cdb || !(db = cdb->cnid_db_private) || !id || !st || !name || (db->flags & CNIDFLAG_DB_RO)) {
return -1;
}
memset(&pkey, 0, sizeof(pkey));
memset(&data, 0, sizeof(data));
- buf = make_cnid_data(st, did, name, len);
+ buf = make_cnid_data(cdb->cnid_db_flags, st, did, name, len);
key.data = buf +CNID_DEVINO_OFS;
key.size = CNID_DEVINO_LEN;
}
memset(&pkey, 0, sizeof(pkey));
- 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;
memset(&data, 0, sizeof(data));
/* Make a new entry. */
- buf = make_cnid_data(st, did, name, len);
+ buf = make_cnid_data(cdb->cnid_db_flags, st, did, name, len);
data.data = buf;
memcpy(data.data, &id, sizeof(id));
data.size = CNID_HEADER_LEN + len + 1;