Single Linux Device Driver code for multiple Linux versions using LINUX_VERSION
The arguments of the kernel functions changes with new releases.
For example, Kernel versions > 3.10 use the below function to create a proc entry
For kernel versions < 3.10, this API was
This macro expands to the binary representation of the kernel version
For example for Linux version 2.6.10, the value is 132618(0x02060a)
There is another macro KERNEL_VERSION(major, minor, release). This builds up the version number from the individual numbers. For example KERNEL_VERSION(2,6,10) will return 132618
Sample Code:
Output:
For example, Kernel versions > 3.10 use the below function to create a proc entry
proc_file_entry = proc_create("proc_file_name", 0, NULL, &proc_file_fops);
proc_file_entry = create_proc_entry("proc_file_name", 0, NULL);
If you want to have a Linux Device Driver which supports multiple Linux Versions, use the macro LINUX_VERSION_CODEThis macro expands to the binary representation of the kernel version
For example for Linux version 2.6.10, the value is 132618(0x02060a)
There is another macro KERNEL_VERSION(major, minor, release). This builds up the version number from the individual numbers. For example KERNEL_VERSION(2,6,10) will return 132618
Sample Code:
Output:
Very nice Post keep sharing it helps me a lot.
ReplyDeleteThank You!
mac repair adelaide, Adelaide pc repairs
computer repairs perth