* @brief Create or lookup an address space for page caching * * This function either creates a new address space or looks up an existing one * in the page cache hash table. If found, it updates the vnode reference and * activates the address space. * * @param[in] dentry Directory entry containing mount point and path info (can be NULL) * @param[in] vnode Pointer to the vnode structure to a
| 720 | * @return Pointer to the found/created address space on success, NULL on failure |
| 721 | */ |
| 722 | struct dfs_aspace *dfs_aspace_create(struct dfs_dentry *dentry, |
| 723 | struct dfs_vnode *vnode, |
| 724 | const struct dfs_aspace_ops *ops) |
| 725 | { |
| 726 | struct dfs_aspace *aspace = RT_NULL; |
| 727 | |
| 728 | RT_ASSERT(vnode && ops); |
| 729 | dfs_pcache_lock(); |
| 730 | if (dentry) |
| 731 | { |
| 732 | aspace = dfs_aspace_hash_lookup(dentry, ops); |
| 733 | } |
| 734 | |
| 735 | if (!aspace) |
| 736 | { |
| 737 | aspace = _dfs_aspace_create(dentry, vnode, ops); |
| 738 | } |
| 739 | else |
| 740 | { |
| 741 | aspace->vnode = vnode; |
| 742 | dfs_aspace_active(aspace); |
| 743 | } |
| 744 | dfs_pcache_unlock(); |
| 745 | return aspace; |
| 746 | } |
| 747 | |
| 748 | /** |
| 749 | * @brief Destroy an address space and release its resources |
no test coverage detected