History log of /openbsd/sbin/fdisk/cmd.c (Results 26 – 50 of 180)
Revision Date Author Comments
# ad6c5e72 18-Apr-2022 krw <krw@openbsd.org>

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

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.

show more ...


# 351f0068 16-Mar-2022 krw <krw@openbsd.org>

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

No intentional functional change.


# 5550db08 15-Mar-2022 krw <krw@openbsd.org>

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
pos

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.

show more ...


# 530f0457 04-Feb-2022 krw <krw@openbsd.org>

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


# 77392607 04-Feb-2022 krw <krw@openbsd.org>

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

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.

show more ...


# 45d8ccde 27-Jan-2022 krw <krw@openbsd.org>

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

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.

show more ...


# d91eaccc 22-Jan-2022 krw <krw@openbsd.org>

Wrap some long lines.


# 7b70791f 21-Jan-2022 krw <krw@openbsd.org>

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.


# 2908d0dd 21-Oct-2021 krw <krw@openbsd.org>

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


# 6c51fc53 10-Sep-2021 krw <krw@openbsd.org>

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

No intentional functional change.


# 711fb9d5 09-Sep-2021 krw <krw@openbsd.org>

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.


# 5308a554 02-Sep-2021 krw <krw@openbsd.org>

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' M

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@

show more ...


# ede3ff43 01-Sep-2021 krw <krw@openbsd.org>

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

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.

show more ...


# 7a671688 29-Aug-2021 krw <krw@openbsd.org>

Nuke unused variable and unnecessary initialization.


# 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.


# 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 ...


# 3395d9ad 07-Aug-2021 krw <krw@openbsd.org>

Nuke a few Capt. Obvious comments.


# f43a9f23 06-Aug-2021 krw <krw@openbsd.org>

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

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@

show more ...


# a3a83fc4 21-Jul-2021 krw <krw@openbsd.org>

A couple of missed 'const'.


# dfcac45e 21-Jul-2021 krw <krw@openbsd.org>

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

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.

show more ...


# e79775db 19-Jul-2021 krw <krw@openbsd.org>

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

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.

show more ...


# 140f8401 17-Jul-2021 krw <krw@openbsd.org>

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.


# 206308cc 17-Jul-2021 krw <krw@openbsd.org>

Nuke a bunch of Capt. Obvious or misleading comments.

No functional change.


12345678