Rev 4344 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 4344 | Rev 4348 | ||
---|---|---|---|
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 __attribute__((unused)) |
|
- | 359 | = hash_table_get_instance(lnk, irq_t, link); |
|
- | 360 | spinlock_unlock(&irq->lock); |
|
- | 361 | } |
|
- | 362 | ||
350 | /** Compute hash index for the key. |
363 | /** Compute hash index for the key. |
351 | * |
364 | * |
352 | * This function computes hash index into |
365 | * This function computes hash index into |
353 | * the IRQ hash table for which there |
366 | * the IRQ hash table for which there |
354 | * are no collisions between different |
367 | * are no collisions between different |
Line 404... | Line 417... | ||
404 | spinlock_unlock(&irq->lock); |
417 | spinlock_unlock(&irq->lock); |
405 | 418 | ||
406 | return rv; |
419 | return rv; |
407 | } |
420 | } |
408 | 421 | ||
- | 422 | /** Unlock IRQ structure after hash_table_remove(). |
|
- | 423 | * |
|
- | 424 | * @param lnk Link in the removed and locked IRQ structure. |
|
- | 425 | */ |
|
- | 426 | void irq_lin_remove(link_t *lnk) |
|
- | 427 | { |
|
- | 428 | irq_t *irq __attribute__((unused)) |
|
- | 429 | = hash_table_get_instance(lnk, irq_t, link); |
|
- | 430 | spinlock_unlock(&irq->lock); |
|
- | 431 | } |
|
- | 432 | ||
409 | /** @} |
433 | /** @} |
410 | */ |
434 | */ |