Re: dac960 devices on boot-floppies
On Thu Dec 02, 1999 at 09:19:00PM +1300, Mark van Walraven wrote:
> Well, I now have something much better for fdisk_reread(), but a couple
> of issues have come up.
> 1. Non-disk devices: IDE CD-ROMS can be detected by ioctl(CDROMVOLREAD)
> and SCSI CD-ROMs and tape drives don't have names beginning 'sd',
> but what about SCSI tape, CD-ROM and other non-disk devices attached
> to smart2 and dac960 controllers? How can I check that a target is a
> random-access read/write device?
Well... I happen to know a bit about the CD-ROM stuff...
Trust me, you don't want to discriminate based on CDROMVOLREAD -- that
has been pulled into the Uniform cdrom driver for the 2.3/2.4 kernels.
I put /proc/sys/dev/cdrom/info into the kernel for exactly this type of
thing, since I wanted user space to be able to detect what CDROM devices
were connected to the Uniform CDROM interface. Simply parsing the "drive
name" field in /proc/sys/dev/cdrom/info will give you the list of all
cdrom drives (with the exception of the more obscure of the ancient
prioprietary drives which I never bothered porting to using Uniform, but
even things like mcd, mcdx, cdu31a, sbpcd will work and the others are
so obscure thay are not worth worrying about).
You can also check /proc/ide/hd?/media and if it says "cdrom", you
it is an ATAPI cdrom. You can check /proc/scsi/scsi and if a device
claims it is "Type: CD-ROM" then it is. For a dac960, you can read
/proc/rd/c0/current_status, and it'll tell you lots of interesting
things, but I've never hooked up a cdrom to one (just RAID-ified disks),
so I don't know what that would look like.
Erik B. Andersen Web: http://www.xmission.com/~andersen/
--This message was written using 73% post-consumer electrons--