Sorry, misunderstood you.
Ok, run scsidev once (hmm, it coredumped for me) you then get a
/dev/scsi directory:
# ls -l /dev/scsi/
total 0
crw------- 1 root root 9, 128 Aug 8 21:46 rsth24-c000c0i14l0
brw------- 1 root root 8, 0 Aug 8 21:46 sdh24-c000c0i0l0
brw------- 1 root root 8, 1 Aug 8 21:46 sdh24-c000c0i0l0p1
...
which contains the mapping between major/minor (st_dev) and
device type, controller type, controller, channel, scsi id, lun, partition
( sd h24 - c000 c0 i0 l0 p1 )
$man scsidev
...
The device nodes that scsidev creates look something like
"sdh4-334c0i0l0p1". In this case, the various components
of the name represent physical attributes about the device
or the host adapter to which it is connected. To begin
with, the "h4" indicates that it is connected to an
Adaptec 1542. The "-334" is a means of identifying which
1542 the device is attached to (since linux supports more
than one 1542 in the system at the same time). The "c0"
represents the channel number (since some host adapters
can drive multiple scsi busses). The "i0l0" indicates
that this device is scsi ID 0, with lun 0. Finally the
"p1" indicated partition number 1.
...
Or, check out the source for scsidev.
ftp://tsx-11.mit.edu/pub/linux/ALPHA/scsi/
Regards,
/Karl
-----------------------------------------------------------------------
Karl Hammar Asp� Data [EMAIL PROTECTED]
Lilla Asp� 2340 +46 173 140 57 Networks
S-742 94 �sthammar +46 70 511 97 84 Computers
Sweden Consulting
-----------------------------------------------------------------------
From: BenHanokh Gabriel <[EMAIL PROTECTED]>
Subject: Re: finding target id of a scsi device
Date: Tue, 08 Aug 2000 10:28:47 +0300
> hi
>
> i don't think this is the right function, i don't have file-descriptor to the
> device, but the a dev_t referance to it.
> it is also not a terminal device, but a disk block device( SCSI hard-disk )
>
> /gabi
>
> Karl Hammar wrote:
>
> > Try ttyname():
> >
...
> >
> > From: BenHanokh Gabriel <[EMAIL PROTECTED]>
> > Subject: Re: finding target id of a scsi device
> > Date: Mon, 07 Aug 2000 16:17:44 +0300
> >
> > > Douglas Gilbert wrote:
> > >
> > > > BenHanokh Gabriel wrote:
> > > > >
> > > > > hi
> > > > >
> > > > > is there a way in user-space to map from the dev_t ( retrive from
> > > > > stat(2) ) to the scsi target & logical ids?
> > > > > if no can i do it in kernel-space ?
> > > >
> > > > With an open file descriptor to a SCSI device the
> > > > SCSI_IOCTL_GET_IDLUN ioctl() can be used.
> > > > The struct associated with this ioctl() is
> > > > described in:
> > > > http://www.torque.net/scsi/linux_scsi_24
> > > >
> > > > You may also be able to deduce it from looking at
> > > > 'cat /proc/scsi/scsi' [but that is a bit hard to
> > > > parse].
> > > >
> > > > Doug Gilbert
> > >
> > > hi
> > >
> > > i'm not sure if i can use that ioctl, as my program needs to tarnslate
> > > from a file-name into scsi target-id and logical-unit, and the ioctl you
> > > have mentioned can do it with a file-descriptor to an open device, but i
> > > don't have the device name to open.
> > >
> > > i saw that stat(2) returns info about the device at the st_dev field.
> > > is it possible to translate from that field to the device name, or is it
> > > possible to open a device using the dev field extracted by stat?
> > >
> > > please CC me for any answer as i'm not register to the mailing list
> > >
> > > THX
> > > /gabi
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]