* @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 */
| 1769 | * @return 0 on success, negative value on error |
| 1770 | */ |
| 1771 | int 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 |
no test coverage detected