* Dictionary management. We maintain an in-kernel dictionary to map * paths to semaphore objects. We use the FNV hash on the path to * store the mappings in a hash table. */
| 374 | * store the mappings in a hash table. |
| 375 | */ |
| 376 | static struct ksem * |
| 377 | ksem_lookup(char *path, Fnv32_t fnv) |
| 378 | { |
| 379 | struct ksem_mapping *map; |
| 380 | |
| 381 | LIST_FOREACH(map, KSEM_HASH(fnv), km_link) { |
| 382 | if (map->km_fnv != fnv) |
| 383 | continue; |
| 384 | if (strcmp(map->km_path, path) == 0) |
| 385 | return (map->km_ksem); |
| 386 | } |
| 387 | |
| 388 | return (NULL); |
| 389 | } |
| 390 | |
| 391 | static void |
| 392 | ksem_insert(char *path, Fnv32_t fnv, struct ksem *ks) |