I am trying to understand how mmap works. User level call of mmap looks like below.
void *mmap(void *addr, size_t len, int prot, int flags,
int fildes, off_t off);
but kernel level mmap for a particular device driver looks like:
int <device_name>_mmap(struct file*fp, struct vm_area_struct *vma)
I also looked at the source code but I am not able to find the connection in between.
How does mmap for particular device gets its arguments "struct vm_area_struct *vma" ? Can you please help me understand that ? Appreciate your help.
vm_area_struct
contains the information about the virtual address range to be mapped in the user process and the offset on the device the application wants to map. Thefile
argument corresponds to the file descriptor on the user side. – R.. GitHub STOP HELPING ICE