Licensing Information

Open Source Used In Cisco FXOS 1.1(3) 865
}
/* move to the next record */
rec_ptr = rec->next;
}
return 0;
}
/*
return an error string for the last tdb error
*/
char *tdb_error(TDB_CONTEXT *tdb)
{
int i;
static struct {
enum TDB_ERROR ecode;
char *estring;
} emap[] = {
{TDB_SUCCESS, "Success"},
{TDB_ERR_CORRUPT, "Corrupt database"},
{TDB_ERR_IO, "IO Error"},
{TDB_ERR_LOCK, "Locking error"},
{TDB_ERR_OOM, "Out of memory"},
{TDB_ERR_EXISTS, "Record exists"},
{-1, NULL}};
if (tdb != NULL) {
for (i=0;emap[i].estring;i++) {
if (tdb->ecode == emap[i].ecode) return emap[i].estring;
}
} else {
return "Invalid tdb context";
}
return "Invalid error code";
}
/* update an entry in place - this only works if the new data size
is <= the old data size and the key exists.
on failure return -1
*/
int tdb_update(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf)
{
unsigned hash;
struct list_struct rec;
tdb_off rec_ptr;
int ret = -1;
info("Enter: tdb_update.");