summaryrefslogtreecommitdiff
path: root/sbin/disklabel/disklabel.c
AgeCommit message (Collapse)Author
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2009-09-15also ignore boundaries when checking if the disklabel was modified when -eFederico G. Schwindt
is used. discussed and ok krw@
2009-06-04Recycle four ancient fields in the disklabel structure, replacing them withTheo de Raadt
bounds information, ie. the zone of the disk that OpenBSD can use. Have each pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out this area and pass it up to userland. Then, delete all the same disk parsing code from disklabel(8) since the kernel passes it up. Lots and lots of - signs in the disklabel(8) code. Tested on as many platforms as possible, the fallout will be repaired as time goes on. To test, use disklabel -d <drive> and validate that the bounds do not overlap any boot blocks. This same information is used by disklabel -A... OK for the concept from krw, miod, and drahn
2009-06-02Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.Kenneth R Westerback
Both cause partition sizes to be displayed using a human readable format with the units automatically chosen by looking at the smallest partition in the disk label. Remove forceable humanization in 'A' code and use '-h' in install scripts. Prodded & ok deraadt@, verbiage tweaks from jmc@
2009-05-31Never 'humanize' the sector offsets of partitions or 'total sectors'.Kenneth R Westerback
If we are humanizing then add a comment to 'total sectors' line rather than replacing 'total sectors' with a new header. Suggestion and ok deraadt@
2009-05-29Clean up logic around exit values. Make getasciilabel() return 0Kenneth R Westerback
for success. Fix a couple of bugs where errors in checklabel() got lost. Make Editor 'q' and 'x' commands exit with 0 (ok) rather than 1. i.e. non-zero exit value now reserved for failure, not a decision to leave the disklabel unchanged. This allows the install script to use the exit value to catch failures to write a disklabel.
2009-05-17Write out mountpoint info in writelabel() after label successfullyKenneth R Westerback
written, rather than every time editor_alloc() is called. Respect '-n' for mountpoint info. Reduces surprise appearance of files when you 'x' out of Editor. "my sunglasses did not go dark" deraadt@
2009-05-05use logical or when it's intended to be a logical or; ok krw@Otto Moerbeek
2009-04-30Prime mountpoint info with any fstab info that is available, withKenneth R Westerback
or without the '-f' option being present. Now you can see in Editor mode or 'disklabel <dev>' where the partitions that exist will be mounted in the current configuration. Tweaks (and libc fixes) from, and ok deraadt@
2009-04-12When auto-allocating, check the size of the disk and displayKenneth R Westerback
offset/size information in MB if the disk is <10G, and in GB otherwise. '-p' will override this default.
2009-04-11Always display any mountpoint info available. Thus a simple -A willKenneth R Westerback
now show the planned mountpoint layout. ok deraadt@
2009-04-11readlabel() either errored out or returned a pointer to the globalKenneth R Westerback
'lab'. So there is no need for the return value. Just use &lab wherever it was used. No functional change. Slightly different version read ok to blambert@
2009-04-10Re-work '-A' so that it sets a flag that -E and -w use, and which willKenneth R Westerback
just display the auto-allocation plan otherwise. Don't overwrite any spoofed partitions, insert auto allocated partitions where we can. This is much more install script and weird architecture friendly. I'm talking about you, macppc. Many suggestions and code from otto@, feedback from many, cattle prod applied by deraadt@. ok deraadt@ "if it works for >8GB ... put it in" miod@ "to be clear, ok" todd@
2009-03-31When warning about a non-zero partition offset, show DL_GETPOFFSET()Kenneth R Westerback
and not DL_GETPSIZE().
2009-03-31Tweak comment to remove discussion of now non-existant 2 stageKenneth R Westerback
boot loaders and update list of NUMBOOT>0 archs. ok deraadt@
2009-03-30lint; mostly unused variables, carefully checked against all platformsTheo de Raadt
2009-03-29No more NUMBOOT==2 stuff around, nuke it for sake of clarity.Tobias Weingartner
ok krw@
2009-03-29otto points out that the -v printing changes are incompatible with theTheo de Raadt
expectation that -R will read the output of disklabel. I suspect we will find another way to do this; ok otto
2009-03-28Move some output under the control of the '-v' flag. In particular onlyKenneth R Westerback
display the partition info by default as is done in the E(ditor). The physical info is now only displayed if '-v' is specified. ok deraadt@
2009-03-28make -B not even show up in usage on non-NUMBOOT systems; ok jmc krwTheo de Raadt
2009-03-22tweak previous;Jason McIntyre
2009-03-22Add 'A' command to Editor mode, and -A flag to automatically execute itKenneth R Westerback
on disks without an existing label. The 'A' command allocates all space on the disk into a reasonable partition scheme for a root disk. Feedback from several, time to work on it in-tree. Prodded (repeatedly) by and ok deraadt@
2009-02-15Don't display, or save via the editor 's' command, the fsize andKenneth R Westerback
bsize fields for UNUSED partitions. '-R' already skipped processing these fields for such partitions. Eliminates an XXX. ok deraadt, "makes sense" miod@
2009-01-11On *ppc disks shared with MacOS, walk the Apple partition map to find outMiod Vallat
the bounds of the OpenBSD area. Should prevent users from shooting themselves in the feet. ok krw@
2008-08-11fix a6 partition lookup where a static variable was incorrectly used inReyk Floeter
the recursive findopenbsd() function. reported by PR 5905. tested by many ok deraadt@
2008-08-10spacing; remove non-existent flag from synopsis.Igor Sobrado
2008-08-04fix extended partition support by handling chained EBRs correctlyReyk Floeter
(using a recursion limit). now OpenBSD can be installed in a subsequent DOS/Linux-compatible extended partition. ok krw@ deraadt@
2008-07-10Die -r, die! Eliminate stray -r in usage text. Spotted by James Hartley.Kenneth R Westerback
2008-07-09Read 'vendor' flag from ASCII disklabel since we print it. FixesKenneth R Westerback
PR #5872. ok millert@ deraadt@
2008-07-01Initialize variable before checking against NULL.Ray Lai
OK deraadt, otto, krw.
2008-06-25In interactive mode, always suggest offsets and sizes inside theOtto Moerbeek
OpenBSD area and change the 'p' command to only print the boundaries and size of the OpenBSD area and the free space within that area. Introduce a 'l' command to print the header only. With krw@; ok krw@ deraadt@; jmc@ for the man page bits
2008-06-25allow to install and boot the OpenBSD A6 partition and disklabel in anReyk Floeter
extended DOS partition. the concept of extended partitions is very simple, it is just another mbr at the partition offset (well, the standard "EBR" is a linked list with a few limitations, but this diff works with both variants). this diff has been in the snapshots for a while. with input from weingart@ and krw@ ok deraadt@
2008-06-04setbootflag() must be done before checksum'ing the label. Bug introducedTheo de Raadt
in 1.126, found by nick during a test install; ok krw
2008-04-07Since Alpha is NUMBOOT=0, no need for #ifdef __alpha__ code inside aKenneth R Westerback
#if NUMBOOT > 0 section.
2008-04-07Restore boot block (-B) support that was incorrectly deleted duringKenneth R Westerback
the -r removal. Found by drahn@ when attempting a landisk install. ok deraadt@ drahn@
2008-04-06nwflag is never set now that '-r' is no more, so remove it and the warningKenneth R Westerback
that was contingent on it being set.
2008-04-06Fix logic botch I introduced with r1.123 which effectively disabledKenneth R Westerback
the '-c' and '-d` commands. With the removal of 'rflag' (logically making it always false), (a || (rflag && cflag + dflag) || b) should be (a || b), not (a || (cflag + dflag) || b). This fixes 'disklabel -w -d <disk>' as used in the install scripts. Reported by Peter Kun on misc@. Thanks!
2008-03-23Nuke disklabel -r. All labels come from the kernel via ioctl.Kenneth R Westerback
"make sense" miod@ ok deraadt@
2008-01-24"read(..., ..., sizeof Y) < sizeof Y" is a dangerous idiom because itKenneth R Westerback
does an unsigned comparison and read() can return -1. Use '!=' instead of '<' since read() can't return more than 'sizeof Y'. Not perfect (that would require a separate test for -1) but a very common usage. Do the same for a write(), and a couple of read() calls which are probably ok but why be inconsistant? This, as the last couple of commits, found by ian@ as a result of poking around in fsck_msdos() when his new iPod had problems vs OpenBSD. Concept reviewed by miod@, beck@, otto@ and ian@.
2008-01-21changes to disklabel's usage:Igor Sobrado
- align usages and their descriptions (text enclosed in brackets); - blank[], used for padding prior to r1.86, can improve readability of usage on 80-column displays if NUMBOOT == 2 ok jsing@, krw@
2007-10-17- Be more careful about pre-existing SIGCHLD handlers (or SIG_IGN) byTheo de Raadt
temporarily restoring default behaviour. This is not 100% ideal. But this fixes editor handling in mail... bah, it is really unfortunate that got broken - refactor the restoration code as well, to make it simpler ok ray
2007-10-15specifying int instead of just unsigned is better styleTheo de Raadt
2007-06-25some trivial delintingTheo de Raadt
2007-06-23expand size/offset to 16 characters, and drop the Cyl comments whichTheo de Raadt
noone cares to see anymore (for those architectures where this is important, disklabel(8) continues to enfoce the cyl-locked policy) ok otto
2007-06-18If disklabel(8) is run against unreadable media (e.g. a blank cd)Kenneth R Westerback
don't say "can't read master boot record". Just display an empty disklabel. Really yucky code that needs a lot of tough love, but marginally less confusing until then. ok deraadt@
2007-06-18-r will die. Until then, make sure any labels it dredges up areKenneth R Westerback
converted to v1 format before being used. ok deraadt@ otto@
2007-06-17On Sun machines, disklabels coming from the kernel will now have a d_flagsTheo de Raadt
bit D_VENDOR if they face the Sun cylinder / start-at-zero semantics. Other disklabels found on these architectures do not have these issues, and do not need to be constrained. checked by otto
2007-06-08second pass, some fields slipped through the first time aroundOtto Moerbeek
2007-06-08Make disklabel(8) aware of the new fields, allowing for larger thanOtto Moerbeek
2T disks, partitions and offsets. ok deraadt@
2007-06-07do not complain about c not being a multiple of lp->d_secpercyl; ok millertTheo de Raadt