Subject: Managed to detach and re-attach a PCI IDE disk from user space
To: None <thorpej@zembu.com>
From: Bruce Martin <brucem@cat.co.za>
List: tech-kern
Date: 04/12/2001 10:50:12
Thanks for the advice, I looked through the scsibus driver itself, and it
helped a lot. I modified the pciide driver to allow 3 entry points (open,
close, ioctl), and now I have managed to write two user space programs: one
to detach a drive, and one to probe and reattach any replaced drives.
Everything seems to work nicely.

My next question! From the user space, we would say, for example "detach
wd2". From a kernel detach perspective, it doesn't care that it is wd2, it
wants to know what channel it is on, and which drive it is on that channel.
Is there an easy way to determine, for a certain disk (eg wd2), which
channel and disk it is (eg pciide0:1:0).

Thanks
 Bruce

-----Original Message-----
From: Jason R Thorpe [mailto:thorpej@zembu.com]
Sent: 11 April 2001 05:35
To: Bruce Martin
Cc: 'Jon Lindgren'; tech-kern@netbsd.org
Subject: Re: Calling a function in pciide() from user space?


On Wed, Apr 11, 2001 at 03:36:22PM +0200, Bruce Martin wrote:

 > Thanks, I didn't even know atactl() existed, so it was interesting to
take a
 > look at it. However, it leaves me with the same problem: it needs a
device
 > name (like /dev/wd0d), and so, although something like "atactl /dev/wd1d
 > detach" makes sense, something like "atactl /dev/wd1d reattach" does not
 > make sense, as wd1 does not exist after the detach. I need some way to
call
 > in on the pciide level, or at least the wdc level, to say "detach drive x
on
 > channel y", or "check your channels for new drives"...

Take a look at the scsictl(8) program -- it has a "scan" sub-command
to rescan the bus...

--
        -- Jason R. Thorpe <thorpej@zembu.com>