Importing system call as a module function
This is to discuss the problems I am facing with a driver built on a 2.6.18 kernel. In the driver code, a system call has been imported as a module function. Can this be done? The module is building all right without any error. I am providing the link to the source code repository for the same to understand this problem. Here is the function definition in the module code- https://github.com/HeisSpiter/hepunion/blob/096b2950aaf0626abf51098195b89bde... This function long mkdir(......) has most probably imported sytem call sys_mkdir since no other instance of mkdir is there in the kernel source tree. http://lxr.linux.no/linux+v2.6.18/include/linux/syscalls.h#L389 Please somebody explain this. Regards, Saket Sinha
On Sun, 14 Jul 2013 01:05:31 +0530, Saket Sinha said:
This function long mkdir(......) has most probably imported sytem call sys_mkdir since no other instance of mkdir is there in the kernel source tree. http://lxr.linux.no/linux+v2.6.18/include/linux/syscalls.h#L389
Please somebody explain this.
A bigger question is why a kernel module is trying to do a mkdir in the first place. Note that procfs and sysfs provide other APIs for modules to create subdirectories in those pseudo filesystems. I see it looks like yet another attempt to make a "union" filesystem - you almost certainly want to examine the other attempts at doing such a thing, as there's a lot of issues with doing it well. In particular, doing whiteouts and other operations will require more support from the VFS layer. Just doing a mkdir() call behind the VFS's back is almost certainly setting yourself up for trouble (most likely on either locking or object lifetime issues).
participants (2)
-
Saket Sinha -
Valdis.Kletnieks@vt.edu