Commit Graph

229 Commits

Author SHA1 Message Date
christos c89e18bcd0 Fix remaining issues:
- use getulong everywhere for proper range checking
	- fix error checking in getulong
2004-03-14 00:39:53 +00:00
dsl f1c67110ff Fix breakage of last commit (disklabel -R just plain didn't work!)
Convert two large nasty #defines into much smaller (still nasty) #defines
that call proper functions.
Fixes PR 24765
2004-03-13 22:04:37 +00:00
itojun 6c57d297ac use strtoul() instead of atoi(). have proper range check for each fields. 2004-02-29 21:31:14 +00:00
dsl 7d06c8be4a Print everything unsigned - helps a bit for disks with [2^31..2^32) sectors. 2004-02-28 18:19:00 +00:00
lukem 1fa0b4f2cc * Enable SAVEBOOTAREA on i386 and amd64 (by merging the Makefile
controls with the section for the other MBR-using platforms that
  already enable this)
* Don't prompt the user to "erase the previous contents of the disk"
  when there's no NetBSD MBR partition; SAVEBOOTAREA is sufficient.

These fixes mean that you can create a disklabel (on an i386/amd64) on a disk
that doesn't have a NetBSD MBR partition without trashing the existing MBR.
The previous behaviour was extremely annoying when working with media such
as FAT-formatted CF cards, and didn't really protect people with such from
accidentally trashing part of sector 1 of such disks, and made it extremely
easy to trash sectors 0..15 of those disks instead.
2004-01-18 22:34:22 +00:00
dsl b2cf925344 Use correct sector number when the netbsd partition is in the extended
partition chain (and not the first extended partition).
2004-01-18 16:25:59 +00:00
jmmv b635f565e7 Homogenize usage messages: make the 'usage' word all lowercase, as this seems
to be the most common practice in our tree.
2004-01-05 23:23:32 +00:00
jdc 3dcb42ad4b Add missing ' in prompt text.
Pointed out by Allen Briggs.
2003-12-29 21:21:25 +00:00
jdc dbc3f17967 If a partition is adjusted so that it falls off the end of the disk, display
a '+' character (aka the '*').

OK'ed by Christos.
2003-12-29 19:13:19 +00:00
jdc 256b6fecd8 Add the ability to define a partition as starting after another partition.
If chaining is on, display all changed partitions (not just this one).

OK'ed by Christos.
2003-12-29 19:12:29 +00:00
dyoung f28870d8ac fix spelling, s/extented/extended/ 2003-12-11 05:11:50 +00:00
bouyer 6fb817f5dd Commit changes proposed on tech-kern Thu, 6 Nov 2003
- factor out disksubr.c between sun3, sparc and sparc64. Keep the sun3
  groveling code to find a NetBSD disklabel in the first sector (so that it
  can find a label at the old sun3 LABELOFFSET) as a fallback is not
  label at LABELOFFSET, or sun label is present.
- Fix the sun3 LABELOFFSET (was 64, but the kernel wrote the NetBSD label at
  128)
- Make next68k disksubr.c always write a next-compatible disklabel.
- remove #ifdef __sparc__ hack from disklabel(8), and change it to issue
  a DIOCWDINFO after writing the disklabel to the raw partition in the
  -r/-I case (so that the kernel can convert the label if needed).
2003-11-15 17:52:30 +00:00
fvdl fe6b4c315f Bring back disklabel -B for now, since hp300 installboot isn't ready
for prime time yet.
2003-11-10 09:22:09 +00:00
dsl 6db70be120 Rip out all the '-B bootblock' support, everything should use installboot(8).
(can only affect arm32, hp300 and vax ports, and doesn't affect sysinst).
2003-11-08 09:25:01 +00:00
shin 2c415ee56d playstation2 needs MBR support in disklabel(8). 2003-11-02 02:52:58 +00:00
pooka bb95bd5936 Handle partition offset and size as unsigned entities. 2003-10-20 13:20:20 +00:00
pooka 84a1b52c43 Partition size and offset inside the disklabel are unsigned. Print
them as unsigned so that we don't print negative values when we're
halfway through.
2003-10-20 13:10:48 +00:00
lukem 1c33b4e6a4 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!).
2003-10-08 04:25:43 +00:00
agc bf07c8719a Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22308, verified by myself.
2003-08-07 10:04:11 +00:00
dsl 42c39f4f19 Make output fit into 80 columns when a partition doesn't end on a cylinder
boundary.
2003-08-04 17:14:50 +00:00
dsl 2ceab48459 Read correct sector when following extended partition chain.
Require extended partition chain to be through increasing sector numbers
in order to abort loops.
2003-08-04 16:51:56 +00:00
lukem a21d1e7a14 xref dkctl(8) 2003-07-13 09:55:34 +00:00
itojun 09c1e9bc45 use bounded copy (a few unbounded copy remains - need work) 2003-07-13 07:48:01 +00:00
dsl 7db2cff2fd Allow for the netbsd partition being in the extended partition list. 2003-07-07 13:05:46 +00:00
simonb 775170c02f Line up the cylinder numbers in the printlabel output a bit better. 2003-07-01 05:40:54 +00:00
wiz b6bcb58a8b Bump date for last. 2003-05-06 08:23:57 +00:00
gmcgarry 534f9a7a52 Document -I option. From Richard Rauch <rauch@math.rice.edu>
in PR#11890.
2003-05-02 08:09:35 +00:00
fvdl 043f21d9ea x86_64 -> amd64 2003-04-26 19:14:17 +00:00
wiz 472351e13d Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
2003-04-16 13:34:34 +00:00
fvdl 42614ed3f3 Add support for UFS2. UFS2 is an enhanced FFS, adding support for
64 bit block pointers, extended attribute storage, and a few
other things.

This commit does not yet include the code to manipulate the extended
storage (for e.g. ACLs), this will be done later.

Originally written by Kirk McKusick and Network Associates Laboratories for
FreeBSD.
2003-04-02 10:39:19 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
kleink b3df6303a9 Rename `sigset' locals to avoid symbol shadowing warning. 2003-01-16 09:38:37 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
scw 1c4717cddb Use getlabel{sector,offset}() instead of LABEL{SECTOR,OFFSET}. 2002-12-12 11:34:46 +00:00
fvdl 53d30b7a60 Handle MBRs for x86_64. 2002-12-11 14:28:46 +00:00
jonb 8a96157b87 While cleaning up other places that invoked $EDITOR, noticed that
this one had all the infrastructure of fork/exec/wait, like the
others, but called system instead of exec creating an extra PID
and associated memory usage during the edit.
2002-12-05 22:59:25 +00:00
rtr d64b3c2b83 Fix bug causing segmentation fault when no fs type specified 2002-11-18 05:48:00 +00:00
rtr 1031fab56c Removed "disklabel -I [-r] [-C] disk" from SYNOPSIS.
The code does not permit usage of the -I flag without either -e or -i.
2002-10-21 15:54:51 +00:00
wiz 74347b5249 partition, not parition (by Adrian Mrva). file system instead of filesystem. 2002-10-02 11:05:56 +00:00
dbj a323eac318 add FS_APPLEUFS
part of PR #17345
2002-09-28 00:47:24 +00:00
dbj 209f5f57af tweak indentation on FS_JFS2 comment 2002-09-28 00:40:08 +00:00
dbj 7d4caebaf6 add DTYPE_JFS2 and FS_JFS2 for IBM Journaled File System
this is to match FreeBSD's disklabel.h revision 1.73
FreeBSD change was requested by Hiten Pandya <hiten@uk.FreeBSD.org>
2002-09-28 00:30:24 +00:00
wiz bd9e498edd mdoc nits. New sentence, new line. Remove a comment about tahoe. 2002-09-28 00:24:13 +00:00
dbj b64db12921 fix DTYPE_LD comment 2002-09-28 00:10:56 +00:00
dbj ba3c70eb8b add DTYPE_LD to match disklabel.h 2002-09-28 00:09:58 +00:00
enami 43fe370014 Fix an argument to -width option of .Bl macro. 2002-08-19 01:54:58 +00:00
manu 3966af389b Enable USE_MBR for all arm ports. 2002-07-28 15:17:38 +00:00
grant 97a9e02381 disallow creation of partitions which start beyond (or extend beyond)
the end of the disk.
2002-06-29 15:24:03 +00:00
itojun a532d33818 USE_MBR on macppc too 2002-06-18 00:21:53 +00:00
itojun cd668e919e need disklabel_mbr.h for USE_MBR build 2002-06-18 00:19:27 +00:00