Hi, friends.
I want to know, why does linux use a 16-bit value to indicate device id ?
8-bit for major and 8-bit for minor seems not enough nowadays.
For example, device major id 8 indicate the 1th to 16th SCSI disks, and we have to indicate another 17th - 32th disks using major id 65.
This seems ugly? isn't it ?
If we use a 32-bit device value, namely, 16-bit for major, 16-bit for minor, we can adopt all device instance with one device major.
I am writing a kernel somewhat like linux kernel, and I am considering using a 32-bit device value.
Why not linux use a larger 'dev_id' ?
Re: Why not linux use a larger 'dev_id' ?
dev_t is a 32-bit value, not 16.
Re: Why not linux use a larger 'dev_id' ?
After looking around I think I know what's going on: it originally used to hold 16-bit values (8-bit major and 8-bit minor) but they started running out of space so eventually it got extended to 32-bit values (12-bit major and 20-bit minor). The old 16-bit values are still supported for backwards compatibility.
Re: Why not linux use a larger 'dev_id' ?
That was over 13 years ago, so the OP is looking at prehistoric source code.
- Schol-R-LEA
- Member
- Posts: 1925
- Joined: Fri Oct 27, 2006 9:42 am
- Location: Athens, GA, USA
Re: Why not linux use a larger 'dev_id' ?
On a guess was it either Linus' original 0.1 forum post code , or maybe the code from the 1999 edition of Linux Core Kernel Commentary (great book, laid out very much in the manner of the 1996 facsimile version of Lions' Commentary on Unix 6th Edition - which is also highly recommended despite being decades old - but dated even at the time of publication; I had the 2001 update until recently, and while it was very helpful, it could also be misleading because of its age).iansjack wrote:That was over 13 years ago, so the OP is looking at prehistoric source code.
Rev. First Speaker Schol-R-LEA;2 LCF ELF JAM POEE KoR KCO PPWMTF
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Ordo OS Project
Lisp programmers tend to seem very odd to outsiders, just like anyone else who has had a religious experience they can't quite explain to others.
Re: Why not linux use a larger 'dev_id' ?
@iansjack @Sik @Schol-R-LEA
Thank you all !
I got it.
I am reading source code of linux 0.11.
Thank you all !
I got it.
I am reading source code of linux 0.11.
Re: Why not linux use a larger 'dev_id' ?
Excuse me, what does 'OP' mean ?iansjack wrote:That was over 13 years ago, so the OP is looking at prehistoric source code.
Re: Why not linux use a larger 'dev_id' ?
'OP' is short for 'original poster'; it refers to the person that started the thread.
Re: Why not linux use a larger 'dev_id' ?
Thanks!iansjack wrote:'OP' is short for 'original poster'; it refers to the person that started the thread.
In china, this is called "lz', or 'louzhu', or "楼主".