Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Mar 1996 22:45:04 -0800 (PST)
From:      "JULIAN Elischer" <julian@ref.tfs.com>
To:        terry@lambert.org (Terry Lambert)
Cc:        bde@zeta.org.au, freebsd-hackers@FreeBSD.ORG
Subject:   Re: fdisk and partition info
Message-ID:  <199603290645.WAA25956@ref.tfs.com>
In-Reply-To: <199603290348.UAA04470@phaeton.artisoft.com> from "Terry Lambert" at Mar 28, 96 08:48:57 pm

next in thread | previous in thread | raw e-mail | index | archive | help
I have a designe and (some) code for exactly this, except that it's the
other way around.. the disk handling methods call devfs, and not
the other way around..
> 
> CONTROLLER 0 probes for devices
>   DEVICE 1 found
>   *REGISTER DEVICE 1 WITH DEVFS, NAME "/dev/dsk/c0d0
>     -> DEVFS ASKS "BSD slice driver" DO YOU WANT THIS DEVICE?
>        "BSD slice driver" TRYS TO RECOGNIZE DEVICE
>        "BSD slice driver" FAILS TO RECOGNIZE DEVICE
>     <- "BSD slice driver" SAYS NO
>     -> DEVFS ASKS "DOS partition driver" DO YOU WANT THIS DEVICE?
>        "DOS partition driver" TRYS TO RECOGNIZE DEVICE
>        "DOS partition driver" RECOGNIZES DEVICE
[...]
> 
> [ ... controller registers additional devices ... ]
> [ ... additional controllers register additional devices ... ]
> 
> 
> > >1)	The hierarchy could get large fast.  For instance, a device
> > 
> > No kidding.  There are already about 512+64 possible devices for the
> > slice and partition layers.
> 
> Right... that's why you would use directories for population.
usig my scheme you anly have devices for disk partitions that exist.
that is less devices that exist at the  moment..

minor numbers are assigned in increasing non-recuring sequence.
first is 0, 2nd is 1 etc.
if you repartition a drive  and the last device was 6 but youdelete device 3
when you re-make it you get 7..
ther eis a little hash-table to associate minoe numbers to 'disk_section'
structures.
each disk_section has the usual start, length stuff and in addition a pointer
to it's 'parent' device, and a method that is called if non-0
the method() can dynamically re-calculate a request.

a single disk_section can have multiple parents
which would be the case to simulate the CCD driver.

geeze I gotta finish this code.. I feel so guilty..

> 
 as far as naming hierarchy.. I was going to keep tacking things on the end
 sd0/whole
 sd0/part1
 sd0/part2/whole
 sd0/part2/BSDa
 sd0/part2/BSDb
 etc.
 but really that's just a decision taken at the time of the devfs call
 and purely a string..
 it'd be a simple edit to make it:
 sd0
 sd0s1
 sd0s2
 sd0s2a
 sd0s2b

> 
> You could do the same thing with a flat namespace, if you were willing
> to parse the devices into semantic units and build them up one
> character concatenation at a time.
 which I would do I think
> 
> I think that for a minor change in the kernel (30 or less lines of
> additional code), you could get what you wanted from a hierarchy
> much easier.  Note that cloning devices (I'll assume we will go to
> cloning for pty's eventually...)
well possibly.. don't know how yet..
I'd also like to impl;iment an "active directory"
where a 'lookup' is fielded by the driver..



julian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603290645.WAA25956>