Re: cdevsw_add() vs make_dev()

看板DFBSD_kernel作者時間21年前 (2004/10/06 08:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
:Wouldn't it be cleaner to give every driver its own major number? Maybe I :really need to read 4.4 D&I or something like that to understand what I'm :talking about. : :cheers : simon No, there aren't enough major numbers to go around. The pty's alone would eat them all up. e.g. 'ad' eats a major number. The minor number is then broken down into a unit, like 'ad0', slice, like 'ad0s1', and partition, like 'ad0s1a'. So for the 'ad' major number you already have a ton of possible minor number combinations: (taken from sys/disklabel.h) 32 bit device id /* 3 2 1 0 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 _________________________________________________________________ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ----------------------------------------------------------------- | TYPE |UNIT_2 |P| SLICE | MAJOR | UNIT |PART | ----------------------------------------------------------------- */ so e.g. ad[0-511]s[0-15][a-p] UNIT SLICE PARTITION There are only 256 major numbers. -Matt Matthew Dillon <dillon@backplane.com>
文章代碼(AID): #11Opq400 (DFBSD_kernel)
文章代碼(AID): #11Opq400 (DFBSD_kernel)