Subject: Re: partition bookkeeping
To: Bill Studenmund <wrstuden@nas.nasa.gov>
From: Oleg Polyanski <luke@eed.miee.ru>
List: tech-kern
Date: 09/23/1999 23:59:58
>>>>> "BS" == Bill Studenmund writes:

 >> Too many magic, IMO. In both cases.  I vote for good device naming scheme
 >> that will prevent from annoying mistakes.

 BS> Well, you're certainly welcome to your opinion. But:

 BS> 1) you can't get deterministic numbers with just cloning devices (sd* at
 BS> scsibus? ...). That's why we tell folks you've got to wire things down.

 BS> 2) a number of storage systems, like fibre channel, need cloning
 BS> devices.  There's no way to wire things down a la c0tXlYpZ - it just
 BS> won't work. :-)

	What you  mean when say `need  cloning devices'? For example, Solaris
	has   no such problem -  devices   with fibre channel interface  just
	mapped to the scsi ids inside the in kernel. You  may map device with
	specified WWN to the required scsi id in configuration file too.

 BS> Remember, you're using the GENERIC kernel, a one-size-fits-all
 BS> kernel. We use only cloning devices so that this one kernel will work
 BS> with whatever folks have. Also, it reduces the foot print in /dev.

	Well, I just vote for kernfs extension or adding  a dedicated fs that
	will map devices  detected in  the  kernel boot stage into  hierarchy
	stored somewhere in the filesystem.  Consider we extend the kernfs:

/kern
    |
    +- hardware
              |
              + cpu0
              + mainbus0
                       |
                       + pci0
                       |    |
                       |    + pchb0
                       |    + ppb0
                       |    |    |
                       |    |    + pci1
                       |    |         |
                       |    |         + vga1
                       |    + pcib0
                       |    |     |
                       |    |     + isa0
                       |    |     |    |
                       |    |     |    + com0
                       |    |     |    + com1
                       |    |     |    + lpt0
                       |    |     |    + pckbc0
                       |    |     |    |      |
                       |    |     |    |      + pckbd0
                       |    |     |    |
                       |    |     |    + fdc0
                       |    |     |         |
                       |    |     |         + fd0
                       |    |     |
                       |    |     + pcppi0
                       |    |     |      |
                       |    |     |      + sysbeep0
                       |    |     + isapnp0
                       |    |     |       |
                       |    |     |       + sb1
                       |    |     |           |
                       |    |     |           + mpu0
                       |    |     |           |    |
                       |    |     |           |    + midi0
                       |    |     |           |
                       |    |     |           + opl0
                       |    |     |                |
                       |    |     |                + midi1
                       |    + pciide0
                       |    |       |
                       |    |       + atapibus0
                       |    |       |         |
                       |    |       |         + channel0
                       |    |       |         |        |
                       |    |       |         |        + drive1
                       |    |       |         |
                       |    |       |         + channel1
                       |    |       |
                       |    |       + atapibus1
                       |    |                 |
                       |    |                 + channel0
                       |    |                 |
                       |    |                 + channel1
                       |    |                          + drive1
                       |    + uhci0
                       |    |     |
                       |    |     + usb0
                       |    |          |
                       |    |          + uhub0
                       |    |                |
                       |    |                + ums0
                       |    |
                       |    + ncr0
                       |    |    |
                       |    |    + scsibus0
                       |    |             |
                       |    |             + target1
                       |    |             |       |
                       |    |             |       + lun0
                       |    |             |
                       |    |             + target2
                       |    |                     |
                       |    |                     + lun0
                       |    |
                       |    + ne0
                       |    + unknown
                       |            |
                       |            + dev19 (unknown for kernel multimedia device)
                       + apm0

	Thank you  for the patience if  you are  here  and still  not sleepy.
	This hierarchy  describes all detected   devices by the kernel  on my
	home PC, for example,

		/kern/hardware/mainbus0/pci0/ncr0/scsibus0/target1/lun0/

	will point exactly to   the disk with id  1  on first detected   SCSI
	controller. But look, the  structure is still incomplete - partitions
	information   absents  here.   Content   of   the last   subdirectory
	(i.e. `lun0') may be filled with wedge driver, for example. `/dev' is
	created later    using  the  `/kern/hardware/'    content. The   most
	attractive   thing  is that    BSD  kernel   also  has  clear  device
	classification and all we need is to build device chain.