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

Function dfs_aspace_clean

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

* @brief Clean all pages from an address space * * This function removes all active pages from the specified address space while * maintaining thread safety through proper locking. It skips inactive pages * during the cleanup process. * * @param[in] aspace Pointer to the address space structure to clean * * @return 0 on success, negative value on error */

Source from the content-addressed store, hash-verified

1769 * @return 0 on success, negative value on error
1770 */
1771int dfs_aspace_clean(struct dfs_aspace *aspace)
1772{
1773 if (aspace)
1774 {
1775 dfs_aspace_lock(aspace);
1776
1777 if (aspace->pages_count > 0)
1778 {
1779 rt_list_t *next = aspace->list_active.next;
1780 struct dfs_page *page;
1781
1782 while (next && next != &aspace->list_active)
1783 {
1784 if (next == &aspace->list_inactive)
1785 {
1786 next = next->next;
1787 continue;
1788 }
1789 page = rt_list_entry(next, struct dfs_page, space_node);
1790 next = next->next;
1791 dfs_page_remove(page);
1792 }
1793 }
1794
1795 dfs_aspace_unlock(aspace);
1796 }
1797
1798 return 0;
1799}
1800
1801/**
1802 * @brief Map a file page into virtual address space

Callers 5

dfs_file_openFunction · 0.85
dfs_file_unlinkFunction · 0.85
dfs_file_renameFunction · 0.85
dfs_file_ftruncateFunction · 0.85
_pcache_cleanFunction · 0.85

Calls 3

dfs_aspace_lockFunction · 0.85
dfs_page_removeFunction · 0.85
dfs_aspace_unlockFunction · 0.85

Tested by

no test coverage detected