I am learning linux device driver development and created the code of a basic kernel module which creates a pseudo char device.
That module got compiled and inserted too..
When I did lsmod the result was like this
Module Size Used by
modeldriver 2540 0
what does that number indicate? what is meant by size of the module?
And what is the maximum value of major and minor numbers in linux?
Where can I get to know about the values of linux kernel 2.6.37
1.
“Size” is the amount of memory the kernel module occupies, that is, the size of code, data and probably some special sections of the module loaded to memory. Note that the memory allocated dynamically by the module itself is not included there.
2.
As for the major/minor numbers, it is better not to rely on the particular limits. If you need to reserve such numbers for your character devices, for example, you can use
alloc_chrdev_region().From the definitions of
MAJOR(),MINOR()andMKDEV()in<linux/kdev_t.h>, it follows that 12 bits are used to encode a major number (0..4095, it seems), 20 bits – for the minors. Section “The Internal Representation of Device Numbers” of chapter 3 of “The Linux Device Drivers” book (3rd ed.) confirms that too:If you have not done so already, I would recommend taking a look at Linux Device Drivers book mentioned above. While a bit outdated in some places, it is still very useful.