* @brief Write data to memory-mapped file space * * This function handles write operations for memory-mapped file regions by * translating virtual addresses to file positions and performing the actual * write operation through dfs_aspace_write. * * @param[in] file Pointer to the file structure being mapped * @param[in] varea Pointer to the virtual memory area structure * @param[in] data
| 2122 | * 0 if any parameter is invalid |
| 2123 | */ |
| 2124 | int dfs_aspace_mmap_write(struct dfs_file *file, struct rt_varea *varea, void *data) |
| 2125 | { |
| 2126 | int ret = 0; |
| 2127 | |
| 2128 | if (file && varea) |
| 2129 | { |
| 2130 | struct rt_aspace_io_msg *msg = (struct rt_aspace_io_msg *)data; |
| 2131 | if (msg) |
| 2132 | { |
| 2133 | off_t fpos = dfs_aspace_fpos(varea, msg->fault_vaddr); |
| 2134 | return dfs_aspace_write(file, msg->buffer_vaddr, ARCH_PAGE_SIZE, &fpos); |
| 2135 | } |
| 2136 | } |
| 2137 | |
| 2138 | return ret; |
| 2139 | } |
| 2140 | |
| 2141 | #endif |
no test coverage detected