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

Function dfs_aspace_create

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

* @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

Source from the content-addressed store, hash-verified

720 * @return Pointer to the found/created address space on success, NULL on failure
721 */
722struct 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

Callers 5

_dfs_tmpfs_lookupFunction · 0.85
dfs_tmpfs_create_vnodeFunction · 0.85
dfs_cromfs_lookupFunction · 0.85
dfs_elm_lookupFunction · 0.85
dfs_elm_create_vnodeFunction · 0.85

Calls 5

dfs_pcache_lockFunction · 0.85
dfs_aspace_hash_lookupFunction · 0.85
_dfs_aspace_createFunction · 0.85
dfs_aspace_activeFunction · 0.85
dfs_pcache_unlockFunction · 0.85

Tested by

no test coverage detected