Lines Matching refs:hashbin
353 hashbin_t* hashbin; in hashbin_new() local
358 hashbin = kzalloc(sizeof(*hashbin), GFP_ATOMIC); in hashbin_new()
359 if (!hashbin) in hashbin_new()
365 hashbin->hb_type = type; in hashbin_new()
366 hashbin->magic = HB_MAGIC; in hashbin_new()
370 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_new()
371 spin_lock_init(&hashbin->hb_spinlock); in hashbin_new()
374 return hashbin; in hashbin_new()
389 int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) in hashbin_delete() argument
395 IRDA_ASSERT(hashbin != NULL, return -1;); in hashbin_delete()
396 IRDA_ASSERT(hashbin->magic == HB_MAGIC, return -1;); in hashbin_delete()
399 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_delete()
400 spin_lock_irqsave_nested(&hashbin->hb_spinlock, flags, in hashbin_delete()
409 queue = dequeue_first((irda_queue_t**) &hashbin->hb_queue[i]); in hashbin_delete()
414 (irda_queue_t**) &hashbin->hb_queue[i]); in hashbin_delete()
419 hashbin->hb_current = NULL; in hashbin_delete()
420 hashbin->magic = ~HB_MAGIC; in hashbin_delete()
423 if ( hashbin->hb_type & HB_LOCK) { in hashbin_delete()
424 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); in hashbin_delete()
433 kfree(hashbin); in hashbin_delete()
447 void hashbin_insert(hashbin_t* hashbin, irda_queue_t* entry, long hashv, in hashbin_insert() argument
453 IRDA_ASSERT( hashbin != NULL, return;); in hashbin_insert()
454 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return;); in hashbin_insert()
464 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_insert()
465 spin_lock_irqsave(&hashbin->hb_spinlock, flags); in hashbin_insert()
478 enqueue_first( (irda_queue_t**) &hashbin->hb_queue[ bin ], in hashbin_insert()
480 hashbin->hb_size++; in hashbin_insert()
483 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_insert()
484 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); in hashbin_insert()
498 void *hashbin_remove_first( hashbin_t *hashbin) in hashbin_remove_first() argument
504 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_remove_first()
505 spin_lock_irqsave(&hashbin->hb_spinlock, flags); in hashbin_remove_first()
508 entry = hashbin_get_first( hashbin); in hashbin_remove_first()
521 dequeue_general( (irda_queue_t**) &hashbin->hb_queue[ bin ], in hashbin_remove_first()
523 hashbin->hb_size--; in hashbin_remove_first()
531 if ( entry == hashbin->hb_current) in hashbin_remove_first()
532 hashbin->hb_current = NULL; in hashbin_remove_first()
536 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_remove_first()
537 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); in hashbin_remove_first()
558 void* hashbin_remove( hashbin_t* hashbin, long hashv, const char* name) in hashbin_remove() argument
564 IRDA_ASSERT( hashbin != NULL, return NULL;); in hashbin_remove()
565 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); in hashbin_remove()
575 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_remove()
576 spin_lock_irqsave(&hashbin->hb_spinlock, flags); in hashbin_remove()
582 entry = hashbin->hb_queue[ bin ]; in hashbin_remove()
604 } while ( entry != hashbin->hb_queue[ bin ] ); in hashbin_remove()
611 dequeue_general( (irda_queue_t**) &hashbin->hb_queue[ bin ], in hashbin_remove()
613 hashbin->hb_size--; in hashbin_remove()
619 if ( entry == hashbin->hb_current) in hashbin_remove()
620 hashbin->hb_current = NULL; in hashbin_remove()
624 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_remove()
625 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); in hashbin_remove()
649 void* hashbin_remove_this( hashbin_t* hashbin, irda_queue_t* entry) in hashbin_remove_this() argument
655 IRDA_ASSERT( hashbin != NULL, return NULL;); in hashbin_remove_this()
656 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); in hashbin_remove_this()
660 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_remove_this()
661 spin_lock_irqsave(&hashbin->hb_spinlock, flags); in hashbin_remove_this()
679 dequeue_general( (irda_queue_t**) &hashbin->hb_queue[ bin ], in hashbin_remove_this()
681 hashbin->hb_size--; in hashbin_remove_this()
689 if ( entry == hashbin->hb_current) in hashbin_remove_this()
690 hashbin->hb_current = NULL; in hashbin_remove_this()
693 if ( hashbin->hb_type & HB_LOCK ) { in hashbin_remove_this()
694 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); in hashbin_remove_this()
709 void* hashbin_find( hashbin_t* hashbin, long hashv, const char* name ) in hashbin_find() argument
716 IRDA_ASSERT( hashbin != NULL, return NULL;); in hashbin_find()
717 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); in hashbin_find()
729 entry = hashbin->hb_queue[ bin]; in hashbin_find()
748 } while ( entry != hashbin->hb_queue[ bin ] ); in hashbin_find()
764 void* hashbin_lock_find( hashbin_t* hashbin, long hashv, const char* name ) in hashbin_lock_find() argument
770 spin_lock_irqsave(&hashbin->hb_spinlock, flags); in hashbin_lock_find()
775 entry = hashbin_find(hashbin, hashv, name); in hashbin_lock_find()
778 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); in hashbin_lock_find()
794 void* hashbin_find_next( hashbin_t* hashbin, long hashv, const char* name, in hashbin_find_next() argument
801 spin_lock_irqsave(&hashbin->hb_spinlock, flags); in hashbin_find_next()
808 entry = hashbin_find(hashbin, hashv, name); in hashbin_find_next()
814 hashbin->hb_current = entry; in hashbin_find_next()
815 *pnext = hashbin_get_next( hashbin ); in hashbin_find_next()
820 spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); in hashbin_find_next()
832 irda_queue_t *hashbin_get_first( hashbin_t* hashbin) in hashbin_get_first() argument
837 IRDA_ASSERT( hashbin != NULL, return NULL;); in hashbin_get_first()
838 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); in hashbin_get_first()
840 if ( hashbin == NULL) in hashbin_get_first()
844 entry = hashbin->hb_queue[ i]; in hashbin_get_first()
846 hashbin->hb_current = entry; in hashbin_get_first()
867 irda_queue_t *hashbin_get_next( hashbin_t *hashbin) in hashbin_get_next() argument
873 IRDA_ASSERT( hashbin != NULL, return NULL;); in hashbin_get_next()
874 IRDA_ASSERT( hashbin->magic == HB_MAGIC, return NULL;); in hashbin_get_next()
876 if ( hashbin->hb_current == NULL) { in hashbin_get_next()
877 IRDA_ASSERT( hashbin->hb_current != NULL, return NULL;); in hashbin_get_next()
880 entry = hashbin->hb_current->q_next; in hashbin_get_next()
887 if ( entry != hashbin->hb_queue[ bin ]) { in hashbin_get_next()
888 hashbin->hb_current = entry; in hashbin_get_next()
904 entry = hashbin->hb_queue[ i]; in hashbin_get_next()
906 hashbin->hb_current = entry; in hashbin_get_next()