I'm working on a Linux kernel module which shares a piece of memory with user applications through the syscall mmap. The module works alright with the help of the mmap callback defined in the struct file_operations, which informs the module when the syscall is invoked.
However, the problem comes out when user applications want to stop the sharing through syscall munmap. There is not an munmap callback or something that does similar work in the struct file_operations. Therefore, I have to do another ioctl to inform the kernel module that the sharing has been revoked, which is both inconvenient and insecure.
During my search for the solution, I found that there was once an munmap callback defined. But it was removed when the kernel version was about 2.4 or some times after.
Can someone tell me why the munmap callback is removed or is there any alternative approach to inform the kernel module when an munmap syscall is called?