Licensing Information

Open Source Used In Cisco FXOS 1.1(4) 969
goto fail;
}
/* allocate and read the key space */
ret.dptr = tdb_alloc_read(tdb, rec_ptr + sizeof(rec), rec.key_len);
ret.dsize = rec.key_len;
tdb_unlock(tdb, BUCKET(hash));
return ret;
fail:
tdb_unlock(tdb, BUCKET(hash));
return null_data;
}
/* find the next entry in the database, returning its key */
TDB_DATA tdb_nextkey(TDB_CONTEXT *tdb, TDB_DATA key)
{
unsigned hash, hbucket;
tdb_off rec_ptr, offset;
struct list_struct rec;
TDB_DATA ret;
if (tdb == NULL) {
#ifdef TDB_DEBUG
printf("tdb_nextkey() called with null context\n");
#endif
return null_data;
}
/* find which hash bucket it is in */
hash = tdb_hash(&key);
hbucket = BUCKET(hash);
tdb_lock(tdb, hbucket);
rec_ptr = tdb_find(tdb, key, hash, &rec);
if (rec_ptr) {
/* we want the next record after this one */
rec_ptr = rec.next;
}
/* not found or last in hash: look for next non-empty hash chain */
while (rec_ptr == 0) {
tdb_unlock(tdb, hbucket);
if (++hbucket >= tdb->header.hash_size - 1)
return null_data;
offset = tdb_hash_top(tdb, hbucket);