MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dfs_aspace_hash_lookup

Function dfs_aspace_hash_lookup

components/dfs/dfs_v2/src/dfs_pcache.c:546–566  ·  view source on GitHub ↗

* @brief Look up an address space in the page cache hash table * * This function searches for an address space matching the given dentry and operations * in the page cache hash table. If found, it increments the reference count of the * address space before returning it. * * @param[in] dentry Directory entry containing mount point and path information * @param[in] ops Pointer to address

Source from the content-addressed store, hash-verified

544 * @return Pointer to the found address space on success, NULL if not found
545 */
546static struct dfs_aspace *dfs_aspace_hash_lookup(struct dfs_dentry *dentry, const struct dfs_aspace_ops *ops)
547{
548 struct dfs_aspace *aspace = RT_NULL;
549
550 dfs_pcache_lock();
551 rt_list_for_each_entry(aspace, &__pcache.head[dfs_aspace_hash(dentry->mnt, dentry->pathname)], hash_node)
552 {
553
554 if (aspace->mnt == dentry->mnt
555 && aspace->ops == ops
556 && !strcmp(aspace->pathname, dentry->pathname))
557 {
558 rt_atomic_add(&aspace->ref_count, 1);
559 dfs_pcache_unlock();
560 return aspace;
561 }
562 }
563 dfs_pcache_unlock();
564
565 return RT_NULL;
566}
567
568/**
569 * @brief Insert an address space into page cache

Callers 1

dfs_aspace_createFunction · 0.85

Calls 3

dfs_pcache_lockFunction · 0.85
dfs_aspace_hashFunction · 0.85
dfs_pcache_unlockFunction · 0.85

Tested by

no test coverage detected