/** * eblob_l2hash_lookup() - finds matching l2hash in tree and performs * collision resolution of @key for each entry in collision list. * If match is found it's placed into structure pointed by @rctl. * * Returns: * 0: Key resolved * -ENOENT: Key not found * <0: Error during lookup */ int eblob_l2hash_lookup(struct eblob_l2hash *l2h, const struct eblob_key *key, struct eblob_ram_control *rctl) { struct eblob_l2hash_entry *e; if (l2h == NULL || key == NULL || rctl == NULL) return -EINVAL; if ((e = __eblob_l2hash_lookup(l2h, key)) != NULL) return eblob_l2hash_resolve_collision(&l2h->collisions, e, key, rctl); return -ENOENT; }
/** * eblob_l2hash_lookup_nolock() - finds matching l2hash in tree and performs * collision resolution of @key for each entry in collision list. * If match is found it's placed into structure pointed by @rctl. * * Returns: * 0: Key resolved * -ENOENT: Key not found * <0: Error during lookup */ static int eblob_l2hash_lookup_nolock(struct eblob_l2hash *l2h, struct eblob_key *key, struct eblob_ram_control *rctl) { struct eblob_l2hash_entry *e; assert(l2h != NULL); assert(key != NULL); assert(rctl != NULL); assert(pthread_mutex_trylock(&l2h->root_lock) == EBUSY); if ((e = __eblob_l2hash_lookup(l2h, key)) != NULL) return eblob_l2hash_resolve_collision(&l2h->collisions, e, key, rctl); return -ENOENT; }