summaryrefslogtreecommitdiffstats
path: root/sbin/disklabel/editor.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* Use u_int64_t variables to hold partition offsets when calculatingkrw2008-01-221-19/+12
| | | | | offsets and sizes of free chunks. 32 bits just won't hack new big partitions. Simplify and clarify code while here.
* Make sort_partitions() even more consistant with free_chunks() by notkrw2008-01-221-21/+18
| | | | | | returning the number of elements. Check for terminating empty entry (i.e. NULL) instead. Code a bit clearer and shorter with fewer variables. No functional change.
* Kill redundant loop to find number of partitions to sort. We no longerkrw2008-01-221-15/+6
| | | | calloc() the memory.
* Replace a frequent calloc/free dance for sorted partitions with akrw2008-01-221-12/+6
| | | | | | | static array that we zero before each use. heapsort(3) shouldn't care. "should be fine" beck@
* remove "unused variable" warningchl2008-01-161-6/+4
| | | | ok krw@
* Check for expert mode/FFS inside get_fsize() and get_bsize() andkrw2008-01-121-54/+24
| | | | | reduce meat of editor_add() && editor_modify() to single if statements checking for != 0 from all get_* functions. No functional change.
* has_overlap() now always tries to resolve overlaps because it is onlykrw2008-01-121-15/+8
| | | | | called during -E initialization. Thus it no longer needs the 'resolve' parameter.
* Tweak get_offset() so it does it's own free chunks to check thekrw2008-01-121-11/+12
| | | | new offset being in a free area.
* Change editor_countfree() to return the count rather than recording itkrw2008-01-121-59/+48
| | | | | | | 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().
* Parameter 'new' to get_size() no longer used.krw2008-01-121-7/+7
|
* Introduce the function max_partition_size() to calculate the max sizekrw2008-01-121-19/+38
| | | | | | | 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.
* Remove one level of epicycles by not looping in get_size() orkrw2008-01-111-69/+70
| | | | | | | | | | 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.
* Don't allow (a)dd or (m)odify to create 0 length partitions. Don'tkrw2008-01-111-5/+7
| | | | | | allow editing the fsize/bsize FFS values for FS_UNUSED partitions. ok (for at least the first bit) miod@ weingart@ beck@
* Minor aligning of code and comments between editor_add() andkrw2008-01-101-11/+5
| | | | editor_modify(). No functional change.
* Beef up the (r)ecalculate command in -E mode by having it display thekrw2008-01-081-11/+21
| | | | | | | details of the free space it calculates. Gives an easy way to see all the chunks of free sectors on the disk. ok beck@
* Ensure that the initial free space chunk can't have a length <= 0.krw2008-01-081-3/+3
|
* Do initial free space count *after* resolving overlapping partitions.krw2008-01-081-11/+10
| | | | | This removes the last need for has_overlap() to touch the free space counter. So eliminate that parameter.
* Oops. Need to ensure we zero selected partition too.krw2008-01-071-2/+4
|
* When increasing d_npartitions as a result of (a)dd'ing a partition inkrw2008-01-071-7/+8
| | | | | -E, zero intervening partitions as well as the specified partition so no partitions are inadvertantly activated.
* Shrink & simplify some more -E code. Remove some chances for userkrw2008-01-071-109/+47
| | | | | | | | | | | | | | | 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@
* Kill some now-dead code/variables.krw2008-01-061-11/+3
|
* Move check for overlap inside get_size() as it was always called afterkrw2008-01-061-66/+13
| | | | | get_size() anyway. Allows elimination of make_contiguous() since we no longer allow overlaps to develop.
* Calculate amount of free space by adding up space in free chunks, ratherkrw2008-01-061-22/+7
| | | | than hand rolling another partition walking loop. No functional change.
* There is no point in having cpg manipulated in -E. newfs does all thekrw2008-01-061-37/+4
| | | | | | | work anyway and ignores this value. So just set it to 1 and nuke get_cpg(), shrinking and simplifying. ok otto@ millert@
* Remove text which is incorrect now that 'get bios geometry'sthen2008-01-031-6/+6
| | | | | | has been removed. ok krw
* Oops. Missed a couple of unnecessary 'DL_GETPOFFSET()+DL_GETPSIZE() >krw2008-01-011-8/+6
| | | | | ending_sector' tests and one superfluous editor_countfree(). Rectify a few comments.
* Fix display of overlapping partitions to account for larger size and offsetkrw2008-01-011-3/+3
| | | | fields.
* get_size() no longer allows DL_GETPSIZE()+DL_GETPOFFSET >krw2008-01-011-4/+3
| | | | | ending_sector, so no need to check for this condition after calling get_size().
* Shorten and simplify code, eliminate ability to assign arbitrary sizeskrw2008-01-011-47/+23
| | | | | | | | | to existing FS_BOOT and FS_UNUSED partitions via -E, tighten up error verbiage. Feedback from jsing@. ok millert@.
* Reset partition size as well as partition offset before asking forkrw2007-12-311-2/+3
| | | | | another, valid, set while adding a partition. Lost in r1.119 when we switched to DL_SETP* defines.
* Use get_size() in editor_change() instead of hand-rolling identicalkrw2007-12-301-29/+8
| | | | | code. Makes the size prompt/helpstring/looping the same for (a)dd/(m)odify/(c)hange.
* Kill some now unneeded checks for 'c' partition manipulation. Changekrw2007-12-301-31/+13
| | | | | the variable 'c' to 'partno' in editor_delete() so all editor_* functions are even more consistant. No functional change.
* Simplify code by avoiding manual manipulations of the free spacekrw2007-12-301-36/+15
| | | | | | | | counter. Call edit_countfree() instead. Feedback from otto@. ok millert@ "Go for it" deraadt@
* Since 'c' now always covers the entire disk and is always FS_UNUSED,krw2007-12-301-14/+14
| | | | | | | | | 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@
* Bring editor_add() code into line with the other editor_* functions.krw2007-12-301-47/+34
| | | | | | | 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@
* Some cosmetic code reorg to make things a bit more textuallykrw2007-12-251-22/+31
| | | | consistant. No functional change.
* Use zero_partitions() to implement the '-E' command 'd *', as itkrw2007-12-241-15/+3
| | | | | | | already is used to implement 'z'. Vocal support for both commands so keep both for now. 'sounds good' deraadt@.
* Setting p_fstype to the number of free sectors can't be right. Instead, setkrw2007-12-231-3/+3
| | | | the partition size with DL_SETPSIZE(pp, *freep).
* use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgderaadt2007-09-021-3/+3
|
* rearrange newline printing code during editor startup; ok millert krwderaadt2007-07-241-7/+7
|
* if a 4.2BSD partition falls partly within the area defined by theotto2007-06-201-8/+20
| | | | | | | '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@
* On Sun machines, disklabels coming from the kernel will now have a d_flagsderaadt2007-06-171-11/+21
| | | | | | 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
* Simplify rounding to cylinders.millert2007-06-081-21/+19
| | | | | | 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@
* second pass, some fields slipped through the first time aroundotto2007-06-081-29/+26
|
* Make disklabel(8) aware of the new fields, allowing for larger thanotto2007-06-081-196/+207
| | | | 2T disks, partitions and offsets. ok deraadt@
* Fix setting total # sectors in the 'e' command.millert2007-06-081-5/+5
|
* Add missing parens, fixes a bug aded in rev 1.112 where maxval wouldmillert2007-06-071-3/+3
| | | | be set to 0 most of the time.
* fix the cylinder rounding calculation for "totally using the space" typederaadt2007-06-061-3/+4
| | | | calculations; ok otto millert
* avoid rounding down to zero cylinders. ok marco@otto2007-06-041-3/+3
|
* add RAID to the list of partition types for which we do not prompt for atodd2007-06-011-3/+4
| | | | | filesystem ok krw@