Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Feb 1997 18:05:05 -0600
From:      Damon Anton Permezel <dap@damon.com>
To:        freebsd-questions@FreeBSD.ORG
Subject:   2.1.6: FFS on 1K/sector Pinnacle Micro optical
Message-ID:  <330B9531.41C67EA6@damon.com>

next in thread | raw e-mail | index | archive | help
After a moderate amt of hacking on the SCSI subsystem, I
actually have the "od" device more or less recognising the
PinnacleMicro Vertex optical device.

The media I have is hard-formatted to 1K/sector.

Getting past the disklabel issues with some really gross
hacks (ln /dev/od0 /dev/opti0c; ln /dev/rod0 /dev/ropti0c allows
the kluge in newfs to select the "c" partition -- if I use the
"real" /dev/rod0c device I land back in disklabel hell) I was able
to newfs a fs on the device, of about the correct size, which
both fsck and fsdb like.

However, when I mount the thing on /vertex, and "cd /vertex",
I get "EBADF".  "cat /vertex" panics with a "bad type" in the
ufs somewhere (ufs_readdir, I think it was).

A bit of poking about indicates that the user level wtfs() and
friends adjust the "disk block number" which `fsbtodb()' returns
by multiplying it by the sector size (1K in my case), thus turning
everything into the correct byte address.

Sadly, the kernel level routines which take over once the FS is
mounted do not adjust, and `fsbtodb()' is in sectors.  This value is
thus half as big as it should be.  Since fstodb() uses the sblock,
I cannot patch it, either statically or dynamically, or I will be sunc.

The od driver expects the blkno to be in units of DEV_BSIZE, and
divides again by 2, to populate the SCSI cmd to the device, thinking
it is converting into device specific block offsets, when in this case,
it should not have.

Since the od driver cannot distinguish between a correcty filled
buf struct (from newfs, dd, etc) and the kernel UFS routines,
it cannot adjust, and the inode which is read in for the root
inode of the FS contains crap.

At least, that is how it looks to me today.
This is my first in-depth look into FreeBSD, so I make be making
too many incorrect assumptions...

Anyway, it appears to me that there is not really any support for
filesystems on media with anything other than 512 bytes / sector.
(Ignoring the cd, here, which is another kettle of fish).

There is some "tahoe" stuff kicking about, but it seems that the
tahoe approach was to define DEV_BSIZE to be something greater than
512 bytes, and the device sector size handling code in, for example,
/usr/src/sbin/newfs/*.c deals only with the case that
	DEV_BSIZE / sectorsize > 0
otherwise, all those divide by zeros get nasty.

OK, so my question is (are):  who is using the optical stuff, and
in what manner?

Of those who are actually using it, for SCSI devices which identify
themselves as T_DIRECT rather than T_OPTICAL, what changes were made
to get it to work?  (The non-NEW_SCSI_CONFIG approach doesn't permit
type override, which is required)

What is your disklabel story?  I suspect part of my disklabel woes
may have been due to the 1K sector stuff, since there are many places
(fdisk, for example) where there doesn't appear to be a consistent
story w.r.t. different sector sizes.

Are there any plans for support for different sector-size media
in the future?

disclaimer:
Sure, I could have just gone out and bought some 512K media and
been quite happy with the "sd" device support, but I would not have
finally been driven to delve into FreeBSD...

gripe:
"od0" doesn't show up in the /stand/sysinstall menus for labeling and
partitioning.
--
Damon Permezel
dap@damon.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?330B9531.41C67EA6>