Home | History | Annotate | Download | only in mbrlabel
History log of /src/sbin/mbrlabel/mbrlabel.c
RevisionDateAuthorComments
 1.29  30-Mar-2018  mlelstv Handle sector sizes != 512, check partition overlaps, improve guessing
of filesystem parameters.
 1.28  14-Jul-2012  wiz branches: 1.28.30;
From Bug Hunting:
Sync usage with man page.
 1.27  27-Aug-2011  joerg branches: 1.27.2;
Be more static.
 1.26  28-Dec-2005  christos fix compilation on LP64 machines.
 1.25  27-Dec-2005  jmmv Add an option (-s) to specify which sector to read to parse the partition
table. Useful if the disk has remapping drivers installed into it (such as
Ontrack Disk Manager).

Added as an option instead of automatic behavior to let the user scan any
of the two partition tables at will.
 1.24  05-Jan-2004  jmmv Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
 1.23  08-Oct-2003  lukem Overhaul MBR handling (part 1):

<sys/bootblock.h>:
* Added definitions for the Master Boot Record (MBR) used by
a variety of systems (primarily i386), including the format
of the BIOS Parameter Block (BPB).
This information was cribbed from a variety of sources
including <sys/disklabel_mbr.h> which this is a superset of.

As part of this, some data structure elements and #defines
were renamed to be more "namespace friendly" and consistent
with other bootblocks and MBR documentation.
Update all uses of the old names to the new names.

<sys/disklabel_mbr.h>:
* Deprecated in favor of <sys/bootblock.h> (the latter is more
"host tool" friendly).

amd64 & i386:
* Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to
be consistent with the naming convention of the msdosfs tools.

* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1
and it's confusing to have two functionally equivalent bootblocks,
especially given that "ufs" has multiple meanings (it could be
a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).

* Rework pbr.S (the first sector of bootxx_*):
+ Ensure that BPB (bytes 11..89) and the partition table
(bytes 446..509) do not contain code.
+ Add support for booting from FAT partitions if BOOT_FROM_FAT
is defined. (Only set for bootxx_msdos).
+ Remove "dummy" partition 3; if people want to installboot(8)
these to the start of the disk they can use fdisk(8) to
create a real MBR partition table...
+ Compile with TERSE_ERROR so it fits because of the above.
Whilst this is less user friendly, I feel it's important
to have a valid partition table and BPB in the MBR/PBR.

* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent
with other platforms.

* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that
we can boot off FAT partitions.

* Crank version of /usr/mdec/boot to 3.1, and fix some of the other
entries in the version file.

installboot(8) (i386):
* Read the existing MBR of the filesystem and retain the BIOS
Parameter Block (BPB) in bytes 11..89 and the MBR partition
table in bytes 446..509. (Previously installboot(8) would
trash those two sections of the MBR.)

mbrlabel(8):
* Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code
to map the MBR partition type to the NetBSD disklabel type.


Test built "make release" for i386, and new bootblocks verified to work
(even off FAT!).
 1.22  07-Jun-2003  dsl Make writes to the in-core label persist after mbrlabel closes the disk.
 1.21  28-Sep-2002  dbj add MBR_PTYPE_APPLEUFS of 0xa8
part of PR #17345
 1.20  21-May-2002  yamt open device as readonly unless -w is specified.
 1.19  07-Feb-2002  ross minor LP64 nits
 1.18  20-Aug-2001  ad Use getrawpartition().
 1.17  26-Jul-2001  wiz partiton -> partition
 1.16  20-Feb-2001  cgd use getprogname()
 1.15  18-Feb-2001  lukem - remove unused arg to getparts()
- clean up WARNS=2 problems
- implement getshort()
- use getshort() with MBR_MAGICOFF to test if the magic number is OK, rather
than using hard-coded magic numbers
 1.14  04-Feb-2001  christos ifix nested extern.
 1.13  04-Jan-2001  lukem change verbose probe message to display "size xxx (yyy MB), offset zzz".
use %u instead of %d.
 1.12  27-Dec-2000  lukem change behaviour of flags slightly:
-w write in-core label if changed
-r update on-disk as well as in-core label (with -w)
-f force update (-w), even if there's been no change

-r behaviour suggested by matt green. what used to be `-f' is now `-wrf'
 1.11  24-Dec-2000  lukem i got sick of the brain damage that mbrlabel used to do, and had
gotten bitten by mbrlabel trashing my incore disklabel to a point where
the machine wasn't usable, so I reworked it:

* only update the incore (and on-disk) label if `-f' is given. by default,
the proposed disklabel will be printed but no changes will occur
* add -q, to make the default operation a bit more quiet.
* leave existing `used' in-core partition slots alone, and only add entries
to the incore label if:
- there's not an existing partition of the same size and offset
(even of a different type)
- there's a free partition slot (`unused', with size == 0)
* use DIOCWDINFO instead of DIOCSDINFO, to update the incore as well as
the on-disk label
* use showpartitions() from ../disklabel/printlabel.c

this should make mbrlabel a *lot* more useful.
 1.10  24-Dec-2000  wiz Add NTFS recognition per patch supplied by Dave Huang in bin/11804.
 1.9  24-Dec-2000  wiz ANSIfy, de-__P()
 1.8  03-Jul-2000  matt More include fixups and GCC 2.96 nonsense
 1.7  15-Mar-2000  fvdl branches: 1.7.4;
Moved from mbrlabel.c,v
 1.6  23-Sep-1999  ws Correct handling of extended partitions within extended partitions.
Problem found and new program tested by Reinoud.Koornstra@ibbnet.nl.
While here, add support for Linux extended partitions.
 1.5  19-Aug-1999  cgd copy the MBR partition table being examined to a local array, to avoid
unaligned structure accesses on architectures that care.
 1.4  19-Aug-1999  cgd correct usage message
 1.3  27-Jan-1999  thorpej branches: 1.3.2;
Use <sys/disklabel_mbr.h> rather than our own home-grown.
 1.2  03-Dec-1998  fair This seemingly trivial (and computationally pointless) change shuts up
GCC 2.7.2.2 about "loff" being uninitialized on line 142 on m68k.
 1.1  16-Nov-1998  ws Add a utility to allow access to the partitions of a
MBR labeled disk (i.e. a disk partitioned by fdisk)
on any platform (including extended partitions).
 1.3.2.2  26-Sep-1999  cgd pull up rev 1.6 from trunk (requested by ws):
Correct handling of extended partitions within extended partitions, and
add support for Linux extended partitions.
 1.3.2.1  20-Aug-1999  cgd pull up revs 1.4-1.5 from trunk (cgd)
 1.7.4.1  26-Feb-2001  he Pull up revisions 1.8-15 (requested by lukem):
Several fixes and enhancements:
o only update in-core (and on-disk) disklabels if requested
o be saner about adding MBR partitions to free disklabel slots
o NTFS recognition
o various cleanups
 1.27.2.1  30-Oct-2012  yamt sync with head
 1.28.30.1  07-Apr-2018  pgoyette Sync with HEAD. 77 conflicts resolved - all of them $NetBSD$

RSS XML Feed