Click here to Skip to main content
15,797,923 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All :)

I'm well aware that accessing normal files in kernel space is a bad idea, but is it that bad idea to access a device file associated with some device driver?

I have to communicate with a device driver through another kernel module (which could well be a user space module but I'm not given the option to re-write it to one), this module is currently a special serial port device driver which implements a lot more functionality that it is supposed to (due to latency constrains they couldn't implement this functionality in user space). Now however, we are going to a new hardware platform, which is much more powerful and has different peripherals i.e. USB-to-Serial converters. So I'm supposed to remove all RS232 specifics from that driver (leaving the special functionality) and make it work with the standard USB driver... That solution has been preferred over moving all the special functionality into a user space module.

All I could find in Google were questions: "How do I open/read/write a regular file located somewhere in the file system through a kernel module" and answers explaining how bad idea it is to do that while showing how to actually do it...

Since a device file is a special one I'm guessing that accessing one through kernel space wouldn't rise all those problems associated with accessing a normal file, but I'm not sure...

If that's OK then should I use sys_open/write/read of vfs_ ones?
I missed to mention that I'm new to Linux programing (user/kernel alike)...

Thanks in advance! :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900