* @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
| 544 | * @return Pointer to the found address space on success, NULL if not found |
| 545 | */ |
| 546 | static 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 |
no test coverage detected