Reputation: 329
I am reading Embedded Linux Primer book and The Linux Kernel Module Programming Guide and I am confused about user space application communication with kernel module
User space App --> Device node/proc file --> kernel module ( which resides in /lib/modules/)
1) What is exact difference when we communicate with device node method ( /dev/ - with open,read,write,close calls) and /proc/file method ?
Upvotes: 1
Views: 931
Reputation: 2304
procfs
(/proc
) should be reserved for process information a module should not put any file there. At some point, procfs
was the only available pseudo filesystem, that is why you can find sound system or RTC information. Then, sysfs
was created to properly contain those information.
The main difference between using a device file (usually residing in /dev) and a file from procfs is the way it is handled in the kernel.
Operations used for the device files are registered using the file_operations structure usually with cdev_init
and cdev_add
for a character device. Your module may not do that as quite often, the subsytem is the one registering your device.
While the operations for files in procfs
are registered using proc_create
Upvotes: 0