Kurt Garloff writes:
> garloff@pckurt:/raid5/Kernel/src $ cat /proc/scsi/map
> # C,B,T,U Type onl sg_nm sg_dev nm dev(hex)
> 0,0,00,00 0x05 1 sg0 c:15:00 sr0 b:0b:00
> 1,0,01,00 0x05 1 sg1 c:15:01 sr1 b:0b:01
> 1,0,02,00 0x01 1 sg2 c:15:02 osst0 c:ce:00
> 1,0,03,00 0x05 1 sg3 c:15:03 sr2 b:0b:02
> 1,0,05,00 0x00 1 sg4 c:15:04 sda b:08:00
> 1,0,09,00 0x00 1 sg5 c:15:05 sdb b:08:10
> 2,0,01,00 0x05 1 sg6 c:15:06 sr3 b:0b:03
> 2,0,02,00 0x01 1 sg7 c:15:07 osst1 c:ce:01
> 2,0,03,00 0x05 1 sg8 c:15:08 sr4 b:0b:04
> 2,0,05,00 0x00 1 sg9 c:15:09 sdc b:08:20
> 2,0,09,00 0x00 1 sg10 c:15:0a sdd b:08:30
> 3,0,10,00 0x00 1 sg11 c:15:0b sde b:08:40
> 3,0,12,00 0x00 1 sg12 c:15:0c sdf b:08:50
>
> This allows a simple script to parse the map and create device
> nodes as needed.
...
> Obviously, it can only report the assignment of high-level drivers,
> if they are loaded, otherwise the last two columns will stay empty.
> (sg is handled especially, as we know it supports all devices.)
> If we attach a third high-level device driver, two more columns
> would show up. (Is this variable column number format a problem?)
The variable column format is of course annoying, but use
it if you must. The also-annoying alternative is to pick
a fill character that would be easy for a beginner to
handle in a script. Maybe one of: @ - . / ?
The header line is far worse. It's too terse to be very helpful.
It gets in the way of every person writing a parser. Even in
your example script, you had to hack your way around it:
> +while read cbtu tp onl sgnm sgdev othnm othdev oothnm oothdev rest; do
> + # Skip comment line(s)
> + if test "${cbtu:0:1}" = "#"; then continue; fi
> + # If we're just dealing with one device, do skip the others
> + if test ! -z "$CMPAGAINST" -a "$CMPAGAINST" != "$cbtu"; then continue;
> fi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Sun Jun 23 2002 - 22:00:11 EST