or a partition is larger than the slice.
Now `disklabel -Brw sdX auto' should fail properly on sliced disks
without partition of type 165, e.g., on zip disks with the factory
default formatting. Previously it set a bogus in-core label for
the compatibility slice and used this to corrupt the MBR (the slice
has offset 0 and size 0, but setting the label in effect corrupted
its size to nonzero).
`disklabel -Brw sdX auto' already failed properly on normally (not
dangerously dedicated) sliced disks _with_ partition of type 165,
because the compatibility slice has a nonzero offset so the MBR
remained inaccessible when the size was corrupted.
This bug only affected in-core labels. On-disk labels are checked
carefully when they read and written.
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.
The system boots and can mount UFS filesystems.
Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
Mount_std mounts will not work until the getfsent
library routine is changed.
Reviewed by: various people
Submitted by: Jeffery Hsu <hsu@freebsd.org>
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.
the sd & od drivers. There is also slight changes to fdisk & newfs
in order to comply with different sectorsizes.
Currently sectors of size 512, 1024 & 2048 are supported, the only
restriction beeing in fdisk, which hunts for the sectorsize of
the device.
This is based on patches to od.c and the other system files by
John Gumb & Barry Scott, minor changes and the sd.c patches by
me.
There also exist some patches for the msdos filesys code, but I
havn't been able to test those (yet).
John Gumb (john@talisker.demon.co.uk)
Barry Scott (barry@scottb.demon.co.uk)
If DEVFS is configured, create devfs devices for previously invisible
partitions on the slices.
Fixed an old aliasing bug which caused E=17 errors from DEVFS for
DIOCSDINFO when there were no real slices.
It is needed for implementation details but very little of it is
needed for the interface. Include it in the few places that didn't
already include it.
Include <sys/ioccom.h> in <sys/disklabel.h> (as already in
<sys/diskslice.h>) so that all the disk-related headers are almost
self-sufficient.
block number.. (assuming Debugger() returned). The disk drivers assume
that dscheck() sets both error markers (bp->b_error and set B_ERROR in
bp->b_flags) if it fails.
disklabel(8) to the kernel (dsopen()). Drivers should initialize the
hardware values (rpm, interleave, skews). Drivers currently don't do
this, but it usually doesn't matter since rotational position stuff is
normally disabled.
compatibility slice. They were forgotten on last-close and then
creating them on first-open failed.
Devfs entries for slices other than the one containing the root file
system are still invisible unless you open a non-devfs inode on the
slice.
Added scsi control devices.
Converted almost everything that I changed to use devfs_add_devswf()
and verbose id macros.
st.c:
Renamed enrst* to erst* since that's what the current name is (enrst
seems to be an old name).
First attempt at creating devfs entries for sliced devices. Doesn't
quite work yet, so the heart of it is disabled.
Added bdev and cdev args to dsopen().
Create devfs entries in dsopen() and (unsuccessfully) attempt to make
them go away at the right times. DEVFS is #undefed at the start so
that this shouldn't cause problems.
device.
v_numoutput wasn't incremented to match the b_iodone nesting. It's still
fishy that vwakeup() clears B_WRITEINPROG before biodone() has finished;
however, B_WRITEINPROG seems to be never used.
Submitted by: Bruce Evans
Reopen the bdev for the raw partition and not the cdev if only the bdev
was open.
Don't use a bogus limit for the number of partitions to possibly reopen
(bug found by Julian).
Add function dssize() to help fix wdsize() and sdsize(). The slice
layer knows more about (un)open partitions and partition sizes than
the driver layer.
Don't print debugging messages by default.
Initialize the compatibility slice here and not in the machine-dependent
code.
Fix initialization of the label for the whole disk slice.
Make it clear that write protection of labels doesn't apply when there is
no label.
Fix the sign of the adjustment after writing a label.
Writing of labels should work now.
Merge adjust_label() into fixlabel(). Detect more errors and don't
write if there is an error. Adjust sectors/unit and total sectors
to the numbers on the slice.
Add a function dsname() to print slice device names consistently, and
use it.
the same as when initializing the in-core copies. Adjust checksums in
labels after adjusting labels. This finishes fudging the on-disk label to
make it coherent with the in-core label.
Handle EIO during initialization better.
Initialize the compatibility slice to the whole disk If there are no real
slices.
Don't warn about adjusting offsets in the label to make the 'c' partition
start at 0. The 'c' offset is now always absolute on-disk and 0 in-core
so an adjustment is usually required.
Don't confuse LABEL_PART with RAW_PART so much.
Check for partitions being within slices differently.
requires complications to adjust the offsets to relative when a block
containing the label is read and back to absolute when such a block is
written. The adjustment is not made on the whole disk slice.
Don't allow setting the offset of partition C to nonzero in in-core labels.
This will cause some (nonstandard) disktab entries to fail. They will
need to be changed to have relative offsets (and no partitions outside
of the slice).
Don't write protect the (nonexistent) label on the whole disk slice.
Writing labels and bootstraps should work right now (except if there is
no DOSpartition table).
Slice 0 is now for the first BSD slice. The first BSD slice is
the first DOSpartition with id 0xa5 or the whole disk if their
are no DOSpartitions (except the latter is not yet implemented).
Existing partitions on it work the same as in 2.0 except the
'd' partition is no longer special and partitions are relative
to the skice.
Slice 1 is now for the whole disk and gets a read-only label
describing the disk. Previously, slice 0 was for the whole disk
and there was no label on it.
Slices 2-31 are for DOSpartitions. Slice 0 is an alias for one
of these if there is a BSD slice. Previously, slices 1-31 were
for DOSpartitions.
diskslice_machdep.c:
Expand whole disk slice to include all DOSpartitions. More work
is required for >1024 cylinders and to rewrite the label iff the
driver is unsure about the geometry.
subr_diskslice.c:
New function dsisopen() to help handle media changes.