summaryrefslogtreecommitdiff
path: root/sbin/disklabel/editor.c
AgeCommit message (Collapse)Author
2024-03-22Increase /usr/src partition to 2GB - 5GBJan Klemkow
ok miod@, deraadt@, otto@ and bluhm@
2023-09-06explicitly cast ULLONG_MAX to double when comparing to a doubleRobert Nagy
ok krw@
2023-09-06remove unused variableJonathan Gray
2023-07-05Restore (R)esize functionality to sparc64 disklabel(8).Kenneth R Westerback
Empty or FS_UNUSED partitions don't intrude into the OpenBSD area of a disk and therefore should not disable partition resizing. Encountered by claudio@
2023-07-03The only thing worse than treating 'return' as a function call isKenneth R Westerback
randomly mixing 'return (blah)' and 'return blah' idioms. Nuke the '()'s. No intentional functional change.
2023-06-29Fix handling of 'N-* 100' template entries.Kenneth R Westerback
'N-* 100' means a max of all 'extra' disk space not all disk space. Fixes templates with partitions after a 'N-* 100' entry. Reported by anton@
2023-06-28Refactor editor_allocspace() into easier to follow pieces.Kenneth R Westerback
editor_allocspace() interates over alloc_tables calling allocate_space(). allocate_space() iterates over space_allocations calling allocate_partition(). allocate_partition() calls allocate_diskchunk() which finds disk space for the partition. No intentional functional change. ok otto@
2023-06-21Add a parameter 'action' to mpfree() so it can optionally discardKenneth R Westerback
or keep the memory pointed at by the char ** parameter. Allows mpfree() to be used against the global mountpoints[] and eliminates a couple of manual loops to free the current contents of mountpoints[]. No intentional functional change.
2023-06-19Replace eclectic mix of errx(4, "out of memory"), err(4, NULL)Kenneth R Westerback
and err(1, NULL) with consistent err(1, NULL) when responding to out of memory conditions.
2023-06-18Add and use CHUNKSZ() to replace 'chunk->stop - chunk->start'Kenneth R Westerback
occurrances. Shorter lines, more obvious intent.
2023-06-18Use UINT64_MAX instead of -1 to set a uint64_t value toKenneth R Westerback
its maximum.
2023-05-23With the retirement of expert mode, get_fsize(), get_bsize() andKenneth R Westerback
get_cpt() simply set a partition's p_fragblock/p_cpg to default values. Replace them with a single function set_fragblock(). No functional change.
2023-05-20p_fragblock = DISKLABELV1_FFS_FRAGBLOCK(0, 0) sets p_fragblock toKenneth R Westerback
0. Just use p_fragblock = 0 as in all other initializations of p_fragblock. No functional change.
2023-05-13In the absence of the 'disktype' command line parameter alwaysKenneth R Westerback
use the d_type value provided by the kernel when creating, editing or printing a disklabel. i.e. treat d_type as disk geometry is treated, reflecting current reality as opposed to historical data.
2023-04-27Retire -E's "expert" mode. Introduced 23 years ago to avoidKenneth R Westerback
confusing users with FFS attributes that only experts should fiddle with. Actual use has withered away with functionality rendered moot or moved elsewhere. '-e' remains for the truly obscure corner cases. Simply excise the code for now to see if hidden users/uses are exposed. Further simplifications are possible if no such users/uses surface. ok with sthen@ millert@ kn@ otto@
2023-02-18Fix possibly uninitialized variable in editor_allocspace(); ok krw@Miod Vallat
2023-02-07Extend template parsing to allow "[mount point] *" as the specification forKenneth R Westerback
putting the maximum available free space into a partition. Extend command line parsing to allow 'T-' as the specification to read the template file from stdin. Prompted by, feedback, testing and ok kn@
2023-02-02Tweak restored code chunk to eliminate duplicate checks.Kenneth R Westerback
2023-02-02Restore incorrectly deleted test for default partitions intrudingKenneth R Westerback
into the OpenBSD area that is about to be auto-allocated. Fixes resizing partitions on an auto-allocated disk that had a boot partition. Found by dv@
2023-01-28Nuke unused variable.Kenneth R Westerback
2023-01-25Use getpartno() in editor_delete(), enhancing getpartno() toKenneth R Westerback
allow '*' to select all partitions when the action is 'delete'. No intentional functional change.
2023-01-24Use getpartno() in editor_add(), enhancing getpartno() to findKenneth R Westerback
the default partition and allow selection of partitions up to MAXPARTITION. No intentional functional change.
2023-01-22Fix incorrect comparison. Restores ability to edit 'p'.Kenneth R Westerback
2023-01-21editor_resize(), editor_change(), editor_modify() andKenneth R Westerback
editor_name() use identical logic to choose a partition to act on, with some minor verbiage differences. Extract getpartno() to contain/tighten this logic and shrink the editor_* functions by using it. No intentional functional change but for verbiage tweaks.
2023-01-20editor_name() and get_mp() don't change the disklabel soKenneth R Westerback
const'ify some parameters and local variables.
2023-01-20char * -> const char * parameters where clang doesn't complain.Kenneth R Westerback
2023-01-18Use ROUNDDOWN() to round down to cylinder boundary.Kenneth R Westerback
2023-01-18Use ROUNDUP() to round up to cylinder boundary.Kenneth R Westerback
2023-01-17Nuke unused MAXIMUM(). Add ROUNDUP() and ROUNDDOWN().Kenneth R Westerback
2023-01-16Use size of largest chunk of free space, not total of all chunksKenneth R Westerback
of free space, when checking for sufficient space to add a partition. As a side-benefit the list of free chunks only needs to be built once.
2023-01-14Replace comparisons/assignments to '3' with equivalent comparisons to RAW_PARTKenneth R Westerback
and assignment to RAW_PART + 1.
2023-01-13Fix a couple of auto allocation corner cases.Kenneth R Westerback
Don't stop counting free partitions just because a spoofed partition is encountered. Always check for (end - start) underflow after rounding start/end to cylinder boundaries.
2023-01-05Make free_chunks() return 'const struct chunk *' since we don'tKenneth R Westerback
modify chunks outside of free_chunks(). Adjust local variables taking the return value as needed. No intentional functional change.
2023-01-04Use 'const struct disklabel *' parameters where the disklabel isKenneth R Westerback
not altered. And 'const struct partition *' for pointers into newly const disklabels. No intentional functional change.
2023-01-04Eliminate two unnecessary 'i' loop variables by incrementingKenneth R Westerback
the pointer instead. No intentional functional change.
2023-01-04Replace p_fstype to/from FS_UNUSED dances around invocations ofKenneth R Westerback
free_chunks() with a parameter that names the partition to treat as FS_UNUSED when building the list of free space chunks. With -1 indicating that no partition should be ignored. Simplifies code and enables further simplifications and a raft of const'ifications. No intentional functional change. Regress still happy. SUN_CYLCHECK, SUN_AAT0 and D_VENDOR still happy.
2023-01-04Shuffle code a bit to eliminate need for inner loopKenneth R Westerback
variable 'j' in editor_allocspace(). No intentional functional change. Regress still happy.
2023-01-03No need to call editor_countfree() when displaying all the freeKenneth R Westerback
chunks in the 'r' editor command. Just add up chunks as they are displayed. Eliminates pointless second invocation of free_chunks(). Increment the chunk pointer rather than using iteration variable + indexing. No intentional functional change.
2022-11-10HP-300's hd is now gone. svnd transmorgified into vnd in 2011. NoKenneth R Westerback
need to keep checking for these device names.
2022-11-09No more xd/xy devs.Kenneth R Westerback
2022-11-09Use nitems() instead of a terminating { NULL, NULL } entry.Kenneth R Westerback
2022-11-08Nuke unused variable 'freesectors'.Kenneth R Westerback
2022-10-14Fix botched D_SUNCYLCHECK+D_VENDOR check from r1.321.Kenneth R Westerback
D_VENDOR lives in d_flags, not d_secpercyl. Makes resizing a partition more likely to respect cylinder rounding on sparc64.
2022-09-03Add a new keyword to template files, 'raid', to allow the autoKenneth R Westerback
allocation of RAID partitions. Make both 'raid' and 'swap' keywords case insensitive. Suggested by kn@ ok kn@ miod@
2022-09-01d_bbsize and d_sbsize have become write-only fields.Kenneth R Westerback
No need to set them or check that they are set. ok otto@ as part of larger diff
2022-07-31The geometry information in stuct disklabel is not used forKenneth R Westerback
anything. Allowing modifications to it or displaying whatever geometry was in use when the label was created leads to needless inconsistency with the kernel and with the values displayed by, e.g., fdisk(8). Always set label fields d_secsize, d_nsectors, d_ntracks, d_secpercyl, d_ncylinders to the current values used by the kernel, obtained via DIOCGPDINFO. Ignore any values from the on-disk label or the file -R uses. Nuke editor command 'g' and restrict editor command 'e' to changing d_type and d_packname.
2022-06-25Increase the auto partitioner's maximum /usr size to 30G.mbuhl
OK bluhm, otto, deraadt
2022-02-14Whitespace nit.Kenneth R Westerback
2021-12-19Simplify error message emitted when requested partition sizeKenneth R Westerback
cannot be accommodated. "not enough space" should be enough for anyone. Requested by deraadt@
2021-11-09Increase min and max src a bit to accomodate growth and git usersOtto Moerbeek
From Mikhail <mp39590@gmail.com>