summaryrefslogtreecommitdiff
path: root/sbin/disklabel
AgeCommit message (Collapse)Author
2008-01-16remove "unused variable" warningCharles Longeau
ok krw@
2008-01-12Check for expert mode/FFS inside get_fsize() and get_bsize() andKenneth R Westerback
reduce meat of editor_add() && editor_modify() to single if statements checking for != 0 from all get_* functions. No functional change.
2008-01-12has_overlap() now always tries to resolve overlaps because it is onlyKenneth R Westerback
called during -E initialization. Thus it no longer needs the 'resolve' parameter.
2008-01-12Tweak get_offset() so it does it's own free chunks to check theKenneth R Westerback
new offset being in a free area.
2008-01-12Change editor_countfree() to return the count rather than recording itKenneth R Westerback
in a semi-global. Call it whenever the count is needed rather than trying to make sure it is called anytime the value might change. Eliminates a bunch of now unnecessary *freep parameters and calls to editor_countfree().
2008-01-12Parameter 'new' to get_size() no longer used.Kenneth R Westerback
2008-01-12Introduce the function max_partition_size() to calculate the max sizeKenneth R Westerback
a partition can be without causing overlap. Use it to eliminate the need to check overlap in get_size() and to make the (c)hange command message more meaningful, i.e. mention max size allowed not the amount of total free space.
2008-01-11Remove one level of epicycles by not looping in get_size() orKenneth R Westerback
get_offset() when the user enters an invalid value. Just abort the partition operation and return to the main prompt. Prevents users getting trapped because they don't know about ^D. Requested by deraadt@. Tweak an error message to remove ambiguity about what 'between x and y' means.
2008-01-11Don't allow (a)dd or (m)odify to create 0 length partitions. Don'tKenneth R Westerback
allow editing the fsize/bsize FFS values for FS_UNUSED partitions. ok (for at least the first bit) miod@ weingart@ beck@
2008-01-10Minor aligning of code and comments between editor_add() andKenneth R Westerback
editor_modify(). No functional change.
2008-01-08Beef up the (r)ecalculate command in -E mode by having it display theKenneth R Westerback
details of the free space it calculates. Gives an easy way to see all the chunks of free sectors on the disk. ok beck@
2008-01-08Ensure that the initial free space chunk can't have a length <= 0.Kenneth R Westerback
2008-01-08Do initial free space count *after* resolving overlapping partitions.Kenneth R Westerback
This removes the last need for has_overlap() to touch the free space counter. So eliminate that parameter.
2008-01-07Oops. Need to ensure we zero selected partition too.Kenneth R Westerback
2008-01-07When increasing d_npartitions as a result of (a)dd'ing a partition inKenneth R Westerback
-E, zero intervening partitions as well as the specified partition so no partitions are inadvertantly activated.
2008-01-07Shrink & simplify some more -E code. Remove some chances for userKenneth R Westerback
error. 1) Don't accept a partition offset in used space. 2) Make the default size the space available from the offset to the end of the free chunk the offset is in. 3) Make (m)odify ask the questions in the same order as the (a)dd command. i.e. filesystem type after offset/size. 4) Make it more obvious new partitions default into the largest chunk of free space. 5) Nuke another now pointless function - next_offset(). "Looks reasonable" millert@
2008-01-06Kill some now-dead code/variables.Kenneth R Westerback
2008-01-06Move check for overlap inside get_size() as it was always called afterKenneth R Westerback
get_size() anyway. Allows elimination of make_contiguous() since we no longer allow overlaps to develop.
2008-01-06Calculate amount of free space by adding up space in free chunks, ratherKenneth R Westerback
than hand rolling another partition walking loop. No functional change.
2008-01-06There is no point in having cpg manipulated in -E. newfs does all theKenneth R Westerback
work anyway and ignores this value. So just set it to 1 and nuke get_cpg(), shrinking and simplifying. ok otto@ millert@
2008-01-03Remove text which is incorrect now that 'get bios geometry'Stuart Henderson
has been removed. ok krw
2008-01-01Oops. Missed a couple of unnecessary 'DL_GETPOFFSET()+DL_GETPSIZE() >Kenneth R Westerback
ending_sector' tests and one superfluous editor_countfree(). Rectify a few comments.
2008-01-01Fix display of overlapping partitions to account for larger size and offsetKenneth R Westerback
fields.
2008-01-01get_size() no longer allows DL_GETPSIZE()+DL_GETPOFFSET >Kenneth R Westerback
ending_sector, so no need to check for this condition after calling get_size().
2008-01-01Shorten and simplify code, eliminate ability to assign arbitrary sizesKenneth R Westerback
to existing FS_BOOT and FS_UNUSED partitions via -E, tighten up error verbiage. Feedback from jsing@. ok millert@.
2007-12-31Reset partition size as well as partition offset before asking forKenneth R Westerback
another, valid, set while adding a partition. Lost in r1.119 when we switched to DL_SETP* defines.
2007-12-30Use get_size() in editor_change() instead of hand-rolling identicalKenneth R Westerback
code. Makes the size prompt/helpstring/looping the same for (a)dd/(m)odify/(c)hange.
2007-12-30Kill some now unneeded checks for 'c' partition manipulation. ChangeKenneth R Westerback
the variable 'c' to 'partno' in editor_delete() so all editor_* functions are even more consistant. No functional change.
2007-12-30Simplify code by avoiding manual manipulations of the free spaceKenneth R Westerback
counter. Call edit_countfree() instead. Feedback from otto@. ok millert@ "Go for it" deraadt@
2007-12-30Since 'c' now always covers the entire disk and is always FS_UNUSED,Kenneth R Westerback
there is no point in allowing the edit mode commands (a)add/(n)ame/(m)odify/(d)elete/(c)hange to pretend to fiddle with it. Some already checked for and avoided 'c', but do it in a consistant manner in all cases. ok millert@ otto@ marco@
2007-12-30Bring editor_add() code into line with the other editor_* functions.Kenneth R Westerback
The only visible change is allowing only one chance to specify a valid partition letter before returning to the main edit prompt. "This looks OK to me" millert@
2007-12-25Some cosmetic code reorg to make things a bit more textuallyKenneth R Westerback
consistant. No functional change.
2007-12-24Use zero_partitions() to implement the '-E' command 'd *', as itKenneth R Westerback
already is used to implement 'z'. Vocal support for both commands so keep both for now. 'sounds good' deraadt@.
2007-12-23Setting p_fstype to the number of free sectors can't be right. Instead, setKenneth R Westerback
the partition size with DL_SETPSIZE(pp, *freep).
2007-12-16add missing arguments to "-b" and "-s"Igor Sobrado
ok jmc@
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-09-02use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgTheo de Raadt
2007-08-01cats went awayTheo de Raadt
2007-07-24rearrange newline printing code during editor startup; ok millert krwTheo 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-20if a 4.2BSD partition falls partly within the area defined by theOtto Moerbeek
'b' command, subtract the overlapping space from the free space. fixes weird free space calculation on hppa, where converted lif labels start at sector 1, but the 'b' area skips the first cylinder. ok millert@
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-18typoTheo de Raadt
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-16OK, landisk needs NUMBOOT=1Theo de Raadt
2007-06-16i386/amd64/zaurus/landisk are not NUMBOOT=1 or NUMBOOT=2 architectures.Theo de Raadt
the result was occasional disklabel trashing as a result of disklabel -r, and perhaps other requests to the command; ok krw
2007-06-08Simplify rounding to cylinders.Todd C. Miller
Also, on systems with sun labels, don't allow the user to create a partition with fewer than a cylinder's worth of sectors. OK otto@