|
| static uint32_t | padico_psp_tag_build (uint32_t component_tag, uint32_t instance_tag) |
| | build a PSP tag from an component tag and an instance tag
|
| |
| static uint32_t | padico_psp_tag_get_component (uint32_t tag) |
| | get the 'component' (static) part from a PSP tag
|
| |
| static uint32_t | padico_psp_tag_get_instance (uint32_t tag) |
| | get the 'instance' (dynamic) part from a PSP tag
|
| |
| static puk_iface_t | puk_iface_PadicoSimplePackets (void) |
| | Attach the iface name to its driver.
|
| |
| static struct puk_receptacle_PadicoSimplePackets_s | puk_receptacle_PadicoSimplePackets_null (void) |
| |
| static void | puk_instance_indirect_PadicoSimplePackets (puk_instance_t instance, const char *label, struct puk_receptacle_PadicoSimplePackets_s *receptacle) |
| |
| static void | puk_instance_context_indirect_PadicoSimplePackets (puk_instance_t instance, const char *label, struct puk_receptacle_PadicoSimplePackets_s *receptacle) |
| |
| static puk_facet_t | puk_component_get_facet_PadicoSimplePackets (puk_component_t c, const char *label) |
| |
| static const struct padico_psp_driver_s * | puk_component_get_driver_PadicoSimplePackets (puk_component_t component, const char *label) |
| |
| static void | puk_context_indirect_PadicoSimplePackets (puk_context_t context, const char *label, const struct padico_psp_driver_s **driver, puk_context_t *rcontext) |
| |
| static void | puk_component_indirect_PadicoSimplePackets (puk_component_t component, const char *label, const struct padico_psp_driver_s **driver, puk_context_t *context) |
| |
| static void | padico_psp_init (const struct puk_receptacle_PadicoSimplePackets_s *psp, uint32_t tag, const char *label, size_t *h_size, padico_psp_handler_t handler, void *key) |
| |
| static void | padico_psp_listen (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_topo_node_t node) |
| |
| static void | padico_psp_connect (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_topo_node_t node) |
| |
| static padico_psp_connection_t | padico_psp_new_message (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_topo_node_t node, void **sbuf) |
| |
| static void | padico_psp_pack (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_psp_connection_t conn, const char *bytes, size_t size) |
| |
| static void | padico_psp_end_message (const struct puk_receptacle_PadicoSimplePackets_s *psp, padico_psp_connection_t conn) |
| |
| static uint32_t | padico_psp_tag_hash (const uint32_t a) |
| |
| static int | padico_psp_tag_eq (uint32_t a, uint32_t b) |
| |
| struct padico_psp_slot_hash_entry_block_lfstack_cell_s | __attribute__ ((aligned(16))) |
| |
| | __attribute__ ((unused)) static inline void padico_psp_slot_hash_entry_allocator_init_thread(struct padico_psp_slot_hash_entry_allocator_s *a |
| | explicit thread level
|
| |
| | if (!single) pthread_spin_unlock(&_stack -> _lock) |
| |
| | if (_cell !=NULL) |
| |
| | assert (slab_size > 0) |
| |
| | padico_psp_slot_hash_entry_allocator_init_thread (a, slab_size,(1)) |
| |
| | if (block !=NULL) rblocks++ |
| |
| | while (block !=NULL) |
| |
| | if (slice !=NULL) |
| |
| | padico_free_func (slice, puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)) |
| |
| | while (slice !=NULL) |
| |
| | if (check &&(rblocks !=allocated_blocks)) do |
| |
| | while (0) |
| |
| | __attribute__ ((unused, nonnull)) static inline void padico_psp_slot_hashtable_init(padico_psp_slot_hashtable_t h) |
| | initialize a new hashtable
|
| |
| | assert (cell !=NULL) |
| |
| puk_allocator_cell_clear & | cell (struct padico_psp_slot_hash_entry_s) |
| |
| static struct padico_psp_slot_hash_entry_s * | padico_psp_slot_hash_entry_lookup (padico_psp_slot_hashtable_t h, const uint32_t key) |
| |
| static void | padico_psp_slot_hash_entry_insert (padico_psp_slot_hashtable_t h, uint32_t key, padico_psp_slot_t data) |
| |
| static int | padico_psp_slot_hash_entry_oldprobe (padico_psp_slot_hashtable_t h, const uint32_t key) |
| |
| static void | padico_psp_slot_hash_entry_rehash_row (padico_psp_slot_hashtable_t h, ssize_t z) |
| |
| static void | padico_psp_slot_hash_entry_rehash_n (padico_psp_slot_hashtable_t h, ssize_t n) |
| |
| static void | padico_psp_slot_hash_entry_rehash_flush (padico_psp_slot_hashtable_t h) |
| |
| | if (source->key !=((uint32_t) 0)) |
| |
| | __attribute__ ((unused, nonnull(1))) static inline void padico_psp_slot_hashtable_insert(padico_psp_slot_hashtable_t h |
| | insert an entry into a hashtable
|
| |
| | assert (key !=((uint32_t) 0)) |
| |
| | if (e) |
| |
| | return (e !=NULL) |
| |
| | if (e !=NULL) |
| |
| | if (data) *data = ( padico_psp_slot_t )0 |
| |
| | if (h->table==NULL) return |
| |
| | while (e &&(e->key !=((uint32_t) 0))) |
| |
| | while (padico_psp_slot_hash_entry_oldprobe(h, key)) |
| |
| | padico_psp_slot_hash_entry_rehash_flush (h) |
| |
| | assert (e->h !=NULL) |
| |
| | assert (e->h->oldtable==NULL) |
| |
| | if (e->current &&e->current->next) |
| |
| | if (e->i< e->h->size) |
| |
| | padico_psp_slot_hashtable_remove (h, *key) |
| |
| void | padico_psp_directory_init (struct padico_psp_directory_s *d) |
| |
| padico_psp_slot_t | padico_psp_slot_insert (struct padico_psp_directory_s *d, padico_psp_handler_t handler, void *key, uint32_t tag, size_t h_size) |
| |
| void | padico_psp_slot_remove (struct padico_psp_directory_s *d, padico_psp_slot_t slot) |
| |
| padico_psp_slot_t | padico_psp_slot_lookup (struct padico_psp_directory_s *d, uint32_t tag) |
| |
|
| static const struct puk_mod_dep_cell_s | puk_mod_dep_PSP = { .mod_name = "PSP", .link = & puk_mod_dep_0 } |
| |
| struct padico_psp_slot_hash_entry_block_lfstack_cell_s * | _next = _stack->_head |
| |
| struct padico_psp_slot_hash_entry_block_lfstack_s | __attribute__ |
| | explicit thread level
|
| |
| struct padico_psp_slot_hash_entry_block_lfstack_cell_s * | _cell { padico_psp_slot_hash_entry_block_lfstack_push_ext(_stack, _cell, 0) |
| |
| struct padico_psp_slot_hash_entry_block_lfstack_cell_s int | single { if(!single) pthread_spin_lock(&_stack->_lock) |
| |
| _stack | _head = _cell |
| |
| struct padico_psp_slot_hash_entry_block_lfstack_cell_s | block [] = NULL |
| |
| ssize_t | slab_size = slab_size |
| |
| padico_psp_slot_hash_entry_slice_lfstack_init & | a |
| |
| a | new_slab = 0 |
| |
| | void |
| |
| int | check { int rblocks = 0 |
| |
| | do { block = padico_psp_slot_hash_entry_block_lfstack_pop_ext(&a->blocks, a->single) |
| |
| int | allocated_blocks = 0 |
| |
| struct padico_psp_slot_hash_entry_slice_lfstack_cell_s * | slice = NULL |
| |
| struct padico_psp_slot_hash_entry_s * | b { struct padico_psp_slot_hash_entry_block_lfstack_cell_s*cell = (( struct padico_psp_slot_hash_entry_block_lfstack_cell_s *)((char*)(__typeof__ (&(( struct padico_psp_slot_hash_entry_block_lfstack_cell_s *)0)-> block ))( b )- ((size_t) &(( struct padico_psp_slot_hash_entry_block_lfstack_cell_s *)0)-> block ))) |
| |
| const uint32_t | key { if(h->oldtable) { const uint32_t z = (*( &padico_psp_tag_hash ))(key); const ssize_t index = puk_hash_to_index(z, h->oldsize); struct padico_psp_slot_hash_entry_s*e = h->oldtable + index; while(e && (e->key != (( uint32_t )0) )) { if((*( &padico_psp_tag_eq ))(key, e->key)) { padico_psp_slot_hash_entry_rehash_row(h, index); padico_psp_slot_hash_entry_rehash_n(h, 16 ); return 1; } e = e->next; } } return 0 |
| |
| ssize_t | z { assert(h->oldtable != NULL) |
| |
| struct padico_psp_slot_hash_entry_s * | source = h->oldtable + z |
| |
| ssize_t | n { if(h->oldtable) { ssize_t k; for(k = 0; k < n; k++) { padico_psp_slot_hash_entry_rehash_row(h, h->rehashed + k); if(h->rehashed + k == h->oldsize - 1) { (padico_free_func( h->oldtable , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); h->oldtable = NULL; h->rehashed = 0; return; } } h->rehashed += k; } } __attribute__((unused)) static inline void padico_psp_slot_hash_entry_insert( padico_psp_slot_hashtable_t h, uint32_t key, padico_psp_slot_t data) { const uint32_t z = (*( &padico_psp_tag_hash ))(key); assert(h->table != NULL); struct padico_psp_slot_hash_entry_s*e = h->table + puk_hash_to_index(z, h->size); if(e->key != (( uint32_t )0) ) { while(e->next) { e = e->next; } e->next = padico_psp_slot_hash_entry_malloc(&h->entry_allocator); assert(e->next != NULL); e = e->next; } e->key = key; e->data = data; e->next = NULL; } __attribute__((unused)) static inline struct padico_psp_slot_hash_entry_s* padico_psp_slot_hash_entry_lookup( padico_psp_slot_hashtable_t h, const uint32_t key) { if(h->table == NULL) return NULL; const uint32_t z = (*( &padico_psp_tag_hash ))(key); struct padico_psp_slot_hash_entry_s*e = NULL; do { e = h->table + puk_hash_to_index(z, h->size); while(e && (e->key != (( uint32_t )0) )) { if((*( &padico_psp_tag_eq ))(key, e->key)) { return e; } e = e->next; } } while( padico_psp_slot_hash_entry_oldprobe(h, key)); return NULL; } __attribute__((unused)) static inline void padico_psp_slot_hash_entry_rehash_flush( padico_psp_slot_hashtable_t h) { if(h->oldtable) { padico_psp_slot_hash_entry_rehash_n(h, h->oldsize); } assert(h->oldtable == NULL); } __attribute__((unused)) static void padico_psp_slot_hash_rehash_trigger( padico_psp_slot_hashtable_t h) { static const ssize_t hash_primes[] = { 11, 23, 53, 97, 193, 389, 769, 1543, 3079, 6151, 12289, 24593, 49157, 98317, 196613, 393241, 786433, 1572869, 3145739, 6291469, 12582917, 25165843, 50331653, 100663319, 201326611, 402653189, 805306457, -1 }; assert(hash_primes[0] == 11 ); assert(h->oldtable == NULL); h->oldtable = h->table; h->oldsize = h->size; h->rehashed = 0; int i = 0; while(h->size >= hash_primes[i]) { i++; } h->size = hash_primes[i]; assert(h->size > 0); assert(h->size > h->oldsize); h->table = (struct padico_psp_slot_hash_entry_s*)(padico_malloc_func( h->size * sizeof(struct padico_psp_slot_hash_entry_s) , puk_mod_binary_get_profile(), padico_module_self_name(), __func__, __FILE__, __LINE__)); for(i = 0; i < h->size; i++) { h->table[i].key = (( uint32_t )0) ; h->table[i].data = ( padico_psp_slot_t )0; h->table[i].next = NULL; } padico_psp_slot_hash_entry_rehash_n(h, 16 ); } |
| |
| uint32_t padico_psp_slot_t | data { padico_psp_slot_hash_entry_rehash_n(h, 16 ) |
| |
| struct padico_psp_slot_hash_entry_s * | e = padico_psp_slot_hash_entry_lookup(h, key) |
| |
| | else { if(h->load >= h->size * 3 / 4) { padico_psp_slot_hash_rehash_trigger(h); } padico_psp_slot_hash_entry_insert(h, key, data) |
| |
| h | load |
| |
| const uint32_t uint32_t * | outkey |
| |
| struct padico_psp_slot_hash_entry_s * | prev = NULL |
| |
| padico_psp_slot_hashtable_t | h { assert(h != NULL) |
| |
| e | i = -1 |
| |
| e | current = NULL |
| |
Padico Simple Packets API.
Definition in file PSP.h.