Licensing Information

Open Source Used In Cisco FXOS 1.1(3) 873
}
tdb_unlock(tdb, BUCKET(hash));
tdb_lock(tdb, -1);
/* and recover the space */
offset = FREELIST_TOP;
if (ofs_read(tdb, offset, &rec.next) == -1) {
goto fail2;
}
rec.magic = TDB_FREE_MAGIC;
if (rec_write(tdb, rec_ptr, &rec) == -1) {
goto fail2;
}
if (ofs_write(tdb, offset, &rec_ptr) == -1) {
goto fail2;
}
/* yipee - all done */
free(data);
tdb_unlock(tdb, -1);
return 0;
}
/* a miss - drat */
free(data);
data = NULL;
}
/* move to the next record */
last_ptr = rec_ptr;
lastrec = rec;
rec_ptr = rec.next;
}
fail:
if (data) free(data);
tdb_unlock(tdb, BUCKET(hash));
return -1;
fail2:
if (data) free(data);
tdb_unlock(tdb, -1);
return -1;
}
/* store an element in the database, replacing any existing element
with the same key