From owner-freebsd-current Tue Nov 26 14:30:00 1996 Return-Path: owner-current Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA02191 for current-outgoing; Tue, 26 Nov 1996 14:30:00 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id OAA02158 for ; Tue, 26 Nov 1996 14:29:53 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by who.cdrom.com (8.7.5/8.6.11) with SMTP id MAA13393 for ; Tue, 26 Nov 1996 12:52:11 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id NAA25507; Tue, 26 Nov 1996 13:33:31 -0700 From: Terry Lambert Message-Id: <199611262033.NAA25507@phaeton.artisoft.com> Subject: Re: 2.2-ALPHA install failure To: bde@zeta.org.au (Bruce Evans) Date: Tue, 26 Nov 1996 13:33:31 -0700 (MST) Cc: rgrimes@GndRsh.aac.dev.com, terry@lambert.org, current@freefall.freebsd.org, darrylo@sr.hp.com, jkh@time.cdrom.com In-Reply-To: <199611260520.QAA26908@godzilla.zeta.org.au> from "Bruce Evans" at Nov 26, 96 04:20:06 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > >> Or atleast make size == cyl * sec * head (ie 1024*64*255 == 16711680) > >> my reasoning is that any third party fdisk program that sees the current > >> bogus table likes to try and ``fix it'' and usually ends up doing quite > >> the wrong thing : -(. > > > >This is bogus. > > > >Why can't I just ioctl the (unpartitioned) raw disk device and ask it? > > Because the driver doesn't know anything about the BIOS geometry. > For SCSI drives, the ioctl returns the geometry reported by the SCSI > MODE_SENSE command. This has nothing to do with the BIOS geometry, > and can't be the same as the BIOS geometry even by accident for modern > drives with an average of >= 64 sectors/track. > > The driver doesn't know anything about the BIOS geometry because it > doesn't know the correspondence between BIOS drive numbers and FreeBSD > drive numbers. The BIOS numbers depend on the POST order (see many old > postings by Terry :-). Yes, but... If you are going to present fake geometry numbers, they should percoalte up from where the real geometry numbers are coming from. I'm still enamored of the idea of using directory hierarchy to indicate device layering for stacking of partiton schemes: main() { char buf[ 128]; printf( "Device name> "); if( gets( buf) != NULL) { dump_partinfo( buf, 0); } } char *spaces = " "; dump_partinfo( char *devname, int indent) { struct ld_geom geom; /* logical device geometry*/ struct ld_part_desc pdesc; /* partition descriptor*/ struct ld_part_rec prec; /* prec records*/ char *sp; sp = &spaces[ strlen( spaces) - indent]; /* Open device*/ fd = open( devname, O_RDWR, 0); printf( "%sDevice: %s\n", sp, devname); ioctl( fd, LDGETGEOM, &geom); /* get geometry*/ printf( "%s-Type: %s\n", sp, (geom.g_flags & LD_GEO_PHYS) ? "PHYSICAL" : "LOGICAL"); printf( "%s-Mapping: %s\n", sp, (geom.g_flags & LD_GEO_LINEAR) ? "LINEAR" : "NONLINEAR"); printf( "%s-Size: %d blocks\n", sp, geom.g_size); ioctl( fd, LDGETPDESC, &pdesc); /* get descriptor*/ if( pdesc.pd_type[ 0]) { /* * hey! has parititioning */ printf( "%s-Partitioning present, type = %s\n", sp, pdesc.pd_type); for( i = 0; i< MAX; i++) { prec.pr_index = i; ioctl( fd, LDGETPREC, &prec); if( !( prec.pr_flags & LD_PR_VALID)) continue; printf( "%s-Partition #%d\n", sp, i); printf( " %s-Start: %d\n", sp, prec.pr_start); printf( " %s-Length: %d\n", sp, prec.pr_len); dump_partinfo( prec.pr_devname, indent + 2); } } else { printf( "%s-No partitioning (may contain file system)\n", sp); close( fd); } Output: Device name> /dev/disk/d0 Device: /dev/disk/d0 -Type: PHYSICAL -Mapping: LINEAR -Size: 256000 blocks -Partitioning present, type = MSDOS PRIMARY PARTITION TABLE -Partition #0 -Start: 32 -Length: 117000 Device: /dev/disk/d0/p0 -Type: LOGICAL -Mapping: LINEAR -Size: 117000 blocks -Partitioning present, type = BSD DISKLABEL PARTITIONING -Partition #0 -Start: 16 -Length: 60000 Device: /dev/disk/d0/p1/p0 -Type: LOGICAL -Mapping: LINEAR -Size: 60000 blocks -No partitioning (may contain file system) -Partition #1 -Start: 60016 -Length: 30000 Device: /dev/disk/d0/p1/p1 -Type: LOGICAL -Mapping: LINEAR -Size: 30000 blocks -No partitioning (may contain file system) -Partition #2 -Start: 90016 -Length: 26984 Device: /dev/disk/d0/p1/p2 -Type: LOGICAL -Mapping: LINEAR -Size: 26984 blocks -No partitioning (may contain file system) -Partition #1 -Start: 117032 -Length: 138968 Device: /dev/disk/d0/p1 -Type: LOGICAL -Mapping: LINEAR -Size: 138968 blocks -No partitioning (may contain file system) NONLINEAR mapping would indicate that the sector number must go through a translation function to get the "real" sector on the underlying device (ie: ccd, bad144, etc., etc.). LINEAR mapping can be collapsed to a decriptor that coeleses all intervening mappings to the physical device (or the firs NONLINEAR device) in the chain. Regards, Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.