wrapper device driver

riya khanna riyakhanna1983 at gmail.com
Mon Feb 2 16:24:37 EST 2015


Hi,

I'm writing a device driver to to provide a wrapper device around a
real device. Is it acceptable to do the following:

wrapper_dev_open(flags) {
   // do additional bookkeeping
   real_dev_filp = filp_open(real_device_node_path, flags);
}

wrapper_dev_mmap(mmap_parameters) {
   // do additional checks
   return real_dev_filp->f_op->mmap(mmap_parameters);
}

wrapper_dev_ioctl(ioctl_parameters) {
   // do additional checks
   return real_dev_filp->f_op->ioctl(ioctl_parameters);
}

Is it safe to do something like this? what would be the caveats? Given
a good use case, would the maintainers be willing to mainstream
something like this? Thanks!

-Riya



More information about the Kernelnewbies mailing list