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

Function page_read

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

* @brief Read data from 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 read request information * - Output: Contains response status and read data * * @note This function handles page read operations for memory mapped files. * If

Source from the content-addressed store, hash-verified

257 * If the read size is less than page size, it zero-fills the remaining space.
258 */
259void page_read(struct rt_varea *varea, struct rt_aspace_io_msg *msg)
260{
261 rt_ubase_t ret;
262 struct dfs_file *file = dfs_mem_obj_get_file(varea->mem_obj);
263
264 if (file)
265 {
266 LOG_I("%s varea: %p", __func__, varea);
267 LOG_I("varea start: %p size: 0x%x offset: 0x%x attr: 0x%x flag: 0x%x",
268 varea->start, varea->size, varea->offset, varea->attr, varea->flag);
269
270 ret = dfs_aspace_mmap_read(file, varea, msg);
271 if (ret >= 0)
272 {
273 msg->response.status = MM_FAULT_STATUS_OK;
274 if (ret < ARCH_PAGE_SIZE)
275 {
276 memset((char *)msg->buffer_vaddr + ret, 0, ARCH_PAGE_SIZE - ret);
277 }
278 }
279 }
280 else
281 {
282 LOG_E("%s varea %p not a file, vaddr %p", __func__, varea, varea->start);
283 }
284}
285
286/**
287 * @brief Write data to memory mapped file page

Callers

nothing calls this directly

Calls 2

dfs_mem_obj_get_fileFunction · 0.85
dfs_aspace_mmap_readFunction · 0.85

Tested by

no test coverage detected