DragonFly BSD
DragonFly kernel List (threaded) for 2004-10
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cdevsw_add() vs make_dev()


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Tue, 5 Oct 2004 17:07:21 -0700 (PDT)

: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@xxxxxxxxxxxxx>



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]