Rev 3968 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3968 | Rev 4254 | ||
---|---|---|---|
Line 99... | Line 99... | ||
99 | * Hash table operations for cases when we know that |
99 | * Hash table operations for cases when we know that |
100 | * there will be collisions between different keys. |
100 | * there will be collisions between different keys. |
101 | */ |
101 | */ |
102 | static index_t irq_ht_hash(unative_t *key); |
102 | static index_t irq_ht_hash(unative_t *key); |
103 | static bool irq_ht_compare(unative_t *key, count_t keys, link_t *item); |
103 | static bool irq_ht_compare(unative_t *key, count_t keys, link_t *item); |
- | 104 | static void irq_ht_remove(link_t *item); |
|
104 | 105 | ||
105 | static hash_table_operations_t irq_ht_ops = { |
106 | static hash_table_operations_t irq_ht_ops = { |
106 | .hash = irq_ht_hash, |
107 | .hash = irq_ht_hash, |
107 | .compare = irq_ht_compare, |
108 | .compare = irq_ht_compare, |
108 | .remove_callback = NULL /* not used */ |
109 | .remove_callback = irq_ht_remove, |
109 | }; |
110 | }; |
110 | 111 | ||
111 | /** |
112 | /** |
112 | * Hash table operations for cases when we know that |
113 | * Hash table operations for cases when we know that |
113 | * there will be no collisions between different keys. |
114 | * there will be no collisions between different keys. |
114 | * However, there might be still collisions among |
115 | * However, there might be still collisions among |
115 | * elements with single key (sharing of one IRQ). |
116 | * elements with single key (sharing of one IRQ). |
116 | */ |
117 | */ |
117 | static index_t irq_lin_hash(unative_t *key); |
118 | static index_t irq_lin_hash(unative_t *key); |
118 | static bool irq_lin_compare(unative_t *key, count_t keys, link_t *item); |
119 | static bool irq_lin_compare(unative_t *key, count_t keys, link_t *item); |
- | 120 | static void irq_lin_remove(link_t *item); |
|
119 | 121 | ||
120 | static hash_table_operations_t irq_lin_ops = { |
122 | static hash_table_operations_t irq_lin_ops = { |
121 | .hash = irq_lin_hash, |
123 | .hash = irq_lin_hash, |
122 | .compare = irq_lin_compare, |
124 | .compare = irq_lin_compare, |
123 | .remove_callback = NULL /* not used */ |
125 | .remove_callback = irq_lin_remove, |
124 | }; |
126 | }; |
125 | 127 | ||
126 | /** Number of buckets in either of the hash tables. */ |
128 | /** Number of buckets in either of the hash tables. */ |
127 | static count_t buckets; |
129 | static count_t buckets; |
128 | 130 | ||
Line 345... | Line 347... | ||
345 | spinlock_unlock(&irq->lock); |
347 | spinlock_unlock(&irq->lock); |
346 | 348 | ||
347 | return rv; |
349 | return rv; |
348 | } |
350 | } |
349 | 351 | ||
- | 352 | /** Unlock IRQ structure after hash_table_remove(). |
|
- | 353 | * |
|
- | 354 | * @param lnk Link in the removed and locked IRQ structure. |
|
- | 355 | */ |
|
- | 356 | void irq_ht_remove(link_t *lnk) |
|
- | 357 | { |
|
- | 358 | irq_t *irq = hash_table_get_instance(lnk, irq_t, link); |
|
- | 359 | spinlock_unlock(&irq->lock); |
|
- | 360 | } |
|
- | 361 | ||
350 | /** Compute hash index for the key. |
362 | /** Compute hash index for the key. |
351 | * |
363 | * |
352 | * This function computes hash index into |
364 | * This function computes hash index into |
353 | * the IRQ hash table for which there |
365 | * the IRQ hash table for which there |
354 | * are no collisions between different |
366 | * are no collisions between different |
Line 404... | Line 416... | ||
404 | spinlock_unlock(&irq->lock); |
416 | spinlock_unlock(&irq->lock); |
405 | 417 | ||
406 | return rv; |
418 | return rv; |
407 | } |
419 | } |
408 | 420 | ||
- | 421 | /** Unlock IRQ structure after hash_table_remove(). |
|
- | 422 | * |
|
- | 423 | * @param lnk Link in the removed and locked IRQ structure. |
|
- | 424 | */ |
|
- | 425 | void irq_lin_remove(link_t *lnk) |
|
- | 426 | { |
|
- | 427 | irq_t *irq = hash_table_get_instance(lnk, irq_t, link); |
|
- | 428 | spinlock_unlock(&irq->lock); |
|
- | 429 | } |
|
- | 430 | ||
409 | /** @} |
431 | /** @} |
410 | */ |
432 | */ |