History log of /openbsd/sbin/fdisk/misc.h (Results 1 – 25 of 50)
Revision Date Author Comments
# 2ad00dad 25-Mar-2023 krw <krw@openbsd.org>

Move LINEBUFSZ to be with its friends in misc.h.

Nuke unused HELPBUFSZ.

No functional change.


# 2bf8667b 20-Apr-2022 krw <krw@openbsd.org>

Wrap a long line.


# a66d82b0 20-Apr-2022 krw <krw@openbsd.org>

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_t

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.

show more ...


# c4fc5564 25-Oct-2021 krw <krw@openbsd.org>

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


# 3e9b7d6b 13-Sep-2021 krw <krw@openbsd.org>

disk.dk_size can't be 0 as we errx() if that happens during
DISK_open(). So eliminate pointless check when printing geometry.

Replace unit_lookup() with units_size(), reducing four
conversion dances

disk.dk_size can't be 0 as we errx() if that happens during
DISK_open(). So eliminate pointless check when printing geometry.

Replace unit_lookup() with units_size(), reducing four
conversion dances to one. Return pointer to the unit_type used in
the conversion. unit_types[] is now needed only in misc.c.

Fewer variables make for cleaner logic.

No intentional functional change.

show more ...


# 1629ab0b 12-Sep-2021 krw <krw@openbsd.org>

Stop taking detour through unit_types[SECTORS] to find
dl.d_secsize.

Leave unit_types[SECTORS].ut_conversion at 0, and test that to
determine if a size needs to be converted from a sectors value.

U

Stop taking detour through unit_types[SECTORS] to find
dl.d_secsize.

Leave unit_types[SECTORS].ut_conversion at 0, and test that to
determine if a size needs to be converted from a sectors value.

Use consistent dance to find the desired size value to print.

Logic is clearer, unit_types[] is now const, nobody but misc.c
knows about SECTORS.

No intentional functional change.

show more ...


# 7696a120 28-Aug-2021 krw <krw@openbsd.org>

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.


# 9930d3aa 24-Aug-2021 krw <krw@openbsd.org>

A couple more Capt. Obvious comments can go.


# 380d744d 24-Aug-2021 krw <krw@openbsd.org>

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 whitesp

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().

show more ...


# 12deea29 15-Aug-2021 krw <krw@openbsd.org>

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 func

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.

show more ...


# 58c4c3e5 12-Aug-2021 krw <krw@openbsd.org>

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
scanni

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.

show more ...


# 859be6c9 12-Jul-2021 krw <krw@openbsd.org>

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

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.

show more ...


# 543185b3 11-Jul-2021 krw <krw@openbsd.org>

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

No functional change.


# eccd34eb 11-Jul-2021 krw <krw@openbsd.org>

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

No functional change.


# bf95c6fd 20-Jun-2021 krw <krw@openbsd.org>

Make -b available to architectures other than amd64 and i386.

Extend the syntax to allow the boot partition offset and boot
partition type to be specified if needed.

ok deraadt@ kettenis@


# 0c1b030f 10-Jun-2021 krw <krw@openbsd.org>

Toss in 'const' for the parameters to string_to_utf16le() and
utf16le_to_string().

No functional change.


# b87d3542 07-May-2021 krw <krw@openbsd.org>

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


# 684c1592 21-Nov-2015 krw <krw@openbsd.org>

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

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@

show more ...


# 72070960 12-Nov-2015 krw <krw@openbsd.org>

Avoid problems with pathological input during edit operations. i.e. never
attempt to use data past the end of the input.

Since the return value of ask_cmd() is never checked, make it void instead
of

Avoid problems with pathological input during edit operations. i.e. never
attempt to use data past the end of the input.

Since the return value of ask_cmd() is never checked, make it void instead
of int.

Problems found, original diff from and ok tim@.

show more ...


# fba7235c 26-Oct-2015 krw <krw@openbsd.org>

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


# c2348643 30-Mar-2015 krw <krw@openbsd.org>

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


# e6bc9b7a 29-Mar-2015 krw <krw@openbsd.org>

Rename MBR_readsector() and MBR_writesector() to just readsector()
and writesector(). Move them to misc.[ch]. Soon to be used for more
than MBR reading/writing.

No intentional functional change.


# 9c0a0199 28-Mar-2015 krw <krw@openbsd.org>

Add a simple crc32() implmentation to avoid pulling in libz, which
would complicate install media. Will be used by GPT support.


# dc8e2282 26-Mar-2015 krw <krw@openbsd.org>

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 a

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.

show more ...


# 07147536 26-Mar-2015 krw <krw@openbsd.org>

Allow input/printing/conversion of terabyte sizes. Which GPT partitons
will eventually be able to use.


12