What needs to be done so that a file node is created in the /dev directory when we do insmod my_dev.ko. (i dont want to use mknod /dev/my_nod c MAJOR MINOR)
In Linux 2.4 kernel, you can use "devfs_register" API to register a file that represents your driver.
In Linux 2.6 kernel, you can use "devfs_mk_cdev" and "devfs_mk_bdev" APIs, for char device and block device, to register a file in /dev directory. When use these two APIs, you need to include "devfs_fs_kernel.h".
In kernel 2.6, you can make use of the udev rules to create a dev node as you wanted or create a link attached to a real node. This node is created automatically by udev.
Register file in /dev directory
In Linux 2.4 kernel, you can use "devfs_register" API to register a file that represents your driver.
In Linux 2.6 kernel, you can use "devfs_mk_cdev" and "devfs_mk_bdev" APIs, for char device and block device, to register a file in /dev directory. When use these two APIs, you need to include "devfs_fs_kernel.h".
Using the udev rules
In kernel 2.6, you can make use of the udev rules to create a dev node as you wanted or create a link attached to a real node. This node is created automatically by udev.
Interesting
Interesting
http://www.kroah.com/linux/talks/ols_2003_udev_paper/Reprint-Kroah-Hartman-OLS2003.pdf