summaryrefslogtreecommitdiff
path: root/sbin/disklabel/disklabel.c
AgeCommit message (Collapse)Author
2013-11-22Whole bunch of (unsigned char) casts carefully added for ctype calls.Theo de Raadt
Careful second audit by millert
2013-10-15The disklabel variables aflag and dflag are boolean, use logicalAlexander Bluhm
instead of binary operators for comparison. OK krw@
2013-10-03Print u_int64_t variables with %llu.Kenneth R Westerback
2013-09-10The rule is: daddr_t variables hold counts of 512-byte blocks, a.k.a.Kenneth R Westerback
DEV_BSIZE blocks. Counts of possibly other-sized blocks (e.g. disk sector addresses) are u_int64_t. The values stored in disklabels are counts of possibly other-sized blocks and hence should be handled with u_int64_t variables. Start enforcing this rule. No intended functional change. Rule strongly suggested by deraadt@
2013-06-18Initialize duid memory before shifting stuff into elements of it.Kenneth R Westerback
No doubt quiets one or more of the fringe compilers out there. Use variable 'part' rather than recalculating same value in the subsequent printf(). From dhill. ok otto@
2013-06-11final removal of daddr64_t. daddr_t has been 64 bit for a long enoughTheo de Raadt
test period; i think 3 years ago the last bugs fell out. ok otto beck others
2012-04-06there is no need to cast an unsigned type with (unsigned).Theo de Raadt
ok jsing
2012-01-16Nuke unused parameter (f) to makebootarea(). Unused since r1.123Kenneth R Westerback
(2008), when '-r' support was removed. Spotted by jsg@ with the assistance of clang.
2012-01-02Tweak usage and man page into agreement.Kenneth R Westerback
There's nothing special about -c and -d requiring them to be separated from other flags or specified as mutually exclusive. So just show a single block of flags. Some flag combos are silly but harmless. Move all -B options inside NUMBOOT #if, eliminating confusing duplication of -w and -R usage lines. And some string declaration dancing. Since we only have NUMBOOT = 1, no need to try and finesse output for different values of NUMBOOT. Line shit up.
2012-01-02'-s' hasn't done anything for a couple of years. Garbage collectKenneth R Westerback
it and the associated 'bootxx' variable. Update man page accordingly.
2011-06-05Nuke uses of and references to DIOCWLABEL, and the related 'W' andKenneth R Westerback
'N' command line options. ok matthew@
2011-06-02Hack to ensure that the in-core labels contain the current boundsKenneth R Westerback
info from the physical disk after 'disklabel -e' writes the label to disk. Saves having to reboot or do other contortions to initialize these fields. Toss in same treatment for total sectors so all fields forcibly set by kernel have current values. 0'ing of the bounds noted by matthew@. 'lovely' deraadt@
2011-05-22zap unused varOtto Moerbeek
2011-04-19make same changes regarding -f/-F argument (tempfile -> file) as was doneAlexander Hall
in disklabel(8) pointed out by jmc@
2011-04-16Tweak man page and usage string with jmc@ suggestions.Kenneth R Westerback
2011-04-16Add '-F'. Same as '-f' but uses DUIDs when writing the mount pointKenneth R Westerback
information to the specified file. After every label write, read the label to get current UID info. Some internal code cleanup with no intended functional change. ok deraadt@
2010-12-13stray tabs and spacesMarco Peereboom
2010-11-24When dealing with disklabel UIDs (DUIDs) be specific and consistent withJoel Sing
naming. ok krw@
2010-09-23Correctly identify mount points when they are specified in /etc/fstab usingJoel Sing
a disklabel UID. Based on a diff from josh@elsasser.org. Resolves PR6471. ok krw@
2010-09-23Print disklabel UIDs using printf/fprintf instead of using the hand rolledJoel Sing
uid_print() function. ok krw@
2010-08-12fix a few warnings. ok jsingTed Unangst
2010-08-08make disklabel -p slightly nicer by accepting capital letters and printingTed Unangst
a more useful error message for invalid ones. ok deraadt
2010-08-03Group string comparisons and supply more helpful comments. AddKenneth R Westerback
"total sectors" to "boundstart" and "boundend" in the list of fields that are left alone during a RESTORE operation. ok deraadt@
2010-08-03Start with the default label when RESTORE'ing a saved ascii label.Kenneth R Westerback
This ensures that all physical fields are filled in with current values. Lack of values (boundstart, boundend in particular) noted by ray@. ok deraadt@
2010-07-27Nuke 'sectoffset'. A stub variable no longer used except to supplyKenneth R Westerback
the value 0 to one function call. Use 0 there, eliminate the variable and the pointless verbose verbiage that always displayed the same value. ok deraadt@ matthew@
2010-06-30allow uppercase A-F in the uid inputAlexander Hall
ok krw@ jsing@
2010-05-18dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisDavid Gwynne
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include <sys/dkio.h> to the places that actually want and use the disk ioctls. this became an issue when krw@'s X build failed when he was testing a change to dkio.h. tested by krw@ help from and ok miod@
2010-04-28Move the UID printing/parsing code into separate functions and avoid usingJoel Sing
sscanf(). ok marco@
2010-04-28When restoring a disklabel do not restore the uid. Let the kernel allocateJoel Sing
a new uid instead. ok krw@ marco@
2010-04-28Teach disklabel how to print and parse UIDs.Joel Sing
ok deraadt@ krw@
2010-04-23Recycle unused disklabel fields in order to create a disklabel uniqueJoel Sing
identifier, allowing the disk to be identified without relying on the device name. ok deraadt@ krw@ beck@ marco@ todd@
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@