Actually, that is probably better anyway.

Red Hat which has /dev/sgX where X is a letter instead of a number also has /dev/sgN 
where N is a number.  It
only goes up to 7 (h) though.

With your "fix" you can only get up to 10 (0-9), maybe it would be more appropriate to 
just use %d (I believe
devnum is an int as I coded it).  Then you would see: /dev/sg8, /dev/sg9, /dev/sg10, 
/dev/sg11, ..., /dev/sg99,
/dev/sg100 and so on.

And yes, this style naming for devices is definitely a Linuxism, most real systems 
seem to use names based on
which ha,chan,dev,lun they are.  Of course to do that you really need a device FS 
(because you quickly run out
of numbers).  So maybe sometime after 2.4.0 comes out with device FS, I might think 
about starting a project to
implement CAM (FreeBSD uses it, and it seems to be the way to go with SCSI).  That is 
a ways away though, so
for now we are stuck with parsing /proc/scsi/scsi, and /dev/sg??? numbers that change 
on every bootup.

-Dave

Uwe Bonnes wrote:

> Hallo,
>
> dlls/winaspi/aspi.c in SCSI_GetProcinfo has hard coded device pathes.
> It uses /dev/sg[a-z].
>
> While this is probably totally linux centric and needs further work
> for other platforms, it even is often wrong with linux, as
> ../linux/Documentation/devices.txt tells:
>
> ====Begin====
>  21 char        Generic SCSI access
>                   0 = /dev/sg0          First generic SCSI device
>                   1 = /dev/sg1          Second generic SCSI device
>                     ...
>
>                 Most distributions name these /dev/sga, /dev/sgb...;
>                 this sets an unnecessary limit of 26 SCSI devices in
>                 the system and is counter to standard Linux
>                 device-naming practice.
> ====End=======
>
> as my system uses /dev/sg[0...], I had to aspi.c like below.
>
> Bye
>
> Uwe Bonnes                [EMAIL PROTECTED]
>
> Free Software: If you contribute nothing, expect nothing
> --
> gauss:~/tmp/wine/compile> cvs diff -u wine/dlls/winaspi/aspi.c
> Index: wine/dlls/winaspi/aspi.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/winaspi/aspi.c,v
> retrieving revision 1.3
> diff -u -r1.3 aspi.c
> --- wine/dlls/winaspi/aspi.c    2000/03/19 12:42:31     1.3
> +++ wine/dlls/winaspi/aspi.c    2000/03/25 18:14:32
> @@ -320,7 +320,7 @@
>                 /* Add to registry */
>
>                 sprintf(idstr, "h%02dc%02dt%02dd%02d", dev.host, dev.channel, 
>dev.target, dev.lun);
> -               sprintf(devstr, "/dev/sg%c", 'a'+devnum);
> +               sprintf(devstr, "/dev/sg%c", '0'+devnum);
>                 if( RegSetValueExA(hkeyScsi, idstr, 0, REG_SZ, devstr, 
>strlen(devstr)+1 ) != ERROR_SUCCESS )
>                 {
>                         ERR("Could not set value 
>HEKY_DYN_DATA\\%s\\%s\n",KEYNAME_SCSI, idstr);

Reply via email to