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

Function dfs_page_unmap

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

* @brief Unmap all memory mappings for a page * * This function unmaps all virtual memory areas that have mapped this physical page. * It also marks the page as dirty if it contains valid data that hasn't been written back. * * @param[in,out] page Pointer to the page structure to unmap * * @return Always returns 0 */

Source from the content-addressed store, hash-verified

953 * @return Always returns 0
954 */
955static int dfs_page_unmap(struct dfs_page *page)
956{
957 rt_list_t *next;
958 struct dfs_mmap *map;
959
960 next = page->mmap_head.next;
961
962 if (next != &page->mmap_head && page->fpos < page->aspace->vnode->size)
963 {
964 dfs_page_dirty(page);
965 }
966
967 while (next != &page->mmap_head)
968 {
969 map = rt_list_entry(next, struct dfs_mmap, mmap_node);
970 next = next->next;
971
972 if (map)
973 {
974 rt_varea_t varea;
975 void *vaddr;
976
977 varea = rt_aspace_query(map->aspace, map->vaddr);
978 RT_ASSERT(varea);
979 vaddr = dfs_aspace_vaddr(varea, page->fpos);
980
981 rt_varea_unmap_page(varea, vaddr);
982
983 rt_free(map);
984 }
985 }
986
987 rt_list_init(&page->mmap_head);
988
989 return 0;
990}
991
992/**
993 * @brief Create a new page structure for page cache

Callers 1

dfs_page_releaseFunction · 0.85

Calls 6

dfs_page_dirtyFunction · 0.85
rt_aspace_queryFunction · 0.85
dfs_aspace_vaddrFunction · 0.85
rt_varea_unmap_pageFunction · 0.85
rt_freeFunction · 0.85
rt_list_initFunction · 0.85

Tested by

no test coverage detected