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

Function page_write

components/dfs/dfs_v2/src/dfs_file_mmap.c:297–322  ·  view source on GitHub ↗

* @brief Write data to memory mapped file page * * @param[in] varea Pointer to the virtual memory area structure * @param[in,out] msg Pointer to the I/O message structure * - Input: Contains write request information * - Output: Contains response status and write result * * @note This function handles page write operations for memory mapped files. *

Source from the content-addressed store, hash-verified

295 * If the write size is less than page size, it zero-fills the remaining space.
296 */
297void page_write(struct rt_varea *varea, struct rt_aspace_io_msg *msg)
298{
299 rt_ubase_t ret;
300 struct dfs_file *file = dfs_mem_obj_get_file(varea->mem_obj);
301
302 if (file)
303 {
304 LOG_I("%s varea: %p", __func__, varea);
305 LOG_I("varea start: %p size: 0x%x offset: 0x%x attr: 0x%x flag: 0x%x",
306 varea->start, varea->size, varea->offset, varea->attr, varea->flag);
307
308 ret = dfs_aspace_mmap_write(file, varea, msg);
309 if (ret > 0)
310 {
311 msg->response.status = MM_FAULT_STATUS_OK;
312 if (ret < ARCH_PAGE_SIZE)
313 {
314 memset((char *)msg->buffer_vaddr + ret, 0, ARCH_PAGE_SIZE - ret);
315 }
316 }
317 }
318 else
319 {
320 LOG_E("%s varea %p not a file, vaddr %p", __func__, varea, varea->start);
321 }
322}
323
324/**
325 * @brief Unmap pages from virtual memory area

Callers

nothing calls this directly

Calls 2

dfs_mem_obj_get_fileFunction · 0.85
dfs_aspace_mmap_writeFunction · 0.85

Tested by

no test coverage detected