Read From A Device in Kernel Module

356 Views Asked by At

Is it possible to read from a device in a kernel module? For example if I wanted to read from /dev/sda how would I go about doing that (I picked /dev/sda just as an example, in my exact scenario I need to read from a character device)? I know user space functions aren't available in kernel modules so I assume the open function for opening a device file is not available, plus I would assume that since the code is already being executed in kernel space there's probably a way to bypass the dev filesystem and access the device directly. Also, if it's not possible to read from it, is it at least possible to check if it exists?

0

There are 0 best solutions below