Re: [PATCH] Move SG_GET_SCSI_ID from sg to scsi

From: Linus Torvalds
Date: Mon Mar 27 2006 - 12:12:50 EST




On Mon, 27 Mar 2006, Douglas Gilbert wrote:
>
> There are two things that really count:
> 1) the identifier (preferably a world wide unique name)
> of the logical unit that is being addressed
> 2) a topological description of how that logical unit
> is connected

And "SCSI ID" doesn't describe either.

> Linux's <hctl> may be a ham fisted way of describing
> a path through a topology, but it easily beats /dev/sdabc
> and /dev/sg4711 .

Sure, you can easily beat it by selecting what you compare it against.

But face it, /dev/sdabc or /dev/sg4711 simply isn't what you should
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..)

> With a device node name like /dev/sdabc, a SCSI INQUIRY or
> an ATA IDENTIFY DEVICE command can be sent to ascertain 1)
> but I am unaware of any command sent to a logical unit that
> will yield 2).

AND NEITHER WILL SCSI_ID. So what the h*ll is your point?

If you want to know how the damn thing is physically connected, you want
to use a path like

/sys/devices/pci0000:00/0000:00:1d.7/usb1/1-1/1-1:1.0/host0/target0:0:0/0:0:0:0/block:sda/dev

Note how, for example, this says 0:0:0:0, which happens to be the
controller/channel/id/lun information for that "SCSI device". Notice how
it is all zeroes? It's because that whole concept doesn't make any sense
for things like USB storage, which has a totally different way to address
the things.

But that thing really _does_ describe the physical location of that block
device (actually, that particular file just contains the information about
what the device node is for the device, but never mind).

And if you want to _use_ the device, you'd probably use a name like
/dev/disk/by-path/usb-0F406C5032802890:0:0:0 (which is that same device,
actually), or, more commonly /dev/disk/by-uuid/1468B594FC37ECF8, which
happens to be the second partition on that physical device and which
stays the same even when you plug that same disk in with firewire.

(Or, in this case, you migt actually want to use /dev/disk/by-label/rEFIt,
which is that same partition on that USB device, but in a human-readable
labeled form).

Again, the "SCSI ID" is a total and utter crock. IT HAS ABSOLUTELY NO
VALID USE. It does _not_ describe what you claim it describes, and it is
_not_ in any way superior to all the other ways of getting to that device.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/