[comp.os.minix] patches to ST-1.5.10.3

klamer@mi.eltn.utwente.nl (Klamer Schutte -- Universiteit Twente) (02/21/91)

Here are two patches to minix ST 1.5.10 #3.
Both are kernel patches. I don't think it is the first time they are posted;
i haven't had net access for over 1 year now.
but since i find them usefull perhaps somebody other does also.

patch one:
Make the floppy driver in general-format mode (minor device number >=16)
recognize double-sided floppies as well. The bug was that the number of
tracks was derived by: sectors/nr_sect, where sectors/(nr_sect*nr_side)
is the correct formula

patch two:
in stdmp the first user proces was given as /bin/sh.
This almost always was OK with only one terminal; but with several
terminal it can be wrong.
Now a - is displayed when it is a login shell, just as every login shell.
But when it is not, you get the proper name (as /usr/bin/login f.i.)

Klamer (.signature at end)
---- cut here ---

echo x - stdmp.c_c
sed '/^X/s///' > stdmp.c_c << '/'
X*** 1.5.10.3/stdmp.c	Mon Feb 18 23:36:15 1991
X--- stdmp.c	Mon Feb 18 23:38:49 1991
X***************
X*** 64,73 ****
X--- 64,77 ----
X  		nbuff[NSIZE] = 0;
X  		for (np = &nbuff[0]; np < &nbuff[NSIZE]; np++)
X  			if (*np <= ' ' || *np >= 0177) *np = 0;
X+ #ifdef notdef
X  		if (index == LOW_USER + 1)
X  			cp = "/bin/sh";
X  		else
X  			cp = nbuff;
X+ #else
X+ 		cp = nbuff;
X+ #endif
X  		for(i=0;i<100;i++) 
X  			if(cp[i] == '\0')
X  				break;
/
echo x - stfloppy.c_c
sed '/^X/s///' > stfloppy.c_c << '/'
X*** 1.5.10.3/stfloppy.c	Mon Feb 18 23:36:14 1991
X--- stfloppy.c	Mon Feb 18 23:37:29 1991
X***************
X*** 538,552 ****
X    if (ret != SECTOR_SIZE)
X    	return(ret);
X    nr_sec[d] = sh88tosh68(block0.b0_spt);
X!   nr_cyl[d] = sh88tosh68(block0.b0_nsects) / nr_sec[d];
X!   nr_hds[d] = sh88tosh68(block0.b0_nsides);
X    /* safety first: check for plausible values */
X    /* assume that #sectors is between 8 (old dos) and 18 (hd diskettes) */
X    if ((nr_sec[d] < 8) || (nr_sec[d] > 18)) return(EINVAL);
X!   /* assume that #cylinders is either 40 (5 1/4" dos) or between 78 and 85 */
X!   if ((nr_cyl[d] != 40) && (nr_cyl[d] < 78) || (nr_cyl[d] > 85)) return(EINVAL);
X!   /* definitely must have either one or two heads */
X!   if ((nr_hds[d] != 1) && (nr_hds[d] != 2)) return(EINVAL);
X    return(0);
X  }
X  #endif
X--- 538,552 ----
X    if (ret != SECTOR_SIZE)
X    	return(ret);
X    nr_sec[d] = sh88tosh68(block0.b0_spt);
X!   nr_hds[d] = sh88tosh68(block0.b0_nsides);
X!   nr_cyl[d] = sh88tosh68(block0.b0_nsects) / (nr_sec[d]*nr_hds[d]);
X    /* safety first: check for plausible values */
X    /* assume that #sectors is between 8 (old dos) and 18 (hd diskettes) */
X    if ((nr_sec[d] < 8) || (nr_sec[d] > 18)) return(EINVAL);
X!   /* definitely must have either one or two heads */
X!   if ((nr_hds[d] != 1) && (nr_hds[d] != 2)) return(EINVAL);
X!   /* assume that #cylinders is either 40 (5 1/4" dos) or between 78 and 85 */
X!   if ((nr_cyl[d] != 40) && (nr_cyl[d] < 78) || (nr_cyl[d] > 85)) return(EINVAL);
X    return(0);
X  }
X  #endif
/
exit 0
-- 
Klamer Schutte
Faculty of electrical engineering -- University of Twente, The Netherlands
klamer@mi.eltn.utwente.nl	{backbone}!mcsun!mi.eltn.utwente.nl!klamer

klamer@mi.eltn.utwente.nl (Klamer Schutte -- Universiteit Twente) (02/21/91)

For all people who ever use /dev/fd0 (== general format floppy) on the
atariST: both minix 1.5.10 #3 and my recent posted patch contain a bug
which can cause a kernel panic. The problem is that to calculate the nr
of cylinders there is made a division before is tested whether the
divisor is zero...

patch will follow; when recognising my interrupt level was too high ;-)

Klamer
-- 
Klamer Schutte
Faculty of electrical engineering -- University of Twente, The Netherlands
klamer@mi.eltn.utwente.nl	{backbone}!mcsun!mi.eltn.utwente.nl!klamer