Licensing Information
Open Source Used In Cisco FXOS 1.1(3) 854
#define GLOBAL_LOCK 0
#define ACTIVE_LOCK 4
#define LIST_LOCK_BASE 1024
#define BUCKET(hash) ((hash) % tdb->header.hash_size)
#ifndef MAP_FILE
#define MAP_FILE 0
#endif
/* the body of the database is made of one list_struct for the free space
plus a separate data list for each hash value */
struct list_struct {
tdb_len rec_len; /* total byte length of record */
tdb_off next; /* offset of the next record in the list */
tdb_len key_len; /* byte length of key */
tdb_len data_len; /* byte length of data */
unsigned full_hash; /* the full 32 bit hash of the key */
unsigned magic; /* try to catch errors */
/*
the following union is implied
union {
char record[rec_len];
struct {
char key[key_len];
char data[data_len];
}
}
*/
};
/* a null data record - useful for error returns */
static TDB_DATA null_data;
/* a byte range locking function - return 0 on success
this functions locks/unlocks 1 byte at the specified offset */
static int tdb_brlock(TDB_CONTEXT *tdb, tdb_off offset,
int set, int rw_type, int lck_type)
{
#if NOLOCK
return 0;
#else
struct flock fl;
if (tdb->fd == -1) return 0; /* for in memory tdb */
if (tdb->read_only) return -1;