hslot.c File Reference

USRLOC - Hash table collision slot related functions

More...

#include "hslot.h"

Include dependency graph for hslot.c:

Go to the source code of this file.

Functions

void deinit_slot (hslot_t *_s)
 Deinitialize given slot structure.
void init_slot (struct udomain *_d, hslot_t *_s, int n)
 Initialize cache slot structure.
void slot_add (hslot_t *_s, struct urecord *_r)
 Add an element to an slot's linked list.
void slot_rem (hslot_t *_s, struct urecord *_r)
 Remove an element from slot linked list.
void ul_destroy_locks (void)
 Destroy all locks on the list.
int ul_init_locks (void)
 Initialize locks for the hash table.
void ul_lock_idx (int idx)
 Lock a lock with a certain index.
void ul_release_idx (int idx)
 Release a lock with a certain index.
void ul_unlock_locks (void)
 Unlock all locks on the list.

Variables

gen_lock_set_t * ul_locks = 0
int ul_locks_no = 4


Detailed Description

USRLOC - Hash table collision slot related functions

Definition in file hslot.c.


Function Documentation

void deinit_slot ( hslot_t _s  ) 

Deinitialize given slot structure.

Parameters:
_s hash slot

Definition at line 148 of file hslot.c.

References hslot::d, hslot::first, free_urecord(), hslot::last, hslot::n, and urecord::next.

Referenced by free_udomain().

void init_slot ( struct udomain _d,
hslot_t _s,
int  n 
)

Initialize cache slot structure.

Initialize slot structure.

Parameters:
_d domain for the hash slot
_s hash slot
n used to get the slot number (modulo number or locks)

Definition at line 129 of file hslot.c.

References hslot::d, hslot::first, hslot::last, hslot::lockidx, hslot::n, ul_locks, and ul_locks_no.

Referenced by new_udomain().

void slot_add ( hslot_t _s,
struct urecord _r 
)

Add an element to an slot's linked list.

Add an element to slot linked list.

Parameters:
_s hash slot
_r added record

Definition at line 170 of file hslot.c.

References hslot::first, hslot::last, hslot::n, urecord::next, urecord::prev, and urecord::slot.

Referenced by mem_insert_urecord().

void slot_rem ( hslot_t _s,
struct urecord _r 
)

Remove an element from slot linked list.

Parameters:
_s hash slot
_r removed record

Definition at line 189 of file hslot.c.

References hslot::first, hslot::last, hslot::n, urecord::next, urecord::prev, and urecord::slot.

Referenced by mem_delete_urecord().

void ul_destroy_locks ( void   ) 

Destroy all locks on the list.

Definition at line 94 of file hslot.c.

References ul_locks.

int ul_init_locks ( void   ) 

Initialize locks for the hash table.

Returns:
0 on success, -1 on failure

Definition at line 44 of file hslot.c.

References LM_ERR, LM_INFO, ul_locks, and ul_locks_no.

Referenced by mod_init().

void ul_lock_idx ( int  idx  ) 

Lock a lock with a certain index.

Parameters:
idx lock index

Definition at line 107 of file hslot.c.

References ul_locks.

Referenced by lock_udomain(), and lock_ulslot().

void ul_release_idx ( int  idx  ) 

Release a lock with a certain index.

Parameters:
idx lock index

Definition at line 117 of file hslot.c.

References ul_locks.

Referenced by ul_unlock_locks(), unlock_udomain(), and unlock_ulslot().

void ul_unlock_locks ( void   ) 

Unlock all locks on the list.

Destroy all locks on the list.

Definition at line 74 of file hslot.c.

References ul_locks, ul_locks_no, and ul_release_idx().


Variable Documentation

gen_lock_set_t* ul_locks = 0

global list of locks

Definition at line 37 of file hslot.c.

Referenced by init_slot(), ul_destroy_locks(), ul_init_locks(), ul_lock_idx(), ul_release_idx(), and ul_unlock_locks().

int ul_locks_no = 4

number of locks

Definition at line 35 of file hslot.c.

Referenced by init_slot(), mod_init(), ul_init_locks(), and ul_unlock_locks().


Generated on Wed May 23 06:01:04 2012 for Kamailio - The Open Source SIP Server by  doxygen 1.5.6