OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.33 / (download) - annotate - [select for diffs], Mon Apr 25 17:10:09 2022 UTC (2 years, 1 month ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, HEAD
Changes since 1.32: +3 -4 lines
Diff to previous 1.32 (colored)

Push DISK_[read|write]sectors() down to disk.c local functions
and expose new DISK_[read|write]bytes() functions.

Eliminates many bytes <-> sector i/o dances and makes the code
much easier to understand.

Be a bit more careful to consistently write only bytes that
checksums are calculated over.

No intentional functional change.

Revision 1.32 / (download) - annotate - [select for diffs], Mon Oct 25 13:51:25 2021 UTC (2 years, 7 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.31: +1 -6 lines
Diff to previous 1.31 (colored)

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

Revision 1.31 / (download) - annotate - [select for diffs], Mon Jul 26 13:05:14 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0
Changes since 1.30: +4 -3 lines
Diff to previous 1.30 (colored)

Report write() and ioctl() errors encountered when writing GPT or MBR to disk.

Consolidate GPT/MBR read()/write() operations into DISK_writesectors() and
DISK_readsectors(), producing clearer logic and consistent handling of i/o and
errors.

Add some DPRINTF() and #ifdef DEBUG sections to allow more detailed error
reporting when desired.

Revision 1.30 / (download) - annotate - [select for diffs], Fri Jul 16 13:26:04 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Be consistent and always return -1 to indicate failure.

DISK_printgeometry() return value was always 0 and never
checked so just make it void.

No functional change.

Revision 1.29 / (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.28: +2 -1 lines
Diff to previous 1.28 (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.28 / (download) - annotate - [select for diffs], Thu Jul 15 21:23:54 2021 UTC (2 years, 10 months ago) by krw
Branch: MAIN
Changes since 1.27: +2 -2 lines
Diff to previous 1.27 (colored)

Consolidate disk geometry fiddling, turning -l/-c/-h/-s values into MBR
partition geometry info, into DISK_open(). Resulting in clearer logic.

No intentional functional change.

Revision 1.27 / (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.26: +3 -3 lines
Diff to previous 1.26 (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.26 / (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.25: +4 -4 lines
Diff to previous 1.25 (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.25 / (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.24: +7 -7 lines
Diff to previous 1.24 (colored)

Add 'dk_' prefix to struct disk field names.

No functional change.

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

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

No functional change.

Revision 1.23 / (download) - annotate - [select for diffs], Fri Jun 25 19:24:53 2021 UTC (2 years, 11 months ago) by krw
Branch: MAIN
Changes since 1.22: +4 -1 lines
Diff to previous 1.22 (colored)

Replace instances of the magic number '64' with a nice #define
BLOCKALIGNMENT. This will make it more obvious where this
512-byte block count could/should be converted to a disk sector
count.

No functional change.

Revision 1.22 / (download) - annotate - [select for diffs], Fri May 7 22:15:13 2021 UTC (3 years 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], Sat Dec 12 02:49:50 2015 UTC (8 years, 5 months ago) by krw
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: +2 -2 lines
Diff to previous 1.20 (colored)

Open disk READONLY if none of i, e or u are specified.

Suggestion, original diff and ok naddy@

Revision 1.20 / (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.19: +6 -6 lines
Diff to previous 1.19 (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.19 / (download) - annotate - [select for diffs], Mon Mar 30 17:11:49 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 -1 lines
Diff to previous 1.18 (colored)

Even better -- readsector() and writesector() become DISK_readsector() and
DISK_writesector() and live in disk.[ch].

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 -3 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], Mon Mar 17 16:40:00 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: +1 -3 lines
Diff to previous 1.15 (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.15 / (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.14: +6 -11 lines
Diff to previous 1.14 (colored)

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

Revision 1.14 / (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.13: +11 -6 lines
Diff to previous 1.13 (colored)

Revert last -- broke building snaps.

Revision 1.13 / (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.12: +6 -11 lines
Diff to previous 1.12 (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.12 / (download) - annotate - [select for diffs], Fri Mar 7 21:56:13 2014 UTC (10 years, 2 months ago) by krw
Branch: MAIN
Changes since 1.11: +9 -9 lines
Diff to previous 1.11 (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.11 / (download) - annotate - [select for diffs], Wed Jun 30 22:53:41 2010 UTC (13 years, 11 months ago) by krw
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
Changes since 1.10: +3 -1 lines
Diff to previous 1.10 (colored)

Make 'fdisk -i' start the OpenBSD partition on a power of 2 512-byte
block boundary. In most modern (i.e. 'faked' geometry) situations
this will start it at (0-based) block[64] rather than block[63] as
now. This should help performance on disks which really have 4K
sectors but report 512-byte sectors.

Power of 2 idea from deraadt@.

ok toby@ deraadt@

Revision 1.10 / (download) - annotate - [select for diffs], Sun Feb 8 18:03:18 2009 UTC (15 years, 3 months ago) by krw
Branch: MAIN
CVS Tags: OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5
Changes since 1.9: +1 -3 lines
Diff to previous 1.9 (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.9 / (download) - annotate - [select for diffs], Thu Apr 26 22:42:11 2007 UTC (17 years, 1 month ago) by krw
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
Changes since 1.8: +1 -2 lines
Diff to previous 1.8 (colored)

Eliminate CPU_BIOS from userland and wd(4) by always using the BIOS
geometry in the disklabel when there is a BIOS geometry to provide.
This removes the option to set a disklabel to 'BIOS' geometry via the
'g b' command in the editor.

Makes reported geometry more consistant and moves MD code to MD land
where it should be.

Doc help from jmc@, Feedback from millert@, marco@, weingart@,
kettenis@.

ok deraadt@

Revision 1.8 / (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_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.7: +5 -5 lines
Diff to previous 1.7 (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.7 / (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.6: +1 -6 lines
Diff to previous 1.6 (colored)

Nuke terms 3 & 4.

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

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

Revision 1.3 / (download) - annotate - [select for diffs], Thu Oct 16 01:47:10 1997 UTC (26 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, 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, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.2: +3 -2 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:34 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:15 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.