[2162] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

Re: More than one SCSI controler & SCSI_IOCTL_GET_IDLUN

daemon@ATHENA.MIT.EDU (Joerg Schilling)
Tue Jul 15 09:09:48 1997

Date: 	Mon, 14 Jul 1997 11:41:08 +0200
From: schilling@fokus.gmd.de (Joerg Schilling)
To: eric@andante.jic.com, schilling@fokus.gmd.de
Cc: linux-scsi@vger.rutgers.edu, tn@bv.rz.fh-muenchen.de

>> I want to enhance cdrecord to be able to deal with more than 
>> one SCSI controler.
>> 
>> For that reason I need to know the SCSI Bus #, the Target ID and the LUN
>> of each device. For this reason I found only one ioctl(2):
>> SCSI_IOCTL_GET_IDLUN. It gives TargetID & LUN but unfortunately
>> there is no Bus #. 
>> 
>> Instead there is totally rubbish information low_ino & 0xff
>> 
>> I will for that reason give the advice for all cdrecord users
>> to change /usr/src/linux/drivers/scsi/scsi_ioctl.c line 338
>> 
>> from:
>> 
>>                  + ((dev->host->hostt->proc_dir->low_ino & 0xff) << 24), 
>> 
>> to:
>>                  + (dev->host->host_no << 24), 
>> 
>> 
>> As the file scsi_ioctl.c seemes not to be maintained, I ask you 
>> to modify this on the next Linux release too.


>	Actually there is a reason why things are the way they are.
>With the current code, this is the only way to determine exactly what
>type of host a given device corresponds to.  The host_no is not a terribly

1)	There is no reason why a user level program needs to know what
	type of controler is hosting a device. It is one of
	the main concepts in UNIX to hide this information from user
	land processes.

2)	The current information is useless anyway because it has
	incomplete information: 
		imagine the line would look like:
                  + ((dev->host->hostt->proc_dir->low_ino & 0x01) << 24), 
		to understand what I mean.
	Currently it is pure luck if the value returned by the ioctl
	differs for two controlers. 

3)	The ioctl SCSI_IOCTL_GET_IDLUN should do what people expect from 
	the name and what similar ioctl's on all other *NIX do.

4)	line 246 in hosts.h says:
	char host_no;  /* Used for IOCTL_GET_IDLUN, /proc/scsi et al. */ 
	which makes me believe that someone already had the same idea before.

5)	If there really is a maintenance program that needs the controler type
	it would be better to add a second ioctl that realy works
	for the expected purpose.


>type of host a given device corresponds to.  The host_no is not a terribly
>meaningful parameter and is mainly used for display purposes.  Returning
>this to the user could be useful just for informational purposes, but at
>the moment I don't see a reason why the host_no *must* be determined.

I really nead the SCSI bus id to be able to do device mapping in cdrecord.
If this cannot be done, it will not be possible to let cdrecord access
any CD-Recorder bejond the first SCSI bus.

Remember a triplet BUS_ID/TARGET/LUN is the only way to specify a specific
target in a platform independent way. Cdrecord currently runs on:
SunOS, Solaris, Linux and NetBSD/FreeBSD/OpenBSD.
and will in future run on SGI and HP too.

Linux currently has no disk formatting program (from what I know).
It would be nice to use my sformat which already compiles on Linux
and uses the same SCSI mapping scheme as cdrecord. If this problem can
be solved, sformat only needs to get support for PC like partition 
tables. Sformat is a SCSI disk formating/analyze/repair program that
incorporates 12 years of experience with SCSI disk.

Joerg


http://www.fokus.gmd.de/usr/schilling	ftp://ftp.fokus.gmd.de/pub/unix

home help back first fref pref prev next nref lref last post