fs/mmap: rammap should return buffer start address

Signed-off-by: Xuxingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Xuxingliang 2023-01-16 17:55:02 +08:00 committed by Xiang Xiao
parent c821088734
commit dce315005a

View File

@ -179,6 +179,8 @@ int rammap(FAR struct file *filep, FAR struct mm_map_entry_s *entry,
return -ENOMEM; return -ENOMEM;
} }
entry->vaddr = rdbuffer; /* save the buffer firstly */
/* Seek to the specified file offset */ /* Seek to the specified file offset */
fpos = file_seek(filep, entry->offset, SEEK_SET); fpos = file_seek(filep, entry->offset, SEEK_SET);
@ -235,7 +237,6 @@ int rammap(FAR struct file *filep, FAR struct mm_map_entry_s *entry,
/* Add the buffer to the list of regions */ /* Add the buffer to the list of regions */
entry->vaddr = rdbuffer;
entry->priv.i = kernel; entry->priv.i = kernel;
entry->munmap = unmap_rammap; entry->munmap = unmap_rammap;