summaryrefslogtreecommitdiff
path: root/sbin/disklabel
AgeCommit message (Collapse)Author
2018-08-30Practice safe free()'ing by setting alloc to NULL toKenneth R Westerback
prevent double free. Spotted by jsg@, simpler fix by myself and miko@. ok jsg@
2018-08-30Never let FS_RAID partition be named, a.k.a. given a mount point.Kenneth R Westerback
Nuke pointless and inconsistant error message before one get_mp() invocation. ok otto@
2018-08-28Tweak messages emitted by editor_resize() so "Partition x shrunk ..."Kenneth R Westerback
is only printed if the disklabel gets modified. Also, include the new size. On failure just report "Amount too big.".
2018-08-27disklabel(8) no longer touches bootstrap code so stop mentioning it.Kenneth R Westerback
The MD writedisklabel() function ensures the disklabel does not intrude on bootstraps. Add a Xr to installboot(8), which does bootstrappy stuff these days. ok jmc@
2018-08-26disklabel(8) has not used the primary/secondary boot filesKenneth R Westerback
for years. Remove mention of same from 'FILES' section.
2018-08-26The three -B forms of disklabel(8) were nuked years ago. So removeKenneth R Westerback
stray reference to them.
2018-08-23Always check the return values of get_[fsize|bsize|cpg].Kenneth R Westerback
Accept partition changes only if all succeed. ok tb@ deraadt@
2018-08-21Unbreak 'R'esize.Kenneth R Westerback
Problem noted and fix tested by jcs@. ok otto@
2018-08-11Nuke stray/pointless 'volatile' for local var.Kenneth R Westerback
2018-08-04Oops. Missing chunk from previous 'secs' -> 'ui'.Kenneth R Westerback
2018-08-04Rename local variable 'secs' to 'ui' to be consistant with all otherKenneth R Westerback
uses of getuint64(). No change to executable.
2018-08-02errno is never checked after a call to getuint64(). So there is noKenneth R Westerback
point to getuint64() setting it to EINVAL when the user enters an invalid value or aborts input with a ^D.
2018-07-12Cleanup and clarify getuint64() by using theKenneth R Westerback
same functions as auto-allocation. parse_sizespec() and apply_unit(). No intentional functional change. Looked good to tb@
2018-07-12Cleanup and clarify the has_overlap() logic so it can be read byKenneth R Westerback
normal people and is more efficient to boot. The only intentional functional change was to use mergesort() instead of heapsort() so that partitions with the same offset retain their order in the emitted verbiage. Looked good to tb@, ok kn@
2018-07-07Add recommended error checks around the use of strtod() inKenneth R Westerback
parse_sizespec(). ok otto@
2018-07-03Reduce display_edit() parameter list by one. Just callKenneth R Westerback
editor_countfree() in the function body rather than in the invocation. ok millert@
2018-07-03Nuke some leading spaces and mis-indentations that crept in over theKenneth R Westerback
years. ok otto@
2018-07-03No need for print_unit to be a global.Kenneth R Westerback
ok otto@
2018-07-01Rework partition offset/size rounding logic, removing it fromKenneth R Westerback
getuint64() which struggled to know what to do. Add it to the places rounding is actually wanted by creating and using alignpartition() which takes parameters to determine what is rounded, to what boundaries and in what direction. Simplifies and clarifies logic. Various minor verbiage tweaks and shuffling of output under expert mode to improve output during alignments. Been in snaps for a couple of weeks. much back & forth with and ok otto@
2018-04-27Add getnumber() to extract simple deciaml values from theKenneth R Westerback
user. Doesn't handle units, '*', etc. Replace the more complex getuint64 when getting things like the number of tracks per cylinder. ok otto@
2018-04-27Create and use a couple of #defines for the magic returnKenneth R Westerback
values of getuint64 that indicate errors. Suggested by & ok otto@
2018-04-26No need for two copies of tricky user input gathering code. Just useKenneth R Westerback
getstring() to get the string and then parse that in getuint64(). Fix a mis-use of %lld and some whitespace while passing. ok otto@
2018-04-26Add some range checks to make sure we don't attempt to store valuesKenneth R Westerback
too large for the receiving fields. Change a couple of do{}while() to for(;;) for consistancy. Tweaks & ok otto@
2018-04-26Fix previous. Adding "offset" to "maxval" was required.YASUOKA Masahiko
ok otto krw
2018-04-26Consolidate duplicate error messages, 'return' is not a function soKenneth R Westerback
space before '(', eliminate extraneous '{}'. Start of cleaning up user input processing. No intentional functional change. ok otto@ give or take a few '{}' removals.
2018-04-06Round user input to cylinder boundaries more betterer.Kenneth R Westerback
Improve emitted verbiage while there. tweaks & ok otto@
2018-03-08Check required partition size against the size of the largest freeKenneth R Westerback
chunk, not the total amount of free space on the disk. Removes need for 'totsecs'. ok otto@ as part of larger diff now completely committed
2018-03-08Calculate chunk size after adjusting both the chunk offset and chunkKenneth R Westerback
end in SUN_CYLCHECK case. Fixes potential off-by-one in calculating the number of cylinders available in a chunk. ok otto@ as part of larger diff
2018-03-08Instead of a SUN_CYLCHECK block in both parts of an if/else, with aKenneth R Westerback
goto from one to the other, just move the logic after the if/else. One less #ifdef. Decrements total_secs in either case. ok otto@ as part of larger diff
2018-03-08Bail out of a strategy early if the sum of the minsz values exceedsKenneth R Westerback
the space available. ok otto@ as part of larger diff
2018-03-08Bail out of a strategy early if it requires more partitions than areKenneth R Westerback
available. ok otto@ as part of larger diff
2018-03-08Simplify the strategy looping.Kenneth R Westerback
ok otto@ as part of larger diff
2018-03-04Add if (D_VENDOR) check to last SUN_CYLCHECK block lacking it.Kenneth R Westerback
While there move local variable declaration inside the 'if' and eliminate separate SUN_CYLCHECK block containing said local variable declaration. Add check for attempt to resize a partition to 0, and simplify logic a bit by recognizing that this means the number of sectors will always be > 0. ok otto@
2018-03-02Tweak a couple of long lines.Kenneth R Westerback
2018-03-02Always call get_cpg() after calling get_bsize(). InitializeKenneth R Westerback
p_cpg inside get_cpg() instead of separately, much like get_fsize() and get_bsize() work. ok otto@
2018-03-01Check for a negative value and overflow in getuint64() when performingTodd C. Miller
multiplication and division. Based on a diff from otto@. OK otto@ krw@
2018-03-01Don't overflow or underflow value when [+-] operatorsKenneth R Westerback
applied during getuint64()'s input parsing. ok otto@
2018-03-01Avoid underflow under SUN_CYLCHECK when rounding partition size toKenneth R Westerback
multiple of cylinder size. Eliminate various compiler warnings by shuffling unused variables under !SUN_CYLCHECK. Consolidate two SUN_CYLCHECK blocks into one. Add D_VENDOR check inside SUN_CYLCHECK block. Tweak & ok otto@
2018-03-01Check return value of getuint64() for ULLONG_MAX, andKenneth R Westerback
ULLONG_MAX - 1, not <= 0. This fixes the detection of ^D and invalid values during the 'R'esize command. ok otto@
2018-02-27Move fsize initialization into get_fsize() to eliminate duplication.Kenneth R Westerback
Ensure get_fsize() is always called before get_bsize(). And during (R)esize only call the pair a second time when a partition is actually shrunk. ok otto@
2018-02-25Bunch of whitespace fixes.Kenneth R Westerback
ok otto@
2018-02-24If you can modify p_cpg in when 'm'odifying a partition, you should beKenneth R Westerback
able to do the same when 'a'dding a partition. Only in 'X'pert mode of course. ok otto@
2018-02-23'partions' -> 'partitions', nuke some erroneous whitespace.Kenneth R Westerback
ok otto@
2017-12-18Tighten /usr/local and /usr/X11R6 so that 8G disks still fit in our defaultAntoine Jacoutot
partitioning scheme. ok florian@ benno@
2017-11-28in auto-allocation, increase size of /usr/src to 1.3G.Sebastian Benoit
Our tree is now 1.1G big. ok florian@, sure deraadt@
2017-09-29don't be silent on auto-allocation failure in write mode. ok millert@ krw@Otto Moerbeek
2017-05-19tweak partition sizes for auto-alloction to better suit 8G disksOtto Moerbeek
ok kr@ aja@
2017-04-19Bump numbers for /usr/obj allocation with *big* compilers.Theo Buehler
ok otto
2017-04-19enlarge obj to satisfy new world order that has *big* compilers andOtto Moerbeek
remove condition for static linking; ok tb@
2017-03-04Allow R (resize auto-partition) after A as well as when started with -A.Otto Moerbeek
This ability was lost in editor.c 1.264; noted by ajacoutot@; ok krw@