Linux-SCSI Archive on lore.kernel.org
 help / color / Atom feed
From: Linus Torvalds <torvalds@osdl.org>
To: Matthew Wilcox <matthew@wil.cx>
Cc: Douglas Gilbert <dougg@torque.net>, Bodo Eggert <7eggert@gmx.de>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Move SG_GET_SCSI_ID from sg to scsi
Date: Mon, 27 Mar 2006 09:43:30 -0800 (PST)
Message-ID: <Pine.LNX.4.64.0603270936290.15714@g5.osdl.org> (raw)
In-Reply-To: <20060327172530.GH3486@parisc-linux.org>



On Mon, 27 Mar 2006, Matthew Wilcox wrote:
> > compare against. What you should compare against is
> > 
> > 	/dev/cdrom
> > 	/sys/bus/ide/devices/0.0/block:hda/dev
> > 	/dev/uuid/3d9e6e8dfaa3d116
> > 	..
> > 
> > and a million OTHER ways to specify which device you're interested in.
> > 
> > The fact is, they can potentially all do the SCSI command set. And a "SCSI 
> > ID" makes absolutely zero sense for them (those three devices may be the 
> > same device, they may not be, they might be on another machine, who 
> > knows..)
> 
> If this ioctl is generally supported, then you'll be able to find out if
> they're all the same ;-)

Sorry, but no. You didn't read the other example in my email.

Many (most) Linux devices will actually have 0:0:0:0 in that field. 
Because the SCSI ID simply doesn't make sense to them, and they have none. 
So it's _not_ a unique ID.

For example, look at linux/block/scsi_ioctl.c, and realize that because I 
wanted to make sure that you could run "cdrecord dev=/dev/hdc", it does a 
few ioctl's that cdrecord wanted. In particular, it does 
SCSI_IOCTL_GET_IDLUN and SCSI_IOCTL_GET_BUS_NUMBER. Take a look at what it 
actually returns, and how it explicitly does NOT try to claim that those 
numbers "mean" anything.

The fact is, BUS/ID/LUN crap really doesn't make sense for the majority of 
devices out there. Never has, never will. The fact that old-fashioned SCSI 
devices think of themselves that way has absolutely zero to do with 
reality today.

If you want to know whether two devices are the same or not, you should do 
a "stat()" on the device node, and look at "st->rdev". No, it's not in any 
way guaranteed either, but it's actually a hell of a better rule than 
looking at ID/LUN information.

Trying to make more people use UUID's is the way to _really_ distinguish 
devices from each other.

			Linus

  reply index

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-26 19:28 Bodo Eggert
2006-03-26 19:51 ` Arjan van de Ven
2006-03-26 20:08   ` Matthew Wilcox
2006-03-26 20:41     ` Arjan van de Ven
2006-03-26 20:05 ` Matthew Wilcox
2006-03-27 10:11   ` Bodo Eggert
2006-03-27 15:20     ` Matthew Wilcox
2006-03-27 15:40       ` James Bottomley
2006-03-26 22:30 ` Linus Torvalds
2006-03-26 23:19   ` Jan Engelhardt
2006-03-27  0:06     ` Linus Torvalds
2006-03-27 11:42   ` Bodo Eggert
2006-03-28  9:43     ` Matthias Andree
2006-03-27 15:03   ` Douglas Gilbert
2006-03-27 17:15     ` Linus Torvalds
2006-03-27 17:25       ` Matthew Wilcox
2006-03-27 17:43         ` Linus Torvalds [this message]
2006-03-27 19:54           ` Alan Cox
2006-03-27 21:29             ` Douglas Gilbert
2006-03-28  7:37               ` Stefan Richter
2006-03-28 14:17                 ` Jan Engelhardt
2006-03-26 23:09 ` Stefan Richter

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0603270936290.15714@g5.osdl.org \
    --to=torvalds@osdl.org \
    --cc=7eggert@gmx.de \
    --cc=dougg@torque.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-SCSI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-scsi/0 linux-scsi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-scsi linux-scsi/ https://lore.kernel.org/linux-scsi \
		linux-scsi@vger.kernel.org
	public-inbox-index linux-scsi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-scsi


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git