Continue untangling the disklabel.
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 19 May 2007 00:52:02 +0000 (00:52 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 19 May 2007 00:52:02 +0000 (00:52 +0000)
commit5350e1e9f12d796a3946a255ff1cc18649b6a26e
treedf7c8369d88d5f9a5ce331eb1a2b3c429c1b62c6
parent9ee3c9a7384181f98c73351321615e060cae903a
Continue untangling the disklabel.

* Move dk*() inline functions and other related stuff not directly related
  to the BSD disklabel out of sys/disklabel.h and into sys/diskslice.h.
  Add additional functions to sys/diskslice.h

* Extend the slice and partition fields in the device minor number.  We
  now support up to 128 slices and up to 256 partitions.

* Implement new minor device numbers for 'raw slices', such as ad0s1.
  Previously raw slices used the same minor number as partition c within
  the slice.  e.g. ad0s1 and ad0s1c had the same device number.
  This made it impossible to distinguish between the two.

  The 'whole disk' device's minor number has also changed.  Our new whole-slice
  and whole-disk devices specify a partition number of (DKMAXPARTITIONS - 1)
  (aka 255).

* Completely disable disklabel related operations on the raw disk, e.g.
  da0, and on partitions, e.g. da0s1a.  Only allow disklabel
  operations on whole slices, e.g. da0s1.

  NOTE!! For compatibility while booting drivers which set DSO_COMPATLABEL,
  the compat disklabel may be read, but not written, via the whole-disk
  device.  e.g. acd0.

  NOTE!! For compatibility we have no choice but to continue to snoop
  read/write operations on raw slices (e.g. da0s1) because the
  disklabel program and the kernel still depend on the snooping to modify
  the in-core version of the disklabel to the on-disk version.

  No snooping will occur on the whole-disk device (e.g. da0).

  No snooping will occur on raw slices (e.g. da0s1) if the disk is
  unlabeled and no in-core label was set.  Note that disklabel -r -w
  DOES set an in-core label before writing to a raw-slice, so it is still
  ok.

* dsopen() no longer attempts to scan the MBR or slice table when the
  whole-disk device (e.g. da0) is opened, and no longer attempts to read
  the disklabel when the whole-slice device is opened (e.g. da0s1).  The
  disklabel is only read when a partition is explicitly opened or the
  label is explicitly read via an ioctl.

* The virgin disklabel is stored in the struct diskslice for
  WHOLE_DISK_SLICE (slice 1).
12 files changed:
etc/MAKEDEV
lib/libc/gen/disklabel.c
sbin/disklabel/disklabel.c
sys/dev/disk/ata/atapi-tape.c
sys/dev/disk/fd/fd.c
sys/kern/subr_disk.c
sys/kern/subr_diskslice.c
sys/kern/vfs_conf.c
sys/sys/disk.h
sys/sys/disklabel.h
sys/sys/disklabel32.h
sys/sys/diskslice.h