Subject: port-amiga/2559: ADOSFS vs. pre V40 partitions with blocksize > 512 bytes
To: None <gnats-bugs@NetBSD.ORG>
From: Matthias Scheler <tron@sandra.owl.de>
List: netbsd-bugs
Date: 06/20/1996 00:57:40
>Number:         2559
>Category:       port-amiga
>Synopsis:       ADOSFS vs. pre V40 partitions with blocksize > 512 bytes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jun 19 19:20:03 1996
>Last-Modified:
>Originator:     Matthias Scheler
>Organization:
Matthias Scheler
tron@sandra.owl.de
>Release:        1.2_ALPHA
>Environment:
NetBSD lyssa 1.2_ALPHA NetBSD 1.2_ALPHA (LYSSA) #4: Thu Jun 20 00:37:12 MET DST 1996     tron@lyssa:/usr/src/sys/arch/amiga/compile/LYSSA amiga


>Description:
Before AmigaOS 3.1 was released neither HDToolBox nor FFS supported increasing
SecsPerBlock to create AmigaOS partitions with blocksize > 512 bytes. So some
people increased SectorSize to get such partitions, a method e.g. used by
MicroBotics RDPrep. Actually NetBSD's RDB code doesn't care for SectorSize
so that such partitions won't be recognized properly. The included patch
fixes this problem.

There's still one problem concerning this topic which must be solved. To get
such partitions to work you have to adapt either LowCycl and HighCycl,
Heads or Blocks per Track, e.g.:

512 bytes per block:

LowCyl:			239
HighCyl:		848
Heads:			16
Blocks per Track:	63

2048 bytes per block:

LowCyl:			239
HighCyl:		848
Heads:			4
Blocks per Track:	63

Because of this NetBSD print a error message like this on every access to
the Rigid Disk Block:

Partition 'DH1' geometry 4/63 differs from RDB 16/63

There are three posiblities:
a) Don't change anything. But those messages will probably confuse users.
b) Completely remove this message. That's IMHO no good choice either.
c) Modify the check to compare Heads*BlocksPerTrack*SectorSize.

If you think c) is the best choice tell me and I will supply a patch.

>How-To-Repeat:
Create a partition with RDPrep and try to mount it.

>Fix:
*** src/sys/arch/amiga/amiga/disksubr.c.orig	Thu May  2 13:37:10 1996
--- src/sys/arch/amiga/amiga/disksubr.c	Thu Jun 20 00:35:32 1996
*************** readdisklabel(dev, strat, lp, clp)
*** 359,377 ****
  		}
  
  		pp->p_size = (pbp->e.highcyl - pbp->e.lowcyl + 1)
! 		    * pbp->e.secpertrk * pbp->e.numheads;
  		pp->p_offset = pbp->e.lowcyl * pbp->e.secpertrk
! 		    * pbp->e.numheads;
  		pp->p_fstype = adt.fstype;
  		if (adt.archtype == ADT_AMIGADOS) {
  			/*
  			 * Save reserved blocks at begin in cpg and
  			 *  adjust size by reserved blocks at end
  			 */
! 			pp->p_fsize = 512;
! 			pp->p_frag = pbp->e.secperblk;
! 			pp->p_cpg = pbp->e.resvblocks;
! 			pp->p_size -= pbp->e.prefac;
  		} else if (pbp->e.tabsize > 22 && ISFSARCH_NETBSD(adt)) {
  			pp->p_fsize = pbp->e.fsize;
  			pp->p_frag = pbp->e.frag;
--- 359,393 ----
  		}
  
  		pp->p_size = (pbp->e.highcyl - pbp->e.lowcyl + 1)
! 		    * pbp->e.secpertrk * pbp->e.numheads
! 		    * (pbp->e.sizeblock >> 7);
  		pp->p_offset = pbp->e.lowcyl * pbp->e.secpertrk
! 		    * pbp->e.numheads
! 		    * (pbp->e.sizeblock >> 7);
  		pp->p_fstype = adt.fstype;
  		if (adt.archtype == ADT_AMIGADOS) {
  			/*
  			 * Save reserved blocks at begin in cpg and
  			 *  adjust size by reserved blocks at end
  			 */
! 			int bsize,secperblk;
! 
! 			bsize = pbp->e.sizeblock << 2;
! 			secperblk = pbp->e.secperblk;
! 			while (bsize > 512) {
! 				bsize >>= 1;
! 				secperblk <<= 1;
! 			}
! 			if (bsize == 512) {
! 				pp->p_fsize = bsize;
! 				pp->p_frag = secperblk;
! 				pp->p_cpg = pbp->e.resvblocks;
! 				pp->p_size -= pbp->e.prefac
! 					      * (pbp->e.sizeblock >> 7);
! 			} else {
! 				adt.archtype = ADT_UNKNOWN;
! 				adt.fstype = FS_UNUSED;
! 			}
  		} else if (pbp->e.tabsize > 22 && ISFSARCH_NETBSD(adt)) {
  			pp->p_fsize = pbp->e.fsize;
  			pp->p_frag = pbp->e.frag;

>Audit-Trail:
>Unformatted: