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

Function dfs_aspace_destroy

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

* @brief Destroy an address space and release its resources * * This function decrements the reference count of the address space and marks it as inactive. * If the reference count reaches 1 and there are no pages left, it will be fully released. * * @param[in] aspace Pointer to the address space to be destroyed * * @return 0 on successful release, -EINVAL if aspace is NULL */

Source from the content-addressed store, hash-verified

756 * @return 0 on successful release, -EINVAL if aspace is NULL
757 */
758int dfs_aspace_destroy(struct dfs_aspace *aspace)
759{
760 int ret = -EINVAL;
761
762 if (aspace)
763 {
764 dfs_pcache_lock();
765 dfs_aspace_lock(aspace);
766 rt_atomic_sub(&aspace->ref_count, 1);
767 RT_ASSERT(rt_atomic_load(&aspace->ref_count) > 0);
768 dfs_aspace_inactive(aspace);
769 aspace->vnode = RT_NULL;
770 if (dfs_aspace_release(aspace) != 0)
771 {
772 dfs_aspace_unlock(aspace);
773 }
774 dfs_pcache_unlock();
775 }
776
777 return ret;
778}
779
780/**
781 * @brief Release an address space when its reference count reaches 1

Callers 2

dfs_vnode_destroyFunction · 0.85
dfs_vnode_unrefFunction · 0.85

Calls 6

dfs_pcache_lockFunction · 0.85
dfs_aspace_lockFunction · 0.85
dfs_aspace_inactiveFunction · 0.85
dfs_aspace_releaseFunction · 0.85
dfs_aspace_unlockFunction · 0.85
dfs_pcache_unlockFunction · 0.85

Tested by

no test coverage detected