CHANGES to scsidev:
See comments on top of scsidev.c.

/* 
 * Program to assign static device names to SCSI devices as opposed to the
 * dynamic numbering of the Linux-1.0 -- 2.6 kernel.
 * Program written by Eric Youngdale <aric@aib.com>
 * Reworked 1/2000 Kurt Garloff <garloff@suse.de>
 * 
 * Copyright: GNU GPL.
 * Please read the file COPYING.
 *
 * Changes:
 * * 2000/01/16: Kurt Garloff <garloff@suse.de>: 
 *   - SCSI_DISK_MAJOR
 *   - Fixed lots of warnings
 *   - use tmp file in /dev/scsi
 *   Fix /etc/scsi-alias functionality
 *   - Parsing: Respect EOL \0
 *   - inquire: Request takes a few bytes, response buffer is somewhat smaller
 *		use getstr() to get and truncate strings
 *   - comparison: Empty Strings of failed inquiries do not fit
 * -> Released Version: 1.6
 * 
 * * 2000/01/17: Kurt Garloff <garloff@suse.de>:
 *   Major changes:
 *   - Now scan completely relying on sg. Does inquiry for every device
 *     immediately (it's not that expensive), and does interpret the 
 *     periph dev qualifier field to build the other high-level SCSI devs.
 *     -> removable devices will work, this way.
 *     For harddisks, the partitions will be scanned, for tapes the n version
 *     be created.
 *   Minor changes:
 *   - new inquiry () function replacing old inquire and get_version_no
 *   - added support for more than 16 SCSI disks
 *   - quiet flag -q
 *   - Link alias names flag -L
 *   - -c maxmiss option: Tolerate maxmiss missing sg devs.
 *   - rev and hostname fields
 *   - avoid unnecessary recreation of alias names
 *   - new options -n osanitize and -d elete undetected
 * -> Released Version: 2.0
 * 
 * * 2000/01/18: Kurt Garloff <garloff@suse.de>
 *   In principal, there is a chance to fool scsidev: Remove a device with
 *   a low SCSI ID and reinsert another device. Then the assumptions of
 *   scsidev about the dev no. ordering of the kernel are wrong.
 *   - Add a check for this
 *   - infrastructure changes: scsiname () and oldscsiname ()
 *   - struct regnames (sname) now has generic pointer to allow
 *     relationships between devs. name is the full name, now.
 * 
 *  * 2000/07/15: Kurt Garloff <garloff@suse.de>
 *    - Open device nodes (but sg) with O_NONBLOCK; unfortunately this is not
 *      honoured by most of Linux' SCSI high-level drivers :-(
 *    - Add support for OnStream tapes (osst)
 *  -> Version 2.20
 * 
 *  * 2000/09/04: Kurt Garloff <garloff@suse.de>
 *    - Bugfix for long hostnames from Doug Gilbert (=> 2.21)
 *    - Fix parsing of scsi.alias file: Broke on missing LF at the end
 *  -> 2.22
 * 
 *  * 2002/07/26: Kurt Garloff <garloff@suse.de>
 *    - optional (-e) cbtu naming scheme
 *    - bugfix WRT alias handling of subdevices (parititons, non-rew. tap)
 *    - Support for large SCSI IDs and LUNs. (from MGE)
 *    - Support WWID (INQ EVPD 0x83) report + aliases
 *    - Fix hex number parser
 *  -> 2.23
 * 
 *  * 2002/07/29: Kurt Garloff <garloff@suse.de>
 *    - More sane way of storing permissions
 *    - Less relying on major numbers
 *    - Support many SDs (only up to 255 that is)
 *    - Support for SCSI changers
 *  -> 2.24
 *
 *  * 2002/07/30: Kurt Garloff <garloff@suse.de>
 *    - Support for /proc/scsi/scsi extensions
 *    - Get other info from proc as well (hostname, ioport, partitions) 
 *	as needed
 *    - Alternatively match short hostname
 *    - Support for really large no of disks
 *    - Strip leading and trailing spaces for SCSI INQUIRY stuff, esp. 
 *	the serial number.
 *    - We now have a sane way of handling permission. Major code cleanup.
 *	Permissions are stored in /dev/scsi/.shadow.XXX files, now.
 *    - If working in symlink mode, we do adjust the permissions of the
 * 	underlying real dev node now.
 *  -> 2.25
 * 
 *  * 2002/08/07: Kurt Garloff <garloff@suse.de>
 *    - Fix segfault for failed inquiries
 *    - Explicitly set alias device types (could be wrong)
 *    - Check blk vs. chr devtype when updating dev node
 *  -> 2.26
 * 
 *  * 2002/08/07: Kurt Garloff <garloff@suse.de>
 *    - Fix usage message
 *  -> 2.27
 * 
 *  * 2002-10-04: Kurt Garloff <garloff@suse.de>
 *    - Bugfix from Olaf Hering (don't use arg twice in sscanf)
 *    - Multipathing support
 *    - Fix Medium Changer (and other device types with spaces) detection 
 *  -> 2.28
 * 
 *   * 2003-01-13: Kurt Garloff <garloff@suse.de>
 *     - Handle EOF return value from sscanf()
 *     - Handle empty names gracefully (for zfcp, from Bernd Kaindl)
 *   * 2003-03-07: Kurt Garloff <garloff@suse.de>
 *     - Fix symlinks to partitions (patch from Suresh Grandhi 
 *	 <Sureshg@ami.com>)
 *   * 2003-06-29: Kurt Garloff <garloff@suse.de>
 *     - Fix fd leak (/proc/partitions)
 *   -> 2.29
 *
 *   * 2003-07-25: Kurt Garloff <garloff@suse.de>
 *     - Documentation: -pX and n automatically created for aliases
 *       (Thx to Russel Shaw for suggesting it.)
 *
 *   * 2003-03-03: Evan Felix <evan.felix@pnl.gov>:
 *     - Detect HP HSV controllers and grab OS Unit ID.
 *     - Add Alias support for HSV OS Unit ID.
 *     - Changed so we search for a matching HCTL pair 
 *	 so we skip 'ghost' scsi disks which are common with 
 *	 and HSV failover pair
 *
 *   * 2003-08-07: Kurt Garloff <garloff@suse.de>:
 *     - Optionally support 'scd' instead of 'sr' as old name for
 *	 CD-ROM devices. Option -o. Relevant in symlink mode.
 *     - Add safe_strcmp() to avoid crashing in null pointers in
 *	 name (model, ...) comparisons. Thanks to James Budworth
 *	 for reporting the error.
 *
 *   * 2003-08-08: Kurt Garloff <garloff@suse.de>:
 *     - Reorder list of modules in trigger_module_loads ():
 *       In 2.6, we don't attach sg in case another driver can
 *       be attached. Thus load sg as last module.
 *     - Fix -o option
 *     - Use sysfs to gather some information (short hostname,
 *	 attached HL device -- unfortunately only block devs
 *	 currently)
 *     - Fix HSV OS ID gathering: Set to -1 if no HSV.
 *     - Handle empty model name in get_hsv_os_id().
 *   -> 2.30
 *
 *   * 2003-08-13: Kurt Garloff <garloff@suse.de>:
 *     - Brian Keefer pointed out that the symlink mode still does not
 *       work for partitions. I somehow forgot to really commit the
 *       fix from 2003-03-07.
 *   -> 2.31
 *
 *   * 2004-02-09: Kurt Garloff <garloff@suse.de>:
 *     - /sys/class/scsi_host/hostX/device/name is gone
 *       use /sys/call/scsi_host/hostX/name and/or proc_name instead.
 *     - Correctly extract dev maj:min as decimal values from sysfs
 *     - sg devices can now be found in sysfs, handle
 *   -> 2.32
 *     
 *   * 2004-02-10: Kurt Garloff <garloff@suse.de>:
 *     - Hannes Reineke found a bug that could result in creating devices
 *       with the wrong type (block vs. char).
 *     - Another patch from Hannes adding support for ASCII T10 data in
 *       page EVPD INQUIRY page 0x83.
 *     - dumppage() was using the wrong field to determine the length.
 *     - check association in page 0x83 to be for the device (Pat Mansfield)
 *     
 *   * 2004-02-16: Kurt Garloff <garloff@suse.de>:
 *     - Fix quiet option (Ulli Horlacher + /me)
 *     - Allow alternative location of scsi.alias file (-A, Ulli Horlacher)
 *     - Fix ASCII T10 data retrieval from EVPD INQ 0x83.
 *     - Fix assumption about minor being only 8bit.
 *     - Increase max length of hostname from 64 to 160. (Wolfgang Celeda)
 *   -> 2.33     
 *
 *   * 2004-03-22: Kurt Garloff <garloff@suse.de>:
 *     - Allow to switch off sysfs for debugging (-y)
 *   * 2004-03-31: Kurt Garloff <garloff@suse.de>: 
 *     - Make sure /dev/scsi/testdev is removed always.
 *     - Don't overwrite scsi device type when getting serial no. etc. in 
 *       fill_in_proc()
 *   -> 2.34.
 *
 *   * 2004-05-24: Chris Townsend <Chris_Townsend@dra-hq.com>
 *     - Fix bug with channel specified in scsi.alias
 *   * 2004-06-09: Kurt Garloff <garloff@suse.de>
 *     - Handle longer partition names
 *   -> 2.35.
 *
 *   * 2005-05-14: Kurt Garloff <garloff@suse.de>
 *     - For 2.4, search for more devices when finding matching sd dev.
 *   * 2005-08-16: Kurt Garloff <garloff@suse.de>
 *     - The 2.6 kernel now reports the 'RAID' type.
 *     - Cleanup sysfs parsing.
 *     - 2.6 tape support. (Thanks to David Chen <david@global.com>!)
 *     - SG_IO support.
 *     - Improve ID parsing (page 0x83), support EUI64 and NAA (mostly)
 *   -> 2.36
 *
 */
