From owner-freebsd-hackers Thu Apr 17 10:25:56 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id KAA22881 for hackers-outgoing; Thu, 17 Apr 1997 10:25:56 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id KAA22871 for ; Thu, 17 Apr 1997 10:25:49 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id DAA06579; Fri, 18 Apr 1997 03:22:08 +1000 Date: Fri, 18 Apr 1997 03:22:08 +1000 From: Bruce Evans Message-Id: <199704171722.DAA06579@godzilla.zeta.org.au> To: freebsd-hackers@freebsd.org, joerg_wunsch@uriah.heep.sax.de, tinguely@plains.nodak.edu Subject: Re: optical drives Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk [This should be discussed in a technical mailing list, not -hackers.] >od_open() calls dsopen() calls dsinit() which calls check_part(). > >eventhough dsinit() has a label with the correct geometery, it is >looking to verify the geometry by checking the DOS partitions, >but optial drives don't have partitions (?) and we get 0 for the value >of the sector per cylinder. check_part() does not check to see if the >secpercyl is zero before doing an integer divide. This zero value >for secpercyl causes the panic. You are probably supposed to write a partition table. Otherwise, garbage may be interpreted as a good partition table with wrong offsets and and data at wrong offsets may be written to. A panic is better. It takes special garbage to produce the divide by zero error: - there must be a boot signature 0x55, 0xaa at the end of the MBR - all of the bits in the places that are interpreted as ending sector numbers must be 0 (this gives max_nsectors == 0 and secpercyl == 0) - some of the bits in the places that are interpreted as starting sector, head or cylinder numbers must be nonzero (otherwise, check_part() is not called). This is unusual when the previous 2 conditions are met, so the panic is unusual. Fix: treat the max_nsectors == 0 case as an error. >The optical drive did not work with the DOS fdisk. I do not know if this >means optical media act like diskettes and do not have DOS partitions or >fdisk is brain dead. A partition is just data. Even vn disks can have partitions in FreeBSD. >Jim Bryant showed that his optical acts like a drive: > >> (ahc0:1:0): "IBM MTA-3230TC2210!B 0" type 0 removable SCSI 2 >> sd1(ahc0:1:0): Direct-Access 217MB (446325 512 byte sectors) >> sd1(ahc0:1:0): with 17934 cyls, 1 heads, and an average 24 sectors/track A very tall drive :-). Bruce