Subject: Re: detaching SCSI devices
To: None <email@example.com>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 07/10/1999 14:28:59
>>> Actually, as far as i'm concerned, the "right thing" to do here is
>>> jsut keep the # of the first unit to be allocated to cloning
>>> (FSTATE_STAR) devices, then just search for a free slot.
>> This is equivalent to just starting from unit 0 and searching for a
>> free slot; consider
>> sd4 at scsibus0 target 3 lun 1
>> sd* at scsibus?
> Actually, given the current implementation, doing what you suggest
> above is a fair bit harder, since there's no compact representation
> of which unit numbers are reserved.
My point is that if you "just keep the # of the first unit to be
allocated to cloning devices, then just search for a free slot", you
*still* have to skip reserved unit numbers, because the first unit
available for cloning may be below other, nailed-down, units. Either
that or you completely lose all units below the highest nailed-down
unit (if they aren't available for cloning, they'll be lost unless
they're explicitly configured). And if you're doing whatever is
necessary to skip reserved but not currently present unit numbers, you
might as well just start from 0.
Of course, it might well be not too great a price to just start cloning
above the highest explicitly allocated unit; it would, as you point
out, simplify the code, and I doubt too many kernel configs explicitly
allocate unit numbers with gaps (and of those, even fewer care whether
cloning devices fill in those holes).
> If you start checking from 0, you have figure out whether every NULL
> you see between 0 and the first cloning unit is unused, or is
> 'reserved' for some device. The only way to do that is searching the
> cfdata array.
There's no reason config(8) couldn't generate an auxiliary array to
help out. (This array would need only as many elements as there are
explicitly allocated units; I don't think it would be a big price. At
the cost of a tiny bit more code in the routine that uses it, it could
even be optimized away if there are no holes in the list of nailed-down
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B