* @brief Read data from memory-mapped file space * * This function handles read operations for memory-mapped file regions by * translating virtual addresses to file positions and performing the actual * read operation through dfs_aspace_read. * * @param[in] file Pointer to the file structure being mapped * @param[in] varea Pointer to the virtual memory area structure * @param[in] data
| 2090 | * 0 if any parameter is invalid |
| 2091 | */ |
| 2092 | int dfs_aspace_mmap_read(struct dfs_file *file, struct rt_varea *varea, void *data) |
| 2093 | { |
| 2094 | int ret = 0; |
| 2095 | |
| 2096 | if (file && varea) |
| 2097 | { |
| 2098 | struct rt_aspace_io_msg *msg = (struct rt_aspace_io_msg *)data; |
| 2099 | if (msg) |
| 2100 | { |
| 2101 | off_t fpos = dfs_aspace_fpos(varea, msg->fault_vaddr); |
| 2102 | return dfs_aspace_read(file, msg->buffer_vaddr, ARCH_PAGE_SIZE, &fpos); |
| 2103 | } |
| 2104 | } |
| 2105 | |
| 2106 | return ret; |
| 2107 | } |
| 2108 | |
| 2109 | /** |
| 2110 | * @brief Write data to memory-mapped file space |
no test coverage detected