Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 18 Apr 1997 03:22:08 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        freebsd-hackers@freebsd.org, joerg_wunsch@uriah.heep.sax.de, tinguely@plains.nodak.edu
Subject:   Re: optical drives
Message-ID:  <199704171722.DAA06579@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
[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 <jbryant@argus> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199704171722.DAA06579>