OpenBSD CVS

CVS log for src/sbin/fdisk/part.h


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.47 / (download) - annotate - [select for diffs], Sun May 21 17:29:33 2023 UTC (12 months, 2 weeks ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, HEAD
Changes since 1.46: +4 -4 lines
Diff to previous 1.46 (colored)

If an MBR partition start or end can be represented by CHS, set
both CHS and LBA values in the MBR partition.

Restores pre-7.0 initialization of MBR partition start/end, using
slightly less opaque code that retains the slightly different
initialization required by GPT protective MBR's.

Fixes booting from disks >8G on systems where the BIOS uses CHS.

Encountered by Paul de Weerd on his Alix.2 using BIOS 0.99.

Much diagnosis and testing by Paul of various iterations. Thanks!

Revision 1.46 / (download) - annotate - [select for diffs], Wed May 17 12:59:37 2023 UTC (12 months, 3 weeks ago) by krw
Branch: MAIN
Changes since 1.45: +3 -3 lines
Diff to previous 1.45 (colored)

Make function and symmetry obvious by renaming PRT_make() to
PRT_prt_to_dp() and PRT_parse() to PRT_dp_to_prt().

No functional change.

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

Refactor and simplify GPT menu selection logic.

No intentional functional change.

Revision 1.44 / (download) - annotate - [select for diffs], Fri Apr 7 14:42:51 2023 UTC (14 months ago) by krw
Branch: MAIN
Changes since 1.43: +2 -2 lines
Diff to previous 1.43 (colored)

Add helper functions find_mbr_desc() and find_gpt_desc() to allow
checking mbr_type[N].mt_desc and gpt_type[N].gt_desc before using
name on menu when printing out partition tables.

Tweak logic in find_mbr_type() and find_gpt_type() to be a bit
more paranoid.

Tweak function/variable names to be more in line to usage.

No functional change as all mt_desc and gt_desc are currently
NULL.

Revision 1.43 / (download) - annotate - [select for diffs], Fri Mar 31 13:11:41 2023 UTC (14 months, 1 week ago) by krw
Branch: MAIN
Changes since 1.42: +3 -3 lines
Diff to previous 1.42 (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.42 / (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.41: +3 -3 lines
Diff to previous 1.41 (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.41 / (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.40: +3 -3 lines
Diff to previous 1.40 (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.40 / (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.39: +3 -3 lines
Diff to previous 1.39 (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.39 / (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.38: +2 -2 lines
Diff to previous 1.38 (colored)

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

No functional change.

Revision 1.38 / (download) - annotate - [select for diffs], Sun May 8 18:01:23 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.37: +1 -2 lines
Diff to previous 1.37 (colored)

Rename gt_protected field of struct gpt_type to gt_attr and
#define GTATTR_PROTECT and GTATTR_PROTECT_EFISYS as bits in it.

Use GTATTR_PROTECT to replace the magic value of '1' indicating
the partition is protected. Use GTATTR_PROTECT_EFISYS to replace
hack of checking for "APFS" string in the names of partitions
that want the EFI System (a.k.a. 0xEF) partition to be preserved.

More flexible and easier to extend protections to new partition
types or add new attributes to partition types.

No intentional functional change.

Revision 1.37 / (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.36: +4 -4 lines
Diff to previous 1.36 (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.36 / (download) - annotate - [select for diffs], Mon Mar 14 17:11:44 2022 UTC (2 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.35: +2 -1 lines
Diff to previous 1.35 (colored)

Abstract duplicated code scanning gpt_types[] into a helper
function find_gpt_type().

Use find_gpt_type() to simplify the functions obtaining
information from gpt_types[]. Add not yet used
PRT_uuid_to_protection() to allow simplification of GPT partition
protection code..

No intentional functional change.

Revision 1.35 / (download) - annotate - [select for diffs], Mon Mar 14 14:31:23 2022 UTC (2 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.34: +2 -2 lines
Diff to previous 1.34 (colored)

And the prototype too.

Revision 1.34 / (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.33: +8 -6 lines
Diff to previous 1.33 (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.33 / (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.32: +1 -4 lines
Diff to previous 1.32 (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.32 / (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.31: +3 -2 lines
Diff to previous 1.31 (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.31 / (download) - annotate - [select for diffs], Mon Oct 25 13:51:25 2021 UTC (2 years, 7 months ago) by krw
Branch: MAIN
Changes since 1.30: +1 -6 lines
Diff to previous 1.30 (colored)

Nuke a bunch of pointless #ifndef _<.h file>/#endif guards.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Sep 2 18:07:45 2021 UTC (2 years, 9 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.29: +3 -2 lines
Diff to previous 1.29 (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.29 / (download) - annotate - [select for diffs], Sun Jul 18 21:40:13 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

Don't save the prt_scyl/prt_ecyl values, change them, use them
and then restore them. Just change/use the saved values and skip
the restoring.

Allows PRT_make() to add 'const' to its struct mbr parameter, and
thus allows MBR_make() to add 'const' to its struct mbr
parameter.

No intentional functional change.

Revision 1.28 / (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.27: +5 -4 lines
Diff to previous 1.27 (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.27 / (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.26: +9 -9 lines
Diff to previous 1.26 (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.26 / (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.25: +7 -7 lines
Diff to previous 1.25 (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.25 / (download) - annotate - [select for diffs], Sun Jul 11 13:23:18 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.24: +15 -15 lines
Diff to previous 1.24 (colored)

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.

Revision 1.24 / (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.23: +2 -1 lines
Diff to previous 1.23 (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.23 / (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.22: +1 -2 lines
Diff to previous 1.22 (colored)

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

No functional change.

Revision 1.22 / (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.21: +5 -5 lines
Diff to previous 1.21 (colored)

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

Revision 1.21 / (download) - annotate - [select for diffs], Thu Nov 26 08:15:07 2015 UTC (8 years, 6 months ago) by tim
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, 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, OPENBSD_6_2_BASE, OPENBSD_6_2, OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0, OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.20: +3 -2 lines
Diff to previous 1.20 (colored)

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

Revision 1.20 / (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.19: +3 -1 lines
Diff to previous 1.19 (colored)

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

Revision 1.19 / (download) - annotate - [select for diffs], Thu Mar 26 14:08:12 2015 UTC (9 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (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.18 / (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.17: +4 -4 lines
Diff to previous 1.17 (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.17 / (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.16: +11 -20 lines
Diff to previous 1.16 (colored)

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

With the permission of Toby.

ok deraadt@

Revision 1.16 / (download) - annotate - [select for diffs], Tue Mar 25 12:59:03 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7, OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.15: +4 -3 lines
Diff to previous 1.15 (colored)

Use 'struct dos_partition' variable to access 'struct dos_partition'
data. Since all the fields but 2 that are specially handled are
u_int8_t's there should be no danger from alignment issues.

ok dlg@

Revision 1.15 / (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.14: +1 -4 lines
Diff to previous 1.14 (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.14 / (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.13: +8 -8 lines
Diff to previous 1.13 (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.13 / (download) - annotate - [select for diffs], Tue Aug 3 09:22:03 2004 UTC (19 years, 10 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, 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, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.12: +5 -5 lines
Diff to previous 1.12 (colored)

Handle geometry parameters as unsigned quantities, getting rid of negative
number of sectors on large disks and other similar problems.

ok toby@ tom@ deraadt@

Revision 1.12 / (download) - annotate - [select for diffs], Tue Jul 13 06:00:33 2004 UTC (19 years, 11 months ago) by tom
Branch: MAIN
Changes since 1.11: +3 -3 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Tue Jun 3 01:13:19 2003 UTC (21 years ago) by weingart
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.10: +1 -6 lines
Diff to previous 1.10 (colored)

Nuke terms 3 & 4.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:34 2002 UTC (22 years, 3 months ago) by millert
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.9: +8 -8 lines
Diff to previous 1.9 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.9 / (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.8: +2 -2 lines
Diff to previous 1.8 (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.8 / (download) - annotate - [select for diffs], Sun Aug 12 12:03:01 2001 UTC (22 years, 10 months ago) by heko
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.7: +2 -2 lines
Diff to previous 1.7 (colored)

#(endif|else) foo is incorrect, make it #endif /* foo */
deraadt@ ok

Revision 1.7 / (download) - annotate - [select for diffs], Fri May 18 07:15:18 2001 UTC (23 years ago) by mickey
Branch: MAIN
Changes since 1.6: +2 -2 lines
Diff to previous 1.6 (colored)

a few harmless cleanups

Revision 1.6 / (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_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (colored)

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

Revision 1.5 / (download) - annotate - [select for diffs], Mon Sep 14 03:54:35 1998 UTC (25 years, 9 months ago) by rahnds
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (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.4 / (download) - annotate - [select for diffs], Tue Oct 21 22:49:35 1997 UTC (26 years, 7 months ago) by provos
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (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.3 / (download) - annotate - [select for diffs], Thu Oct 16 01:47:12 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
Changes since 1.2: +2 -1 lines
Diff to previous 1.2 (colored)

a bunch of improvements by weingart & I

Revision 1.2 / (download) - annotate - [select for diffs], Mon Sep 29 23:33:40 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:19 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.