#
adf35c80 |
| 25-Apr-2022 |
krw <krw@openbsd.org> |
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 unders
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.
show more ...
|
#
f2b37346 |
| 10-Oct-2021 |
krw <krw@openbsd.org> |
No need to assign dl.d_nsectors to disk.dk_sectors twice.
Two statements on one line may have seemed clever but now it's just confusing.
No functional change.
|
#
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 ...
|
#
18c9df1d |
| 07-Aug-2021 |
krw <krw@openbsd.org> |
Nuke unneeded #include's, one param.h -> types.h.
|
#
605b5690 |
| 26-Jul-2021 |
krw <krw@openbsd.org> |
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
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.
show more ...
|
#
17bb819e |
| 22-Jul-2021 |
krw <krw@openbsd.org> |
Tweak some err() verbiage.
|
#
62d4fabc |
| 19-Jul-2021 |
krw <krw@openbsd.org> |
Revert incorrect tweaks to disk geometry calculations and non '-b' MBR disk initialization.
Detected by bluhm@'s ever vigilant regress testing.
|
#
206308cc |
| 17-Jul-2021 |
krw <krw@openbsd.org> |
Nuke a bunch of Capt. Obvious or misleading comments.
No functional change.
|
#
39351f7a |
| 16-Jul-2021 |
krw <krw@openbsd.org> |
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.
|
#
199eafea |
| 15-Jul-2021 |
krw <krw@openbsd.org> |
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 st
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.
show more ...
|
#
f9336ec7 |
| 15-Jul-2021 |
krw <krw@openbsd.org> |
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.
|
#
0cd9e2af |
| 13-Jul-2021 |
krw <krw@openbsd.org> |
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 passi
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.
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 ...
|
#
4d10198c |
| 12-Jul-2021 |
krw <krw@openbsd.org> |
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.
|
#
33e90638 |
| 12-Jul-2021 |
krw <krw@openbsd.org> |
Add 'dk_' prefix to struct disk field names.
No functional change.
|
#
8c10a749 |
| 11-Jul-2021 |
krw <krw@openbsd.org> |
Add tabs to make variable declarations easier to read.
No functional change.
|
#
2a536aa2 |
| 11-Jul-2021 |
krw <krw@openbsd.org> |
'return' is not a function call.
No functional change.
|
#
b87d3542 |
| 07-May-2021 |
krw <krw@openbsd.org> |
Replace random mix of u_int* and uint* types with consistent uint* types.
|
#
6316a812 |
| 26-Apr-2018 |
guenther <guenther@openbsd.org> |
Prefer <fcntl.h> over <sys/fcntl.h> in userland While here, delete some extra #includes and apply style(9) sort rules.
ok deraadt@ krw@ mpi@
|
#
0a9d837b |
| 09-Mar-2016 |
krw <krw@openbsd.org> |
Accept only character special devices rather than generating a core dump on the attempt to get a disklabel from a regular file.
Regular files have not been acceptable as the 'disk' for some time, an
Accept only character special devices rather than generating a core dump on the attempt to get a disklabel from a regular file.
Regular files have not been acceptable as the 'disk' for some time, and pledging changed the consequences from a somewhat obscure error message to an abort().
Issue discovered by espie@.
ok natano@
show more ...
|
#
1803853c |
| 12-Dec-2015 |
krw <krw@openbsd.org> |
Open disk READONLY if none of i, e or u are specified.
Suggestion, original diff and ok naddy@
|
#
31eae13b |
| 01-Dec-2015 |
krw <krw@openbsd.org> |
Fix inexplicable use of 'disk' instead of 'disk.name' when trying to print the disk's name in an error message.
|
#
729290c0 |
| 19-Nov-2015 |
krw <krw@openbsd.org> |
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
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
show more ...
|
#
c4a7c6b7 |
| 14-Nov-2015 |
krw <krw@openbsd.org> |
Since -l is ignored if -c/-h/-s are specified, make that combination invalid and mention the constraint in usage(). Modify the appropriate field(s) of the global 'disk' as -l/-c/-h/-s are encountered
Since -l is ignored if -c/-h/-s are specified, make that combination invalid and mention the constraint in usage(). Modify the appropriate field(s) of the global 'disk' as -l/-c/-h/-s are encountered. As a result use the disklabel information to populate the global 'disk' only when it has not already been populated. Move test for 'disk' validity into DISK_open().
show more ...
|