OpenBSD CVS

CVS log for src/sbin/fdisk/cmd.c


[BACK] Up to [local] / src / sbin / fdisk

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.180 / (download) - annotate - [select for diffs], Fri Mar 1 17:48:03 2024 UTC (3 months, 1 week ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, HEAD
Changes since 1.179: +4 -2 lines
Diff to previous 1.179 (colored)

Allow fdisk(8) to add GPT partitions of protected types.

This makes it possible to provision virtual machine images that
need a "BIOS Boot" partition.

Report, original diff and testing by Christian Ludwig. Thanks!

ok miod@

Revision 1.179 / (download) - annotate - [select for diffs], Sat Nov 18 15:42:09 2023 UTC (6 months, 2 weeks ago) by krw
Branch: MAIN
Changes since 1.178: +2 -1 lines
Diff to previous 1.178 (colored)

Scan past whitespace before checking if flag string starts
with "0x".

Pointed out by Philippe Meunier.

Revision 1.178 / (download) - annotate - [select for diffs], Fri Nov 10 16:20:52 2023 UTC (6 months, 4 weeks ago) by krw
Branch: MAIN
Changes since 1.177: +2 -2 lines
Diff to previous 1.177 (colored)

GPT partitions have many attributes. Don't stomp on them all when
using 'flag <part #>' to make a partition the only bootable partition.
Just turn off the bootable bit in the other partitions.

ok dlg@

Revision 1.177 / (download) - annotate - [select for diffs], Fri Nov 10 15:41:11 2023 UTC (6 months, 4 weeks ago) by krw
Branch: MAIN
Changes since 1.176: +37 -10 lines
Diff to previous 1.176 (colored)

Enhance 'flag' to accept hex values in addition to the current 0
.. INT64_MAX decimal values..

Easier to specify the 64 bits of GPT partition attributes and
0x8000000000000000 (a.k.a.  MS_NOAUTOMOUNT, a.k.a. 1 << 63)
becomes accessable.

Prompted by bug report and testing by Philippe Meunier. Thanks!

ok dlg@

Revision 1.176 / (download) - annotate - [select for diffs], Mon Apr 10 19:44:43 2023 UTC (13 months, 4 weeks ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_4_BASE, OPENBSD_7_4
Changes since 1.175: +2 -2 lines
Diff to previous 1.175 (colored)

Make GPT display of menu hex octet the same as the MBR display.
i.e.  two digits.

Revision 1.175 / (download) - annotate - [select for diffs], Sun Apr 9 17:19:59 2023 UTC (14 months ago) by krw
Branch: MAIN
Changes since 1.174: +14 -28 lines
Diff to previous 1.174 (colored)

Refactor and simplify GPT menu selection logic.

No intentional functional change.

Revision 1.174 / (download) - annotate - [select for diffs], Fri Apr 7 16:34:41 2023 UTC (14 months ago) by krw
Branch: MAIN
Changes since 1.173: +3 -3 lines
Diff to previous 1.173 (colored)

Oops. Missed files in last commit.

Revision 1.173 / (download) - annotate - [select for diffs], Fri Mar 31 13:11:40 2023 UTC (14 months, 1 week ago) by krw
Branch: MAIN
Changes since 1.172: +4 -4 lines
Diff to previous 1.172 (colored)

Be more consistent in function naming. Functions taking or
returning struct uuid's use 'uuid' in their names.

Lengthen a pointlessly short line.

No functional change.

Revision 1.172 / (download) - annotate - [select for diffs], Wed Mar 29 19:34:49 2023 UTC (14 months, 1 week ago) by krw
Branch: MAIN
Changes since 1.171: +8 -8 lines
Diff to previous 1.171 (colored)

Change 'type' to 'menuid' in various struct's, functions and
variables related to gpt partitions. Makes it clear that there is
no required tie between mbr partition types and gpt partition
types.

No functional change.

Revision 1.171 / (download) - annotate - [select for diffs], Wed Mar 29 14:20:50 2023 UTC (14 months, 1 week ago) by krw
Branch: MAIN
Changes since 1.170: +10 -16 lines
Diff to previous 1.170 (colored)

Simplify code by having PRT_uuid_to_type() return -1 when
no type can be found. 0 is a valid type!

No functional change.

Revision 1.170 / (download) - annotate - [select for diffs], Sun Mar 26 16:23:58 2023 UTC (14 months, 2 weeks ago) by krw
Branch: MAIN
Changes since 1.169: +7 -5 lines
Diff to previous 1.169 (colored)

Pass lbuf/lbuflen to PRT_print_[mbr|gpt]_menu() to allow changes
to the original input. Just zap it for now.

No functional change.

Revision 1.169 / (download) - annotate - [select for diffs], Sat Mar 25 15:58:44 2023 UTC (14 months, 2 weeks ago) by krw
Branch: MAIN
Changes since 1.168: +3 -3 lines
Diff to previous 1.168 (colored)

Make *_name fields char * instead of char[]. Specify desired
width of output in printf() rather than "%-*s" and sizeof(name) +
1.  Clearer, may even save some bytes as many names are shorter
than the max.

Rename PRT_print_mbrtypes() to PRT_print_mbrmenu() and
PRT_print_gpttypes() to PRT_print_gptmenu() to remove implied
completeness of list presented in menu.

No functional change.

Revision 1.168 / (download) - annotate - [select for diffs], Sat Mar 25 15:05:45 2023 UTC (14 months, 2 weeks ago) by krw
Branch: MAIN
Changes since 1.167: +3 -3 lines
Diff to previous 1.167 (colored)

Rename *_sname fields/functions to *_name to remove implied
shortness of the names.

No functional change.

Revision 1.167 / (download) - annotate - [select for diffs], Sat Mar 4 21:22:51 2023 UTC (15 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3
Changes since 1.166: +4 -4 lines
Diff to previous 1.166 (colored)

Use nitems() in the simple iterations over mbr->mbr_prt[].

No intentional functional change.

Revision 1.166 / (download) - annotate - [select for diffs], Sat Mar 4 14:47:18 2023 UTC (15 months ago) by krw
Branch: MAIN
Changes since 1.165: +3 -3 lines
Diff to previous 1.165 (colored)

Toss in some const's to ensure that static data pointed to
by function return values is not fiddled with.

No intentional functional change.

Revision 1.165 / (download) - annotate - [select for diffs], Sun Sep 11 11:47:55 2022 UTC (20 months, 4 weeks ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.164: +2 -2 lines
Diff to previous 1.164 (colored)

Add #define's for GPT partition attribute bits REQUIRED, IGNORE
and BOOTABLE, set BOOTABLE attribute bit instead of using the
incorrect GPTDOSACTIVE value, have 'fdisk -v' print out GPT
partition attributes if any of the 64 bits are set, don't spoof
any partition with REQUIRED bit set.

Prompted by kettenis@ stumbling across a machine with 40+ (!!)
REQUIRED GPT partitions.

Tested & ok kettenis@

Revision 1.164 / (download) - annotate - [select for diffs], Mon Jul 25 17:45:16 2022 UTC (22 months, 2 weeks ago) by krw
Branch: MAIN
Changes since 1.163: +8 -3 lines
Diff to previous 1.163 (colored)

Only MBR and GPT structures can be edited by fdisk.

If neither are found, restrict user actions to printing basic
information on the disk, reading the man page, initializing an
MBR or GPT, or terminating fdisk without changing anything.

Feedback on earlier attempt by miod@ and brynet@.

Revision 1.163 / (download) - annotate - [select for diffs], Sun Jul 10 20:34:31 2022 UTC (22 months, 4 weeks ago) by krw
Branch: MAIN
Changes since 1.162: +29 -17 lines
Diff to previous 1.162 (colored)

Add some anti-feline input protection by refusing to process
input of excessive length.

Make 'args' parameter to Xfuncs const char * and do the multiple
argument parsing in Xswap() and Xflag() on a local copy.

Revision 1.162 / (download) - annotate - [select for diffs], Sun Jul 10 17:46:03 2022 UTC (22 months, 4 weeks ago) by krw
Branch: MAIN
Changes since 1.161: +4 -4 lines
Diff to previous 1.161 (colored)

Use nice #define's for input buf size and output help buf size.

No functional change.

Revision 1.161 / (download) - annotate - [select for diffs], Mon May 9 15:09:50 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.160: +4 -4 lines
Diff to previous 1.160 (colored)

Replace a stray 0xA6 with DOSPTYP_OPENBSD. Tweak a ">= 2" to more
obvious "> 1".  Use easier to spot 'ask_yn() == 0' instead of
'!ask_yn()'.

No functional change.

Revision 1.160 / (download) - annotate - [select for diffs], Fri May 6 23:53:43 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.159: +4 -4 lines
Diff to previous 1.159 (colored)

Rename PRT_uuid_to_[protection|typename] to PRT_uuid_to_[protected|sname],
and PRT_type_to_uuid() to PRT_type_to_guid() so the names clearly match
the field names being searched for.

No intentional functional change.

Revision 1.159 / (download) - annotate - [select for diffs], Thu Apr 28 13:22:19 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.158: +11 -17 lines
Diff to previous 1.158 (colored)

Convert the internal GPT partition entries into host-endian form
on input/initialization and back to little-endian when writing to
disk.

Easier to read the code when letoh*() and uuid_[enc|dec]_*
invocations are minimized.

No intentional functional change.

ok jmatthew@

Revision 1.158 / (download) - annotate - [select for diffs], Sun Apr 24 12:13:37 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.157: +3 -3 lines
Diff to previous 1.157 (colored)

Use warnx() if errno is not relevant. close() after errno of
interest is checked, not before.

Less confusing error messages.

Revision 1.157 / (download) - annotate - [select for diffs], Wed Apr 20 15:49:56 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.156: +3 -37 lines
Diff to previous 1.156 (colored)

Simpify code manipulating GPT partition names by coalescing
logic into GPT_get_name(), string_to_name() and name_to_string()
functions. Remove unnecessarily abstract functions ask_string(),
utf16le_to_string() and string_to_utf16le().

No intentional functional change.

Revision 1.156 / (download) - annotate - [select for diffs], Wed Apr 20 00:47:32 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.155: +12 -18 lines
Diff to previous 1.155 (colored)

Eliminate some local pointers to gp[pn] and just use gp[pn].

Fix some whitespace and memset() parameters in passing.

No intentional functional change.

Revision 1.155 / (download) - annotate - [select for diffs], Mon Apr 18 17:32:16 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.154: +12 -12 lines
Diff to previous 1.154 (colored)

Convert the GPT header read from disk into a host-endian version,
and then back to little-endian when writing to disk.

Reduces the number of invocations of the letoh*() and htole*()
functions by 90 or so. Also makes that code much easier to read.

No intentional functional change.

Revision 1.154 / (download) - annotate - [select for diffs], Wed Mar 16 17:03:13 2022 UTC (2 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.153: +3 -3 lines
Diff to previous 1.153 (colored)

The 'status' parameter to uuid_* functions is uint32_t, not int.

No intentional functional change.

Revision 1.153 / (download) - annotate - [select for diffs], Tue Mar 15 17:59:39 2022 UTC (2 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.152: +2 -2 lines
Diff to previous 1.152 (colored)

Always use letoh32(gh.gh_part_num) instead of NGPTPARTITIONS when
scanning the GPT partition table. gh.gh_part_num reflects the actual
size of the table read from/written to the disk and scanning
possible entries between this value and the maximum allowed size
of a partition table is pointless.

No intentional functional change.

Revision 1.152 / (download) - annotate - [select for diffs], Fri Feb 4 18:21:33 2022 UTC (2 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.151: +2 -2 lines
Diff to previous 1.151 (colored)

%llu should be enough for anybody, no need to use %lld/(long long) for
uint64_t values.

Revision 1.151 / (download) - annotate - [select for diffs], Fri Feb 4 14:07:56 2022 UTC (2 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.150: +17 -21 lines
Diff to previous 1.150 (colored)

Remove CHS information from internal representation of MBR  partitions. Generate
CHS information as required when writing MBR to disk, editing a partition in CHS
mode or printing MBR.

No intentional functional change.

Revision 1.150 / (download) - annotate - [select for diffs], Thu Jan 27 16:26:32 2022 UTC (2 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.149: +9 -3 lines
Diff to previous 1.149 (colored)

Nuke single use function PRT_fix_BN() and just use the ATA/ATAPI LBA -> CHS
conversion formula

LBA = (C × HPC + H) × SPT + (S − 1)

instead of the equivalent tortuous arithmetic used in PRT_fix_BN().

No intentional functional change.

Revision 1.149 / (download) - annotate - [select for diffs], Sat Jan 22 15:39:00 2022 UTC (2 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.148: +13 -11 lines
Diff to previous 1.148 (colored)

Wrap some long lines.

Revision 1.148 / (download) - annotate - [select for diffs], Fri Jan 21 17:29:24 2022 UTC (2 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.147: +3 -3 lines
Diff to previous 1.147 (colored)

Split PRT_print() into PRT_print_parthdr() and PRT_print_part()
to align with GPT functions. Simplifies logic and eliminates the
magic invocations to print the header.

No functional change.

Revision 1.147 / (download) - annotate - [select for diffs], Thu Oct 21 13:16:49 2021 UTC (2 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.146: +1 -30 lines
Diff to previous 1.146 (colored)

Remove 'disk' editing command. Determining the disk geometry on startup (from
-l, -c/-h/-s or DIOCGPDINFO) should be enough for anyone.

Revision 1.146 / (download) - annotate - [select for diffs], Fri Sep 10 15:26:36 2021 UTC (2 years, 8 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.145: +3 -3 lines
Diff to previous 1.145 (colored)

Stop using NULL as a synonym for "s" (SECTORS). Just use "s".
Remove now pointless NULL check in unit_lookup().

No intentional functional change.

Revision 1.145 / (download) - annotate - [select for diffs], Thu Sep 9 15:21:39 2021 UTC (2 years, 8 months ago) by krw
Branch: MAIN
Changes since 1.144: +2 -2 lines
Diff to previous 1.144 (colored)

Simplify logic in USER_edit() loop to eliminate unnecessary
goto's.

Rename CMD_SAVE to CMD_QUIT to reflect actual command (Xquit) and
help and man page verbiage.

No intentional functional change.

Revision 1.144 / (download) - annotate - [select for diffs], Thu Sep 2 18:07:45 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.143: +3 -3 lines
Diff to previous 1.143 (colored)

Split part_type into separate types 'mbr_type' and 'gpt_type',
shrinking static data demands. Split PRT_printall() into
PRT_print_mbrtypes() and PRT_print_gpttypes() to eliminate
pointless 'pseudo' MBR partition types and pointless display of
MBR partition types with no associated GPT GUIDs.

Eases future MBR and GPT partition type editing improvements.

ok kettenis@

Revision 1.143 / (download) - annotate - [select for diffs], Wed Sep 1 20:08:32 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.142: +75 -16 lines
Diff to previous 1.142 (colored)

Improve editing GPT partition type GUID's by rejecting partition
id's that have no associated GUID, rather than disabling the
partition.

If the current partition type is a GUID with no corresponding
partition id, display and use that GUID as the default value.

Less surprising behaviour all round.

Revision 1.142 / (download) - annotate - [select for diffs], Sun Aug 29 17:29:14 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.141: +3 -3 lines
Diff to previous 1.141 (colored)

Nuke unused variable and unnecessary initialization.

Revision 1.141 / (download) - annotate - [select for diffs], Sat Aug 28 11:55:17 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.140: +10 -20 lines
Diff to previous 1.140 (colored)

Add hex_octet() so the strtol(..,16) dance is done in just one
place.

Allows single-digit partition id's in '-b' as a side benefit.

Revision 1.140 / (download) - annotate - [select for diffs], Tue Aug 24 12:34:04 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.139: +9 -9 lines
Diff to previous 1.139 (colored)

Trim leading/trailing whitespace from -e input to make command
parsing more robust (e.g. 'edit 0 ' is now accepted) and strict
(e.g. 'reinit gptx' is now rejected).

Input which may want that whitespace is not trimmed (e.g. GPT
partition names).

Use consistent definition of whitespace corresponding to that
used by isspace().

Revision 1.139 / (download) - annotate - [select for diffs], Sun Aug 15 13:45:42 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.138: +4 -9 lines
Diff to previous 1.138 (colored)

Don't check & errx() after each and every invocation of
string_from_line(). Just errx() inside string_from_line() if
getline() fails.

Use strcspn() idiom to nuke '\n' returned by getline().

No functional change.

Revision 1.138 / (download) - annotate - [select for diffs], Thu Aug 12 12:31:16 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
Changes since 1.137: +2 -16 lines
Diff to previous 1.137 (colored)

Further reduce cross-file confusion by adding USER_help() and
calling it from Xhelp(). Move declaration of struct cmd to nestle
next to its only instantiation (cmd_table) and use nitems() when
scanning cmd_table.

No functional change.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Aug 7 13:37:50 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.136: +1 -4 lines
Diff to previous 1.136 (colored)

Nuke a few Capt. Obvious comments.

Revision 1.136 / (download) - annotate - [select for diffs], Fri Aug 6 10:41:31 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.135: +2 -6 lines
Diff to previous 1.135 (colored)

Cleanup, clarify and generally polish the MBR/GPT initialization
code.

'-g' is promoted to be independant of '-i'. This makes it clearer
that there are four mutually exclusive initialization options.

'-i' puts the default MBR on disk, '-g' puts the default GPT on
disk, '-u' updates the MBR boot code on disk and '-A' puts a new
set of GPT partitions on disk without overwriting 'protected'
partitions.

The last initialization option specified is the one executed, so
existing '-i -g' finger memory, etc. continue to work as before.

man page/usage feedback/tweaks from jmc@

Revision 1.135 / (download) - annotate - [select for diffs], Wed Jul 21 20:26:30 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.134: +3 -3 lines
Diff to previous 1.134 (colored)

A couple of missed 'const'.

Revision 1.134 / (download) - annotate - [select for diffs], Wed Jul 21 12:22:54 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.133: +9 -15 lines
Diff to previous 1.133 (colored)

Use a dedicated struct mbr to hold the GPT protective MBR,
either the one read from disk or the default one created
when initializing GPT.

Simplifies logic, eliminates MBR_init_GPT() and demotes
MBR_protective_mbr() to a helper function called from
GPT_read().

Nuke an unused variable in passing.

No intentional functional change.

Revision 1.133 / (download) - annotate - [select for diffs], Mon Jul 19 19:23:50 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.132: +2 -8 lines
Diff to previous 1.132 (colored)

An MBR knows (mbr_lba_self) where it is supposed to go, no
need to pass the value to MBR_write().

Let MBR_write() do the translation from struct mbr to the
struct dos_mbr that will be written to the disk. Thus
eliminating unnecessary struct dos_mbr variables and the
parsing thereof.

No intentional functional change.

Revision 1.132 / (download) - annotate - [select for diffs], Sat Jul 17 21:47:56 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.131: +1 -2 lines
Diff to previous 1.131 (colored)

The first think MBR_init() does is memset(0) the gpt header and gpt
partition array. So no need to memset(0) the gpt header before each
MBR_init() invocation.

No functional change.

Revision 1.131 / (download) - annotate - [select for diffs], Sat Jul 17 14:16:34 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.130: +1 -8 lines
Diff to previous 1.130 (colored)

Nuke a bunch of Capt. Obvious or misleading comments.

No functional change.

Revision 1.130 / (download) - annotate - [select for diffs], Sat Jul 17 13:37:01 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.129: +66 -61 lines
Diff to previous 1.129 (colored)

Change edit/gedit/setpid/gsetpid to return 0/-1 to indicate success or failure
as all other helpers do.

Makes it clear that X* functions are in charge of deciding which CMD_* value
they return to main edting loop. Reduces unnecessary copying/restoring of
original partition information.

No intentional functional change.

Revision 1.129 / (download) - annotate - [select for diffs], Fri Jul 16 22:50:43 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.128: +14 -15 lines
Diff to previous 1.128 (colored)

Change PRT_protected_guid() to take native order uuid's instead of little endian
uuid's. This brings it into line with all the other PRT_ functions taking uuid
parameters.

While adapting gsetid(), introduce separate partition type and partition guid
variables to make the logic clearer.

No intentional functional change.

Revision 1.128 / (download) - annotate - [select for diffs], Thu Jul 15 21:58:02 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.127: +3 -3 lines
Diff to previous 1.127 (colored)

No need for separate b_sectors, b_offset and b_type variables. We have struct
prt to hold this info in one place.

Construct a struct prt to hold the boot partition information and stash it in
the struct disk for both MBR and GPT to access as needed.

Move the blocks to sectors conversions into DISK_open() with all of its
geometry friends.

No intentional functional change.

Revision 1.127 / (download) - annotate - [select for diffs], Tue Jul 13 15:03:34 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.126: +10 -10 lines
Diff to previous 1.126 (colored)

Disk sector addresses are normally stored/provided in uint64_t
variables/parameters, not off_t.

Adjust various parameters and variables accordingly. A few missed const's
and verbiage tweaks in passing.

No functional change.

Revision 1.126 / (download) - annotate - [select for diffs], Mon Jul 12 22:18:54 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.125: +11 -11 lines
Diff to previous 1.125 (colored)

Toss 'const' in anywhere the compiler doesn't complain about, thus identifying
places that *should* be const but currently aren't and preventing the rot from
spreading further while those issues are dealt with.

No functional change.

Revision 1.125 / (download) - annotate - [select for diffs], Mon Jul 12 18:31:53 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.124: +5 -5 lines
Diff to previous 1.124 (colored)

Final batch of struct field name tweaks. 'cmd_' for cmd, ut_' for
unit_types, 'pt_' for part_type, 'pg_' for protected_guid.

No functional change.

Revision 1.124 / (download) - annotate - [select for diffs], Mon Jul 12 14:06:19 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.123: +16 -16 lines
Diff to previous 1.123 (colored)

Add 'dk_' prefix to struct disk field names.

No functional change.

Revision 1.123 / (download) - annotate - [select for diffs], Sun Jul 11 20:51:50 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.122: +25 -25 lines
Diff to previous 1.122 (colored)

Add 'prt_' prefix to struct prt field names.

Use 'dp' instead of 'prt' for struct dos_partition *
paramters, and 'prt' instead of 'partn' for struct prt *
parameters.

No functional change.

Revision 1.122 / (download) - annotate - [select for diffs], Sun Jul 11 19:43:19 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.121: +19 -19 lines
Diff to previous 1.121 (colored)

Add 'mbr_' prefix to struct mbr field names.

Change 'offset' to mbr_lba_self and 'reloffset'
to mbr_lba_firstembr to make their use more evident.
Adjust a few parameter names to match.

Change 'part[]' to mbr_prt[] to reflect that it is an
array of struct prt.

No functional change.

Revision 1.121 / (download) - annotate - [select for diffs], Sun Jul 11 13:51:42 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.120: +101 -6 lines
Diff to previous 1.120 (colored)

Move ask_cmd(), ask_num(), ask_pid(), ask_string(), parse_b()
and crc32().

No functional change.

Revision 1.120 / (download) - annotate - [select for diffs], Sun Jul 11 13:38:27 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.119: +46 -45 lines
Diff to previous 1.119 (colored)

Add tabs to make variable declarations easier
to read.

No functional change.

Revision 1.119 / (download) - annotate - [select for diffs], Sun Jul 11 12:51:36 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.118: +42 -42 lines
Diff to previous 1.118 (colored)

'return' is not a function call.

No functional change.

Revision 1.118 / (download) - annotate - [select for diffs], Mon Jun 28 19:50:30 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.117: +2 -2 lines
Diff to previous 1.117 (colored)

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@

Revision 1.117 / (download) - annotate - [select for diffs], Mon Jun 21 02:05:30 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.116: +14 -1 lines
Diff to previous 1.116 (colored)

Add -A option to "safely" initialize a GPT without removing
special boot partitions needed by some hardware. Make it
difficult to add, delete or modify those partitions with 'fdisk
-e'.

Trim back and correct syntax in usage(). Whack at man page
verbiage.

Suggestions and ok deraadt@

Revision 1.116 / (download) - annotate - [select for diffs], Wed Jun 16 15:40:47 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.115: +5 -9 lines
Diff to previous 1.115 (colored)

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@

Revision 1.115 / (download) - annotate - [select for diffs], Mon Jun 14 17:34:06 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.114: +1 -4 lines
Diff to previous 1.114 (colored)

Only use of 'reinited' died in cmd.c r1.100. It is now set in a
couple of places but never checked. Retire it.

No functional change.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Jun 13 15:32:36 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.113: +5 -1 lines
Diff to previous 1.113 (colored)

Have gedit() and gsetpid() both return CMD_CLEAN if no data has
changed, thus keeping the modified indicator correct and avoiding
early bailout when editing a gpt partition w/o changing the type.

Revision 1.113 / (download) - annotate - [select for diffs], Sun Jun 13 14:39:05 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.112: +10 -4 lines
Diff to previous 1.112 (colored)

Tweak gsetpid() to restore partition info in case of an error,
and mark the partition dirty only if something changed.

More aligned with gedit() and safer when invoked directly from
Xsetpid().

Revision 1.112 / (download) - annotate - [select for diffs], Fri Jun 11 16:22:46 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.111: +37 -20 lines
Diff to previous 1.111 (colored)

Add local functions edit() and setpid().

Reduce Xedit()/Xsetpid() to parsing the partition number and
invoking [g]edit()/[g]setpid() appropriately.

No intentional functional change.

Revision 1.111 / (download) - annotate - [select for diffs], Fri Jun 11 14:02:22 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.110: +13 -11 lines
Diff to previous 1.110 (colored)

Take a bit more obvious care in gedit() to restore original
partition information when one of the modification steps (e.g.
setting the partition type via gsetpid()) fails.

Revision 1.110 / (download) - annotate - [select for diffs], Fri Jun 11 00:14:50 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.109: +17 -21 lines
Diff to previous 1.109 (colored)

No need to parse partition number more than necessary. Just pass
a parsed number to the helper functions gedit() and gsetpid().

No functional change.

Revision 1.109 / (download) - annotate - [select for diffs], Thu Jun 10 22:27:37 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.108: +3 -6 lines
Diff to previous 1.108 (colored)

Another hand rolled partition number parsing bites the dust.

Revision 1.108 / (download) - annotate - [select for diffs], Thu Jun 10 21:28:43 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.107: +4 -11 lines
Diff to previous 1.107 (colored)

Missed an occurance of hand rolled partition number parsing.

No intentional funtional change.

Revision 1.107 / (download) - annotate - [select for diffs], Thu Jun 10 18:41:52 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.106: +40 -40 lines
Diff to previous 1.106 (colored)

Abstract repeated parsing of partition numbers into parsepn() to
simplify the code.

No intentional funtional change.

Revision 1.106 / (download) - annotate - [select for diffs], Thu Jun 10 16:09:17 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.105: +8 -9 lines
Diff to previous 1.105 (colored)

Local functions don't need to be in .h files, nor do they need the
all caps prefixes.

No functional change.

Revision 1.105 / (download) - annotate - [select for diffs], Thu Jun 10 15:01:34 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.104: +10 -10 lines
Diff to previous 1.104 (colored)

Rename vars 'oldpart' to 'oldgg' when storing 'gg' value, and
'oldpp' when storing 'pp' value.

A bit easier to read. No functional change.

Revision 1.104 / (download) - annotate - [select for diffs], Sat May 15 15:59:15 2021 UTC (3 years ago) by krw
Branch: MAIN
Changes since 1.103: +4 -3 lines
Diff to previous 1.103 (colored)

Add missing MBR_protective_mbr() check when writing edited GPT.

No intentional functional change.

Revision 1.103 / (download) - annotate - [select for diffs], Fri May 14 15:31:01 2021 UTC (3 years ago) by krw
Branch: MAIN
Changes since 1.102: +8 -4 lines
Diff to previous 1.102 (colored)

Tweak the two copies of gpt_chk_mbr() to return the index of the MBR
0xEE (DOSPTYP_EFI) partition, or -1 no usable such partition is found.

Adopt a consistent idiom to capture the index for future use.

Clean up the gpt_chk_mbr() logic to make it clearer what constraints
are being applied when looking for the DOSTYP_EFI partition.

No intentional functional change.

Revision 1.102 / (download) - annotate - [select for diffs], Mon May 10 17:16:01 2021 UTC (3 years ago) by krw
Branch: MAIN
Changes since 1.101: +5 -5 lines
Diff to previous 1.101 (colored)

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.

Revision 1.101 / (download) - annotate - [select for diffs], Fri May 7 22:15:13 2021 UTC (3 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.100: +2 -2 lines
Diff to previous 1.100 (colored)

Replace random mix of u_int* and uint* types with consistent uint* types.

Revision 1.100 / (download) - annotate - [select for diffs], Sun May 2 20:07:14 2021 UTC (3 years, 1 month ago) by krw
Branch: MAIN
Changes since 1.99: +4 -3 lines
Diff to previous 1.99 (colored)

Try harder to ensure there are no GPT revenants after
choosing MBR partitioning.

Revision 1.99 / (download) - annotate - [select for diffs], Sat Jan 30 18:16:36 2021 UTC (3 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9
Changes since 1.98: +6 -9 lines
Diff to previous 1.98 (colored)

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@

Revision 1.98 / (download) - annotate - [select for diffs], Mon Nov 13 21:00:32 2017 UTC (6 years, 6 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.97: +2 -2 lines
Diff to previous 1.97 (colored)

Constrain MBR partition offsets to 0 .. disk.size - 1.

Issue reported by Alexi Malinin via bugs@. Thanks!

Revision 1.97 / (download) - annotate - [select for diffs], Sat Sep 3 17:46:19 2016 UTC (7 years, 9 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.96: +2 -2 lines
Diff to previous 1.96 (colored)

'reinit' should check the MBR on disk, as the man page says.

Makes 'reinit' respect current state of disk when deciding between
MBR and GPT initialization.

Problem noted by halex@

Revision 1.96 / (download) - annotate - [select for diffs], Tue Aug 2 16:00:10 2016 UTC (7 years, 10 months ago) by jcs
Branch: MAIN
Changes since 1.95: +2 -2 lines
Diff to previous 1.95 (colored)

capitalize a question like all the others

ok krw

Revision 1.95 / (download) - annotate - [select for diffs], Wed Mar 30 23:40:54 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.94: +7 -9 lines
Diff to previous 1.94 (colored)

Dump strdup()/free() dance and just use a local buffer to translate help
messages to GPT.

Unchecked strdup() result noted by mestre@. ok mestre@ tim@

Revision 1.94 / (download) - annotate - [select for diffs], Mon Mar 28 18:14:01 2016 UTC (8 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.93: +7 -9 lines
Diff to previous 1.93 (colored)

The GPT versions of help strings that don't contain'MBR' were
leaking. Refactor logic a bit to avoid leak and make logic clearer.

Noticed by (and initial diff from) mestre@ and his friend clang.

Revision 1.93 / (download) - annotate - [select for diffs], Sat Jan 9 18:10:56 2016 UTC (8 years, 5 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.92: +5 -5 lines
Diff to previous 1.92 (colored)

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.

Revision 1.92 / (download) - annotate - [select for diffs], Thu Nov 26 08:15:07 2015 UTC (8 years, 6 months ago) by tim
Branch: MAIN
Changes since 1.91: +3 -2 lines
Diff to previous 1.91 (colored)

When prompting for a GPT partition type, use the partition's current type as
default; OK krw@

Revision 1.91 / (download) - annotate - [select for diffs], Wed Nov 25 19:32:35 2015 UTC (8 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.90: +10 -9 lines
Diff to previous 1.90 (colored)

Try harder to prevent 0-length partitions from being defined.

Suggested by & ok tim@

Revision 1.90 / (download) - annotate - [select for diffs], Sat Nov 21 16:45:41 2015 UTC (8 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.89: +7 -8 lines
Diff to previous 1.89 (colored)

Bring GPT partition editing into line with MBR partition editing
by presenting the existing offset and size as the defaults. Enhance
getuint64() to take a minimum value as ask_num() does. Use this to
ensure that GPT partitions are constrained to the valid area of the
disk. Leave MBR partition constraints alone for the moment.

Original problem(s) noted by tim@

Revision 1.89 / (download) - annotate - [select for diffs], Sat Nov 21 02:12:09 2015 UTC (8 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.88: +59 -52 lines
Diff to previous 1.88 (colored)

Nuke long standing annoyance of EDIT() macros and switch both Xedit()
and Xgedit() to a new mechanism. Keep a copy of the old partition
and compare final edited version to that to decide if it is dirty.

Fixes a number of (but not all!) nits in editing partitions.

Original problem(s) noted by, suggestions from, much testing and
ok tim@

Revision 1.88 / (download) - annotate - [select for diffs], Thu Nov 19 18:03:45 2015 UTC (8 years, 6 months ago) by tim
Branch: MAIN
Changes since 1.87: +12 -7 lines
Diff to previous 1.87 (colored)

When an existing partition is modified in LBA mode, ensure that the partition
table is marked dirty so that it gets written when "quit" is issued.

This commit contains the MBR part of the fix only. The GPT code needs a few
adjustments before the GPT part can be fixed properly.

OK krw@

Revision 1.87 / (download) - annotate - [select for diffs], Thu Nov 19 16:14:08 2015 UTC (8 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.86: +5 -7 lines
Diff to previous 1.86 (colored)

Reduce overburden of unnecessary #include's. Note that param.h is
included only for DEV_BSIZE.  Use INT64_MAX instead of LLONG_MAX
so stdint.h is enough.  General tidying up of #include sections.

ok GCC

Revision 1.86 / (download) - annotate - [select for diffs], Wed Nov 18 17:09:26 2015 UTC (8 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.85: +2 -2 lines
Diff to previous 1.85 (colored)

Change #include <memory.h> to #include <string.h>

Revision 1.85 / (download) - annotate - [select for diffs], Fri Nov 13 02:27:17 2015 UTC (8 years, 6 months ago) by krw
Branch: MAIN
Changes since 1.84: +5 -14 lines
Diff to previous 1.84 (colored)

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@

Revision 1.84 / (download) - annotate - [select for diffs], Tue Nov 3 14:20:00 2015 UTC (8 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.83: +7 -1 lines
Diff to previous 1.83 (colored)

Don't allow the user to enter GPT partition names too large to fit
in the GPT partition structure. And don't run off the end of the
name buffer by confusing sizeof() with the number of elements in
an array.  Use the new GPTPARTNAMESIZE #define instead. While here,
zap the old partition name before setting the new one, lest a short
new name leave bits of an old long name in place.

Originally spotted by jsg@ and his friend cppcheck.

ok jsg@ for slightly different version.

Revision 1.83 / (download) - annotate - [select for diffs], Mon Oct 26 15:08:26 2015 UTC (8 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.82: +199 -31 lines
Diff to previous 1.82 (colored)

Add GPT editing. Based on GSOC 2014 work by Markus Muller.

Revision 1.82 / (download) - annotate - [select for diffs], Thu Apr 2 18:00:55 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.81: +1 -3 lines
Diff to previous 1.81 (colored)

Don't printf("offset: ...) before every call to MBR_print(). Do it
once inside MBR_print().

Revision 1.81 / (download) - annotate - [select for diffs], Thu Mar 26 20:32:10 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.80: +3 -3 lines
Diff to previous 1.80 (colored)

Adapt ask_string() from disklabel's getstring(). It will be used
to obtain GPT partition names. Tweak ask_pid() to take low/high
bounds so it can handle 1-ff (MBR) or 1000-ffff (GPT) partition
pids as required. A pid of '0' is still special and disables the
partition.

No visible or intentional functional change.

Revision 1.80 / (download) - annotate - [select for diffs], Thu Mar 26 14:08:12 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.79: +8 -8 lines
Diff to previous 1.79 (colored)

Expand internal representation of partition starting LBA and size
to 64 bits, adjusting printf()'s, etc. as required. Preparing for
GPT partitions. Add 't' size unit. No other intentional functional
change.

Revision 1.79 / (download) - annotate - [select for diffs], Thu Mar 19 22:48:57 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.78: +2 -2 lines
Diff to previous 1.78 (colored)

When zapping the GPT at the end of the disk, don't use disk.size
to get the location. disk.size is a 32 bit value for MBR use. Use
DL_GETDSIZE(&dl) to get the real location even on 'big' disks.

Revision 1.78 / (download) - annotate - [select for diffs], Wed Mar 18 14:46:59 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.77: +20 -21 lines
Diff to previous 1.77 (colored)

Stop passing around little used 'struct mbr tt' parameter.  Just
make the initial mbr that tt pointed at a global that can be directly
accessed in the couple of places it is needed.

Fewer parameters, less confusion, no functional change.

Revision 1.77 / (download) - annotate - [select for diffs], Tue Mar 17 21:42:15 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.76: +21 -21 lines
Diff to previous 1.76 (colored)

Stop passing around little used and superfluous 'offset' parameter.
Just use the offset recorded/parsed in the struct mbr being used.

Can still traverse/edit extended MBRs so offset really wasn't needed.

Fewer parameters, less confusion, no functional change.

Revision 1.76 / (download) - annotate - [select for diffs], Mon Mar 16 23:51:50 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.75: +42 -57 lines
Diff to previous 1.75 (colored)

Stop passing around a pointer to the stack variable 'disk' in main().
There is only one disk being worked on, so just make it a global.

Fewer parameters, less confusion, no functional change.

Revision 1.75 / (download) - annotate - [select for diffs], Sat Mar 14 18:32:29 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.74: +11 -14 lines
Diff to previous 1.74 (colored)

Whitespace & KNF tweaks. Change functions whose return values are
not checked to void. Use continue inside a do loop instead of a
goto to the top. Move a #define/#undef more local to use. Eliminate
some lint.

General cleanup of things noticed preparing the big churn.

No intentional functional change.

Revision 1.74 / (download) - annotate - [select for diffs], Sat Mar 14 15:21:53 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.73: +11 -20 lines
Diff to previous 1.73 (colored)

Switch all the license blocks to the standard OpenBSD/ISC license.

With the permission of Toby.

ok deraadt@

Revision 1.73 / (download) - annotate - [select for diffs], Tue Feb 10 01:20:10 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.72: +10 -2 lines
Diff to previous 1.72 (colored)

If 'write' is issued after a 'reinit' command, and the MBR to be
written does not contain an EFI partition, zap any GPT signature
found on the 2nd (LBA 1) and last sectors on the disk. The install
script uses this sequence.

This is a temporary workaround until more GPT support is imported
post-5.7.

Should fix at least some machines who insist on using the GPT even
after we have overritten the 'protective' MBR.

ok deraadt@ tedu@ beck@ millert@

Revision 1.72 / (download) - annotate - [select for diffs], Mon Feb 9 04:27:15 2015 UTC (9 years, 4 months ago) by krw
Branch: MAIN
Changes since 1.71: +2 -2 lines
Diff to previous 1.71 (colored)

Rename 'm_flag' to 'e_flag' since it's '-e' that sets it. Rename
'User_modify' to 'USER_edit' for the same reason.

Revision 1.71 / (download) - annotate - [select for diffs], Mon Mar 31 23:04:03 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.70: +12 -18 lines
Diff to previous 1.70 (colored)

Use return value constants to make effects clearer than the use
of an intermediate variable. No intended functional change.

Revision 1.70 / (download) - annotate - [select for diffs], Mon Mar 31 22:03:29 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.69: +1 -4 lines
Diff to previous 1.69 (colored)

Whitespace rectification.

Revision 1.69 / (download) - annotate - [select for diffs], Thu Mar 20 13:18:21 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.68: +4 -1 lines
Diff to previous 1.68 (colored)

Add back various #includes of err.h, unistd.h, ctype.h, ioctl.h to
eliminate multiple 'implicit' declarations introduced by the previous
over-zealous #include cleanup.

Thanks to to tedu@ for pointing out how -Wall reveals all.

Revision 1.68 / (download) - annotate - [select for diffs], Mon Mar 17 16:40:00 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.67: +12 -10 lines
Diff to previous 1.67 (colored)

Nuke pointless blank lines, defines, comments and casts. Eliminate
#include in *.h files in favour of listing them as required in the *.c
files. Fix error message to correctly state that 64 is the minimum
value for -l. Use errx() where errno is not relevant. Use 'continue'
rather than a label to go back to start of a loop.

No intentional functional change.

Revision 1.67 / (download) - annotate - [select for diffs], Mon Mar 17 13:15:44 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.66: +15 -16 lines
Diff to previous 1.66 (colored)

Un-revert, being careful to not break snap building. Add paranoia check
for any missing geometry.

Revision 1.66 / (download) - annotate - [select for diffs], Fri Mar 14 15:41:33 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.65: +16 -15 lines
Diff to previous 1.65 (colored)

Revert last -- broke building snaps.

Revision 1.65 / (download) - annotate - [select for diffs], Thu Mar 13 12:12:35 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.64: +1 -15 lines
Diff to previous 1.64 (colored)

Remove some lint -- ARGSUSED.

Inspired by guenther@.

Revision 1.64 / (download) - annotate - [select for diffs], Thu Mar 13 12:02:28 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.63: +15 -16 lines
Diff to previous 1.63 (colored)

Merge 'struct DISK_metrics' and 'struct disk' into one, since we don't
need to record two sets of metric/geometry data. Use 'geometry'
instead of 'metrics' in names and comments. Eliminate
DISK_getmetrics().

While here, make 64 the minimal valid value for '-l' instead of 1. This
avoids the possibility of having 0 cylinders.

No intentional functional change.

Feedback & tweak from chris@

Revision 1.63 / (download) - annotate - [select for diffs], Mon Mar 10 21:40:58 2014 UTC (10 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.62: +29 -31 lines
Diff to previous 1.62 (colored)

No need to pass the name of the command to the function that is
implementing that command, a pointer to the command arguments is the
only thing needed. No need to have a pointer to the command table in
every command, since there is only one table. No need for shiney new
stack space for every command name and arguments parsed, since we
don't recurse we can just use static memory.

No intentional functional change.

Revision 1.62 / (download) - annotate - [select for diffs], Sun Mar 9 22:25:06 2014 UTC (10 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.61: +10 -16 lines
Diff to previous 1.61 (colored)

Instead of passing around 'char buf[DEV_BSIZE]' buffers, pass around
'struct dos_mbr' variables, since that is what the buffers were used
for. Removes need to know about DEV_BSIZE and thus include param.h
from all files but one so move the param.h #include to that file
(mbr.c).

Nuke a bunch of local MBR #defines in favour of the disklabel.h ones.

Remove a bunch of unneeded #includes, replace the odd malloc/bzero
with calloc, replace equally odd bcopy's with memcpy, remove a stray
duplicate MBR parsing in MBR_pcopy().

No intentional functional change.

Revision 1.61 / (download) - annotate - [select for diffs], Fri Mar 7 21:56:13 2014 UTC (10 years, 3 months ago) by krw
Branch: MAIN
Changes since 1.60: +35 -25 lines
Diff to previous 1.60 (colored)

Relieve the code of an overburden of unnecessary typedef
abstraction. Call a 'struct' a 'struct' and not a pony.

No functional change.

idea ok deraadt@

Revision 1.60 / (download) - annotate - [select for diffs], Thu Mar 21 18:45:58 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.59: +4 -3 lines
Diff to previous 1.59 (colored)

more substantial include cleanup

Revision 1.59 / (download) - annotate - [select for diffs], Thu Mar 21 18:37:07 2013 UTC (11 years, 2 months ago) by deraadt
Branch: MAIN
Changes since 1.58: +1 -2 lines
Diff to previous 1.58 (colored)

I don't feel great about adding an include for <sys/param.h>, but I feel
great for removing an include of <machine/param.h>
This needs further cleanup if someone has time.

Revision 1.58 / (download) - annotate - [select for diffs], Wed Jul 11 10:27:34 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.57: +5 -27 lines
Diff to previous 1.57 (colored)

Simplify guts and calling of getuint(). Eliminate a useless 'help'
capablity by using help text as regular prompt for 'size' and
'offset'. Try to detect and handle more overflow/underflow conditions
in getuint() and ensure returned value is always within requested
bounds. Handle zero-length partitions by treating them as UNUSED.

tested & ok halex@

Revision 1.57 / (download) - annotate - [select for diffs], Mon Jul 9 17:19:55 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.56: +3 -3 lines
Diff to previous 1.56 (colored)

We always want to do unit conversions. So flags parameter of getuint()
is now superflous. With rounding gone the offset parameter is
similarly superfluous. Simply getuint() accordingly.

Revision 1.56 / (download) - annotate - [select for diffs], Mon Jul 9 17:07:35 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.55: +3 -6 lines
Diff to previous 1.55 (colored)

I want some of what kjell was smoking 10 years ago when he added
units handling by copying getuint() from disklabel. MBR partition id
and disklabel partition type are different beasts. So deciding to
round off a MBR partition with id FS_BSDFFS meant rounding off
NTFS partitions. And FS_SWAP partitions meant DOS FAT 12. So just
nuke rounding off for now to simplify getuint().

ok beck@

Revision 1.55 / (download) - annotate - [select for diffs], Mon Jul 9 16:45:34 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.54: +17 -5 lines
Diff to previous 1.54 (colored)

Make 'swap' command work like fdisk(8) says -- you must supply two valid
partition numbers.

Revision 1.54 / (download) - annotate - [select for diffs], Mon Jul 9 12:45:30 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.53: +2 -6 lines
Diff to previous 1.53 (colored)

Use strtonum() instead of strtol() inside ask_num(). Many overflows
are thus avoided. Since bounds are now reliable don't check the
returned value for being in-bounds. Since default value is
forced inside bounds, don't bother being tricky and passing a
default that is outside the bounds being specified.

ok beck@

Revision 1.53 / (download) - annotate - [select for diffs], Sun Jul 8 18:29:28 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

set_pid() does not need prompt string, low or high parameters. These
are all constants. Independantly suggested by guenther@.

Revision 1.52 / (download) - annotate - [select for diffs], Sun Jul 8 17:46:44 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.51: +10 -12 lines
Diff to previous 1.51 (colored)

Split out an ask_pid() function rather than over-parameterizing the
ask_num() function. Remove now unneeded 'flags' and 'help' parameters
from both. Display out of range values in hex in ask_pid(), since
we are seeking hex input.

ok guenther@

Revision 1.51 / (download) - annotate - [select for diffs], Sun Jul 8 12:29:04 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.50: +14 -20 lines
Diff to previous 1.50 (colored)

Call Xsetpid() to edit the partition type from Xedit() rather than
duplicating the code. Allows simplification of the EDIT() #define
in Xedit() since we always ASK_DEC and use a NULL help parameter when
invoking ask_num().

Revision 1.50 / (download) - annotate - [select for diffs], Sun Jul 8 11:32:58 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.49: +8 -9 lines
Diff to previous 1.49 (colored)

Nuke useless EDIT() #define in Xsetpid.

A #define to simplify a function calling snippet does not simply or
help when it is used only once.

Revision 1.49 / (download) - annotate - [select for diffs], Sun Jul 8 10:11:59 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.48: +15 -13 lines
Diff to previous 1.48 (colored)

Replace tricker atoi() and hand rolled parsing with strsep() and
strtonum(). Make related error messages consistant.

ok haesbaert@

Revision 1.48 / (download) - annotate - [select for diffs], Sat Jul 7 16:00:19 2012 UTC (11 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.47: +17 -29 lines
Diff to previous 1.47 (colored)

Replace atoi() with strtonum() where it's easy. Make related error
messages consistant. Check for valid partition when 'select'ing a
partition.

ok haesbaert@

Revision 1.47 / (download) - annotate - [select for diffs], Wed Apr 25 04:21:45 2012 UTC (12 years, 1 month ago) by matthew
Branch: MAIN
Changes since 1.46: +11 -2 lines
Diff to previous 1.46 (colored)

Before writing it to disk, warn the user if their new MBR contains
more than one OpenBSD partition.

ok deraadt

Revision 1.46 / (download) - annotate - [select for diffs], Fri Nov 11 18:21:06 2011 UTC (12 years, 7 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1
Changes since 1.45: +6 -3 lines
Diff to previous 1.45 (colored)

A zero-length partition is a non-partition, so reject a partition
length of 0. And anyway PRT_fix_CHS() writes garbage when length
is zero.

Refresh the in-memory copy to reflect any data that was written
out, so you can see that your changes have taken effect.

Surprise behaviours noted by matthew@ at c2k11.

Revision 1.45 / (download) - annotate - [select for diffs], Fri Jul 2 02:54:09 2010 UTC (13 years, 11 months ago) by halex
Branch: MAIN
CVS Tags: OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8
Changes since 1.44: +21 -9 lines
Diff to previous 1.44 (colored)

on error, getuint() will return UINT_MAX. Instead of actually using
that value, print an error message and repost the question

ok krw@ deraadt@

Revision 1.44 / (download) - annotate - [select for diffs], Thu Dec 24 10:06:35 2009 UTC (14 years, 5 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

spelling fixes, from Brad Tilley; we will not fix src/sbin/dump/dump.h
as neither arrayified not arrayfied exist -- sanctioned dictionaries
like Merriam-Webster ones suggest a few alternatives (e.g., arrayed),
however these made up words are easy to understand and we are not
certain that current ones are not ok.

ok jmc@

Revision 1.43 / (download) - annotate - [select for diffs], Sun Feb 8 18:03:18 2009 UTC (15 years, 4 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.42: +15 -9 lines
Diff to previous 1.42 (colored)

Eliminate excessive verbiage for 'fdisk -i' and 'fdisk -u'. Especially
the multi-line banner announcing that the MBR is being changed.
Also the listing of the partition table in 'fdisk -u'. Display a
consistant message when the MBR is written.

While here cleanup and shrink code without changing any semantics.
Started with a diff posted on tech@ by Tobias Ulmer.

"I like it" marco@ ok jsing@

Revision 1.42 / (download) - annotate - [select for diffs], Thu Jul 27 04:06:13 2006 UTC (17 years, 10 months ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.41: +7 -4 lines
Diff to previous 1.41 (colored)

Add checks to each write(2) attempt and try to keep fdisk in a
consistent state upon write failure.

OK krw@ and deraadt@.

Revision 1.41 / (download) - annotate - [select for diffs], Tue Jul 18 19:05:42 2006 UTC (17 years, 10 months ago) by mbalmer
Branch: MAIN
Changes since 1.40: +2 -2 lines
Diff to previous 1.40 (colored)

Fix a typo, paritition -> partition.
From Alexey Dobriyan <adobriyan@gmail.com>, thanks.

Revision 1.40 / (download) - annotate - [select for diffs], Wed Apr 26 17:10:43 2006 UTC (18 years, 1 month ago) by deraadt
Branch: MAIN
Changes since 1.39: +2 -2 lines
Diff to previous 1.39 (colored)

man page is gzip'd, should store as unsigned char array.

Revision 1.39 / (download) - annotate - [select for diffs], Tue Mar 29 19:35:25 2005 UTC (19 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.38: +20 -11 lines
Diff to previous 1.38 (colored)

Allow setting of partition flag with an optional explicit value. PR 4143.
ok weingart@ deraadr@

Revision 1.38 / (download) - annotate - [select for diffs], Wed Jan 19 15:48:20 2005 UTC (19 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.37: +43 -1 lines
Diff to previous 1.37 (colored)

add a swap primitive; ok various, will be polished after by tom

Revision 1.37 / (download) - annotate - [select for diffs], Sat Nov 6 18:57:59 2004 UTC (19 years, 7 months ago) by otto
Branch: MAIN
Changes since 1.36: +10 -6 lines
Diff to previous 1.36 (colored)

gzip embedded man pages, and pipe through gunzip when viewing.
ok deraadt@

Revision 1.36 / (download) - annotate - [select for diffs], Sat Sep 18 23:22:05 2004 UTC (19 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.35: +15 -1 lines
Diff to previous 1.35 (colored)

some delinting; ok otto

Revision 1.35 / (download) - annotate - [select for diffs], Tue Jul 13 06:00:33 2004 UTC (19 years, 11 months ago) by tom
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.34: +3 -3 lines
Diff to previous 1.34 (colored)

Remove unused argument 'int pn' to PRT_fix_CHS().  The 'int pn'
argument to PRT_parse() then becomes unused, so remove that too.

ok henning@, otto@

Revision 1.34 / (download) - annotate - [select for diffs], Tue Jun 22 23:01:55 2004 UTC (19 years, 11 months ago) by tom
Branch: MAIN
Changes since 1.33: +2 -1 lines
Diff to previous 1.33 (colored)

Make the interactive "update" command match the command-line "-u"
option by updatng/setting the 0xAA55 signature at the end of the sector.

ok nick@ weingart@

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jun 11 06:22:12 2003 UTC (21 years ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.32: +14 -79 lines
Diff to previous 1.32 (colored)

ansification

Revision 1.32 / (download) - annotate - [select for diffs], Tue Jun 3 01:13:19 2003 UTC (21 years ago) by weingart
Branch: MAIN
Changes since 1.31: +1 -6 lines
Diff to previous 1.31 (colored)

Nuke terms 3 & 4.

Revision 1.31 / (download) - annotate - [select for diffs], Thu Jan 24 04:40:03 2002 UTC (22 years, 4 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2, OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

allow reinitializing mbr in the ext parts; from Matt Watson <mwatson@apple.com>

Revision 1.30 / (download) - annotate - [select for diffs], Fri Jan 18 08:38:26 2002 UTC (22 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.29: +9 -9 lines
Diff to previous 1.29 (colored)

Allow size values to be displayed in the user's choice of units.
Idea borrowed from disklabel. i.e. Users can now type "print M"
and be rewarded with partition sizes in Megs

Revision 1.29 / (download) - annotate - [select for diffs], Fri Jan 18 08:33:10 2002 UTC (22 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.28: +10 -5 lines
Diff to previous 1.28 (colored)

Add disklabel-style editing for size/offset values in
the partition tables. These values may now contain units,
such as "300k" "500M" or "2G".
(sectors, bytes, and cylinders are also supported.)
This should largely eliminate the need for a calculator
when using fdisk on large disks.

Revision 1.28 / (download) - annotate - [select for diffs], Sun Jan 28 00:56:07 2001 UTC (23 years, 4 months ago) by weingart
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9
Changes since 1.27: +5 -3 lines
Diff to previous 1.27 (colored)

More -Wall cleanup.  Ansi style nit.

Revision 1.27 / (download) - annotate - [select for diffs], Mon Jan 1 21:05:33 2001 UTC (23 years, 5 months ago) by angelos
Branch: MAIN
Changes since 1.26: +41 -1 lines
Diff to previous 1.26 (colored)

New command "setpid", just changes the ID of a partition (no other
parameters editing) -- vassilip@dsl.cis.upenn.edu

Revision 1.26 / (download) - annotate - [select for diffs], Sat Jul 1 21:49:12 2000 UTC (23 years, 11 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.25: +4 -4 lines
Diff to previous 1.25 (colored)

be more verbose when warning for partition errors,
print partition number in the message.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Apr 18 22:40:15 2000 UTC (24 years, 1 month ago) by kjell
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.24: +3 -2 lines
Diff to previous 1.24 (colored)

Favor BIOS geometry over physical. This should fix MANY problems with
hard drives >8G sharing partitions with other operating systems.
Also, support extended partition type 0x0F, which is quite common now.

Revision 1.24 / (download) - annotate - [select for diffs], Fri Feb 4 18:09:36 2000 UTC (24 years, 4 months ago) by kjell
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23 (colored)

Max Sectors is 63. ok weingart@

Revision 1.23 / (download) - annotate - [select for diffs], Sat Jan 8 04:51:16 2000 UTC (24 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.22: +3 -1 lines
Diff to previous 1.22 (colored)

support LBA-mapped extended partitions too; sigh@kuzirabekon.econ.nagasaki-u.ac.jp

Revision 1.22 / (download) - annotate - [select for diffs], Sat Aug 21 22:49:25 1999 UTC (24 years, 9 months ago) by niklas
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

MIPS boxes that use fdisk need an MS-DOS partition

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jun 10 22:38:01 1999 UTC (25 years ago) by pjanzen
Branch: MAIN
Changes since 1.20: +4 -3 lines
Diff to previous 1.20 (colored)

Handle PAGER in a manner consistent with the Single Unix Specification:
that is, use PAGER rather than "more" if it is defined and non-null, not
just if it is defined.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Sep 14 03:54:34 1998 UTC (25 years, 9 months ago) by rahnds
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.19: +19 -35 lines
Diff to previous 1.19 (colored)

Since on the powerpc, the system does not supply the user with
bios valid cyl,head,sector information (the information comes from the
sd driver) I have made some changes to fdisk to do the following.

Allow the powerpc to specify values larger than the bios limits.

All platforms now have code that will translate the LBA values
in the mbr into CHS values according to the disk geometry.
This occurs if the start and ending CHS values have been stored as
0xffffff.

If writing to the disk and one of the values of a partition violates
the bios limits, it writes the requested values in the LBA fields ,
and stores 0xffffff for the starting and ending CHS values.

This should not change the default formatting of any existing system
other than the CHS and LBA values should always match given the detected
geometry of the disk.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Sep 8 11:03:15 1998 UTC (25 years, 9 months ago) by pefo
Branch: MAIN
Changes since 1.18: +11 -1 lines
Diff to previous 1.18 (colored)

For powerpc's we want to keep the preinstalled msdos partition in the init
MBR when doing a 'fdisk -i'. That is because the msdos partition is used
for booting. The OpenBSD part (part 3) is set up to be the rest of the
disk. Also the msdos partition is set as the 'active' partition.

Revision 1.18 / (download) - annotate - [select for diffs], Sat Aug 8 05:27:59 1998 UTC (25 years, 10 months ago) by downsj
Branch: MAIN
Changes since 1.17: +2 -1 lines
Diff to previous 1.17 (colored)

Include signal.h so that it compiles.

Revision 1.17 / (download) - annotate - [select for diffs], Fri Aug 7 21:49:18 1998 UTC (25 years, 10 months ago) by millert
Branch: MAIN
Changes since 1.16: +3 -1 lines
Diff to previous 1.16 (colored)

protect against SIGPIPE

Revision 1.16 / (download) - annotate - [select for diffs], Sun Jan 4 23:57:29 1998 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.15: +7 -7 lines
Diff to previous 1.15 (colored)

fix maximal cyl/heads; vons@usa.net

Revision 1.15 / (download) - annotate - [select for diffs], Tue Dec 23 23:52:58 1997 UTC (26 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.14: +3 -3 lines
Diff to previous 1.14 (colored)

swap exit and quit

Revision 1.14 / (download) - annotate - [select for diffs], Tue Oct 21 22:49:32 1997 UTC (26 years, 7 months ago) by provos
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.13: +8 -3 lines
Diff to previous 1.13 (colored)

make fdisk grok extended partitions again. we have to keep track of the
absolute offset of the current mbr and its relative position. because:
the starting sector of the first mbr entry in an extended partition is relative
to the starting offset of the whole mbr itself. the starting offset of a new
extended partition is relative to the offset of the very first extended
partition.

Revision 1.13 / (download) - annotate - [select for diffs], Sun Oct 19 23:58:50 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.12: +4 -2 lines
Diff to previous 1.12 (colored)

when we reinit, show what we did

Revision 1.12 / (download) - annotate - [select for diffs], Sun Oct 19 23:37:25 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.11: +2 -2 lines
Diff to previous 1.11 (colored)

spelling

Revision 1.11 / (download) - annotate - [select for diffs], Sun Oct 19 23:33:54 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.10: +2 -2 lines
Diff to previous 1.10 (colored)

clarify

Revision 1.10 / (download) - annotate - [select for diffs], Sun Oct 19 23:29:35 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.9: +42 -42 lines
Diff to previous 1.9 (colored)

indent

Revision 1.9 / (download) - annotate - [select for diffs], Sun Oct 19 23:13:48 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +2 -1 lines
Diff to previous 1.8 (colored)

for p, print disk info too

Revision 1.8 / (download) - annotate - [select for diffs], Sat Oct 18 11:52:32 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.7: +5 -3 lines
Diff to previous 1.7 (colored)

constrain edit mode to size of BIOS part of disk; sorry

Revision 1.7 / (download) - annotate - [select for diffs], Thu Oct 16 10:35:05 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.6: +20 -1 lines
Diff to previous 1.6 (colored)

new command: manual

Revision 1.6 / (download) - annotate - [select for diffs], Thu Oct 16 01:47:08 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.5: +67 -32 lines
Diff to previous 1.5 (colored)

a bunch of improvements by weingart & I

Revision 1.5 / (download) - annotate - [select for diffs], Sat Oct 4 00:09:51 1997 UTC (26 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.4: +7 -12 lines
Diff to previous 1.4 (colored)

do not ask for confirmation in write

Revision 1.4 / (download) - annotate - [select for diffs], Thu Oct 2 14:58:30 1997 UTC (26 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.3: +5 -1 lines
Diff to previous 1.3 (colored)

do not whine if user quits without mods

Revision 1.3 / (download) - annotate - [select for diffs], Tue Sep 30 00:07:25 1997 UTC (26 years, 8 months ago) by mickey
Branch: MAIN
Changes since 1.2: +40 -39 lines
Diff to previous 1.2 (colored)

don't say 'dirty' if nothing is changed actually

Revision 1.2 / (download) - annotate - [select for diffs], Mon Sep 29 23:33:32 1997 UTC (26 years, 8 months ago) by mickey
Branch: MAIN
Changes since 1.1: +1 -2 lines
Diff to previous 1.1 (colored)

ID in the first line w/ tabs

Revision 1.1 / (download) - annotate - [select for diffs], Mon Sep 29 22:58:14 1997 UTC (26 years, 8 months ago) by weingart
Branch: MAIN

New fdisk code with interactive (command line type)
editing code.  Rewrite from the ground up, save about
20 lines of code.  Seems to create valid partition
tables on i386 and alphas.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.