#
1.99 |
|
31-Jul-2019 |
krw |
Allow sbBlkCount to be less than the number of physical sectors on the disk.
Fixes dealing with MacOS 9.2.2 formatted disk, allowing dual boot again.
Problem reported and fix tested by Donovan Watteau on his B&W G3. Thanks!
|
Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
|
#
1.98 |
|
01-Feb-2016 |
krw |
Un-shorten some lines that don't need breaking anymore. Remove a couple of indent levels by shuffling code bit.
|
#
1.97 |
|
31-Jan-2016 |
krw |
Nuke pointless map field 'physical_block' and just use 'sbBlkSize' which is set to the same value.
|
#
1.96 |
|
31-Jan-2016 |
krw |
Use delete_entry()/create_entry() in delete_partition_from_map() instead of trying to be clever and tweaking the existing entry into a free space entry by manual manipulation of the fields.
|
#
1.95 |
|
31-Jan-2016 |
krw |
Fold add_data_to_map() into create_entry() as the former is always called immediately after the latter, manipulating fields in the same structure.
Use create_entry() in create_partition() rather than doing the same actions manually.
|
#
1.94 |
|
31-Jan-2016 |
krw |
Don't use add_data_to_map() when reading from disk, since it resets some of the dpme_ fields, overwriting data from disk.
Add some paranoia checks for map limits when reading from disk.
|
#
1.93 |
|
31-Jan-2016 |
krw |
Just call contains_driver() when you need to know rather than carrying a flag around. More obviously current data. Nuke unnecessary variables when displaying a partition.
|
#
1.92 |
|
31-Jan-2016 |
krw |
Apple sets lblock_start and lblocks to 0 in free space entries. Do the same.
Don't use lblock_start or lblocks in calculation for length@base display. We no longer display lblock info there.
|
#
1.91 |
|
30-Jan-2016 |
krw |
Move last three lines (#define's) from dpme.h to partition_map.h and tweak #include's as necessary.
|
#
1.90 |
|
30-Jan-2016 |
krw |
Fold struct dpme into struct entry. Same reasons as for folding struct block0 into struct partition_map. Easier to read code.
|
#
1.89 |
|
30-Jan-2016 |
krw |
Refactor add_partition_to_map() to be simpler if perhaps less performance optimized. New logic will simplify merging struct dpme into struct entry.
|
#
1.88 |
|
30-Jan-2016 |
krw |
There is not much to do if we run out of memory, so simply exit if a malloc() or calloc() fails. Simplifies a bunch of logic, makes add_data_to_map() always succeed or exit, so make it a void.
|
#
1.87 |
|
29-Jan-2016 |
krw |
Fold struct block0 into struct partition map. There can be only one and read/write_block0() can move the data from/to disk to/from appropriate fields anywhere. Removes a bunch of dereferencing, malloc'ing and pointer checking.
|
#
1.86 |
|
29-Jan-2016 |
krw |
Warn of partitions extending past the end of the media.
|
#
1.85 |
|
29-Jan-2016 |
krw |
Shorter names means a few whitespace adjustments.
|
#
1.84 |
|
29-Jan-2016 |
krw |
Rename struct partition_map_header to struct partition_map. No change to .o files.
|
#
1.83 |
|
29-Jan-2016 |
krw |
Rename struct partition_map to struct entry. No change to .o files.
|
#
1.82 |
|
29-Jan-2016 |
krw |
Conform to Apple Mac OS X's behaviour of setting dpme_flags on free partitions to 0, and setting them to VALID | ALLOCATED on the map partition.
|
#
1.81 |
|
29-Jan-2016 |
krw |
Conform to Apple Mac OS X's behaviour of not giving 'Apple_Free' partitions a name. Nuke kFreeName.
|
#
1.80 |
|
28-Jan-2016 |
krw |
Flip base_order to a LIST().
|
#
1.79 |
|
28-Jan-2016 |
krw |
Delete a bunch of Morris dancing in delete_partition_from_map(). No need to create a new dpme. Just rename/retype the existing and let combine_entry() suck in any surrounding empty space partitions.
|
#
1.78 |
|
28-Jan-2016 |
krw |
Hand rolled lists suck. First, replace disk_order with an LIST.
|
#
1.77 |
|
28-Jan-2016 |
krw |
Oops. Deleted one too many lines. Need to advance pointer when traversing list.
|
#
1.76 |
|
28-Jan-2016 |
krw |
When adding a new partition to the map, use only existing mapped space. Don't try to create new free space partitions to use. If the map does not know about all of the space on the disk, it is broken.
|
#
1.75 |
|
28-Jan-2016 |
krw |
Since we don't allow maps to be created or opened with an invalid block0, there is no point in checking later if block0 has magically become invalid.
|
#
1.74 |
|
28-Jan-2016 |
krw |
Use consistent 'return' idiom -- no parenthesis since that was the style of the existing code.
|
#
1.73 |
|
28-Jan-2016 |
krw |
Make 'r' (reorder, a.k.a. swap) command work with any two existing partitions. Do NOT allow partition 1 to be moved!
|
#
1.72 |
|
27-Jan-2016 |
krw |
Traverse next_by_base when checking maps coverage, not next_on_disk!
|
#
1.71 |
|
27-Jan-2016 |
krw |
We do not support logical_block != physical_block. Remove logical_block field and left over code that checks for logical != physical.
Removes confusion with dmpe fields lblock_start and lblocks, which have nothing to do with block sizes! lblock_start is the block offset within the partition where the data actually starts. and lblocks is the number of blocks of data within the partition. Both are in units of *physical blocks*, a.k.a. disk sectors.
|
#
1.70 |
|
27-Jan-2016 |
krw |
Check block 0 signature, physical block size and physical block count when reading partition map.
Check for unmapped physical blocks and overlapping partitions when reading partition map.
No need for duplicate checks in validate_map(), so remove validate.c from build and 'v' command from code and docs.
|
#
1.69 |
|
27-Jan-2016 |
krw |
Nuke another (and I hope final) batch of superfluous '{}' around single statements.
|
#
1.68 |
|
26-Jan-2016 |
krw |
dpme_name and dpme_type are NUL-terminated in Apple code, so use strlcpy() to fill them.
They are also supposed to be NUL-padded so zap previous contents before copying in possibly shorter new values.
|
#
1.67 |
|
26-Jan-2016 |
krw |
Whitespace, line wrapping fixes. Nuke many superfluous '{}' around single statements. 0 -> NULL for pointer checks.
|
#
1.66 |
|
26-Jan-2016 |
krw |
Whitespace, line wrapping fixes.
|
#
1.65 |
|
26-Jan-2016 |
krw |
Simplify logic of read_partition_map(), junking retries with various sizes of logical block. Rely on read_dpme() to do the correct thing.
|
#
1.64 |
|
25-Jan-2016 |
krw |
Use new read/write_block0 and read/write_dpme which handle any endian or alignment issues forcefully. Removes need for convert_* functions so unhook convert.c from build. read/write_block become static functions inside file_media.c.
Tweak struct block0 to stop trying to handle alignment issues by clever declaration. Rely on the new functions to accurately translate between on-disk and in-memory layouts.
Enables pdisk to work on amd64 and likely other architectures if it's ever desirable. Does bring back DEV_BSIZE to pdisk.c since the in-memory structure will *not* be 512 bytes on other archs.
|
#
1.63 |
|
24-Jan-2016 |
krw |
Whitespace.
|
#
1.62 |
|
24-Jan-2016 |
krw |
Nuke get_align_long() and put_align_long() #define's. They don't do anything according to gcc & cmp.
cmp suggested by & ok stefan@.
|
#
1.61 |
|
24-Jan-2016 |
krw |
Whitespace fixes.
|
#
1.60 |
|
24-Jan-2016 |
krw |
Delete duplicated line that was setting sbBlkCount to 0; Score one for the 'v' command!
|
#
1.59 |
|
23-Jan-2016 |
krw |
Nuke unused kPatchType. Nuke kStringNot and use " not' where needed. Nuke kStringEmpty and use "" where needed. Nuke unused static 'g'.
Eliminate #include's in *.h files.
Some whitespace fixes.
|
#
1.58 |
|
23-Jan-2016 |
krw |
Pass the disk sector size to open_partition_map(), eliminating it's internal need for DEV_BSIZE. Ditto create_partition_map().
malloc((sizeof(struct [block0|dpme])) instead of malloc(DEV_BSIZE).
Remove another #include <param.h>.
|
#
1.57 |
|
23-Jan-2016 |
krw |
Add comments to ensure future spelunkers realize that struct block0 and struct dpme must be 512-bytes long at the moment.
Use this fact to avoid using DEV_BSIZE and thus replace #include <param.h> with #include <types.h> in pdisk.c.
Constrain media size to UINT32_MAX, the actual limit, instead of LONG_MAX, which could be way more on some theoretical future arch running pdisk. And do the constraint inside open_partition_map().
|
#
1.56 |
|
23-Jan-2016 |
krw |
Avoid double prompt after creating default map on startup.
|
#
1.55 |
|
23-Jan-2016 |
krw |
Flip read_block() and write_block() back to taking sector addresses instead of off_t values. Do the DEV_BSIZE multiplication in these two functions.
Easier to read code and kills two #include <sys/param.h>.
Kill unused label.
|
#
1.54 |
|
23-Jan-2016 |
krw |
map->block0 is always allocated or the map is discarded.
So stop checking for NULL. Nuke get_block_zero() and just use map->block0.
|
#
1.53 |
|
23-Jan-2016 |
krw |
Nuke sync_device_size() and do it's one-field-update in coerce_block0(), right after we read/allocate media->block0. Doing sync *before* media->block0 is allocated is bad.
The map->physical_block is initialized correctly and never to the magic number '1'. So just use map-physical_block to initialize sbBlkSize.
|
#
1.52 |
|
23-Jan-2016 |
krw |
Always initialize media_size to provided mediasz in open_partition_map().
|
#
1.51 |
|
23-Jan-2016 |
krw |
Break annoying long line.
|
#
1.50 |
|
22-Jan-2016 |
krw |
Change partition map field 'data' to 'dmpe'. Change 'create_data' to 'create_dmpe'. Sweep up some 'struct dpme *data' to struct dpme *dpme'.
|
#
1.49 |
|
22-Jan-2016 |
krw |
Rename map field 'misc' to 'block0' since that's what it is.
|
#
1.48 |
|
22-Jan-2016 |
krw |
Lost a fix for one invocation of write_block() in diff juggling. It takes an off_t offset, not a disk address, for now.
|
#
1.47 |
|
22-Jan-2016 |
krw |
Merge read_block() and read_file_media() into read_block(). Ditto write_block() and write_file_media(). One layer of read/write wrappers for pread/pwrite should be enough for anyone.
|
#
1.46 |
|
22-Jan-2016 |
krw |
Repair creation of initial partition table on a blank disk, broken when hoisting file operations and ioctl to main(). Pass media size to open_partition_map() and create_partition_map() so they can properly initialize a map.
|
#
1.45 |
|
22-Jan-2016 |
krw |
In the "why use two variables when one would do" category, eliminate the 'written' field and just use the 'changed' field to mediate when it is appropriate to ask whether changes should be discarded.
|
#
1.44 |
|
22-Jan-2016 |
krw |
Nuke 'expert' mode and the enabling, undocumented, '-d' flag by just making all the commands available all the time. Document the newly available commands.
Remove the former 'P' command (list partitions in base address order) and use 'P' from expert mode (show map data structures).
Stop accepting uppercase aliases for commands documented as lower case.
Bring the 'h' help text and man pages into agreement.
ok jasper@ millert@
|
#
1.43 |
|
21-Jan-2016 |
krw |
Hoist all file opening and ioctl calls into main(), passing a pointer to a valid map to edit(). Should enable pledging a la fdisk at some point.
Since edit() always gets a valid map (and maintains its validity even when 'I'nitializing a new one) many checks for (map == NULL) are junked.
Remove some dances around block sizes by using DEV_BSIZE everywhere since we don't support non-DEV_BSIZE (a.k.a. 512-byte) sectors.
Remove many superfluous #include statements.
|
#
1.42 |
|
21-Jan-2016 |
krw |
Nuke 'writable' field now that it is always in sync with 'rflag'. Since (!rflag && writable == 0) can't be true remove those warning blocks and simply leave the not-writable warning when attempting to write the map. Always show 'w' in the help and rely on the check and warning in do_write_partition_map() so the user always gets a message.
|
#
1.41 |
|
21-Jan-2016 |
krw |
Don't try to be cute by silently opening a disk read-only when R/W access was requested. Just complain when the R/W open fails. Make failure messages consistent.
|
#
1.40 |
|
18-Jan-2016 |
krw |
struct file_media had 1 field left. And one place where struct file_media was actually stored. So move the last field (fd) into the place formerly used to store pointer to the instance. As a result we can just pass fd's around rather than pointers to a struct containing a fd.
close_file_media() becomes empty but for a close(). So just use close() and nuke close_file_media().
|
#
1.39 |
|
18-Jan-2016 |
krw |
os_reload_file_media() doesn't do anything except tell you if you passed it a NULL pointer. And the result is ignored. Nuke it. This removes the only use of the 'regular_file' field of struct file_media. So nuke that too.
|
#
1.38 |
|
18-Jan-2016 |
krw |
Run indent(1) over it and tweak the results a bit manually to look more KNF'ish.
|
#
1.37 |
|
18-Jan-2016 |
krw |
Remove a grab bag of unused #define's, fields, enum's, variables, functions.
|
#
1.36 |
|
17-Jan-2016 |
krw |
Change "//" comments to "/**/". Nuke really stupid ones.
|
#
1.35 |
|
17-Jan-2016 |
krw |
Reduce namespace pollution by eliminating parameter names from forward declarations.
|
#
1.34 |
|
17-Jan-2016 |
krw |
Kill leading, imbedded, trailing whitespace.
|
#
1.33 |
|
17-Jan-2016 |
krw |
Remove a bunch of ridiculous and uninformative comments like "// Defines".
|
#
1.32 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification concludes with u32 -> uint32_t. And a bunch of consequent printf() format corrections.
|
#
1.31 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues.
partition_map -> struct partition_map partition_map_header -> struct partition_map_header
|
#
1.30 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. DDMap -> struct ddmap.
|
#
1.29 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. Block0 -> struct block0.
|
#
1.28 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. DPME -> struct dpme.
|
#
1.27 |
|
17-Jan-2016 |
krw |
Let the great de-typedef'ification begin. MEDIA -> struct file_media *.
|
#
1.26 |
|
17-Jan-2016 |
krw |
A/UX is no more, was m68k only, and we have no sentimental reasons for keeping support.
|
#
1.25 |
|
17-Jan-2016 |
jasper |
- tidy up a bunch of #if's for code that has been either enabled or disabled since forever, or not relevant at all (e.g. some bits for A/UX support) - remove commented code that has never been compiled, etc
ok krw@
|
#
1.24 |
|
16-Jan-2016 |
krw |
Move last field (size_in_bytes) in struct media to struct file_media and replace MEDIA with FILE_MEDIA everywhere. media.h becomes unused.
|
#
1.23 |
|
16-Jan-2016 |
krw |
There can be only one. 'grain' that is. i.e. DEV_BSIZE. No need to track or store. Just use.
No functional change.
|
#
1.22 |
|
16-Jan-2016 |
krw |
Start peeling away excess layers of abstraction.
Since 'file' is the only kind of media, no need to call the appropriate functions via pointers. Just call the _file_ variants directly. Nuke the fields do_read(), do_write(), do_close(), do_os_reload() and the functions read_media(), write_media(), close_media() and os_reload_media().
No functional change.
|
#
1.21 |
|
16-Jan-2016 |
krw |
Nuke support for 1024- and 2048-byte sector devices. Error out if anything other than 512-byte sectors are encountered. Unlink deblock_media.c from the build.
ok jasper@
|
#
1.20 |
|
15-Jan-2016 |
krw |
We don't need yet another alias for DEV_BSIZE. Use DEV_BSIZE and nuke PBLOCK_SIZE and another unused #define.
|
#
1.19 |
|
15-Jan-2016 |
krw |
Replace bitfield_get() and bitfield_set() abstraction with simple masking operations since all the uses but 1 are for 1 bit fields. No functional change intended.
Unhook bitfield.c from build.
|
#
1.18 |
|
14-Jan-2016 |
krw |
Don't include hfs_misc.h, which no longer contains anything of use.
|
#
1.17 |
|
14-Jan-2016 |
krw |
Nuke 'HFS_name' field which was not referenced now other than setting it and freeing it. Unhook hfs_misc.c from build since it now longer contains anything being used.
|
#
1.16 |
|
12-Jan-2016 |
krw |
Use normal err/errx/warn/warnx rather than handrolling new ones. Move usage() to pdisk.c and nuke do_help() and '-h'.
ok jasper@ deraadt@
|
#
1.15 |
|
12-Jan-2016 |
krw |
Retire '-i', a poorly documented interactive mode that tries to mimic the 20th century MacOS version of pdisk more closely than the usual interactive editor. One set of commands is enough for anyone.
ok jasper@
|
#
1.14 |
|
12-Jan-2016 |
krw |
Since we use the disklabel size info we are always in 'device size mode' and '-c' and the '-d' command to toggle cflag are pointless since cflag is never examined.
|
#
1.13 |
|
11-Jan-2016 |
krw |
open_pathname_as_media() simply called open_file_as_media() which takes the same parameters and returns the same value. Nuke open_pathname_as_media() and call open_file_as_media() directly.
Nothing else from pathname.[ch] is used so remove them from build in preparation for moving them to the attic.
ok deraadt@
|
#
1.12 |
|
11-Jan-2016 |
krw |
Remove '-v' and related version handling. Use strncasecmp() instead of handrolled local istrncmp(). No need to compile util.c anymore.
ok deraadt@ jasper@
|
#
1.11 |
|
11-Jan-2016 |
jasper |
trailing whitespace
|
#
1.10 |
|
11-Jan-2016 |
jasper |
add rcs ids
|
#
1.9 |
|
10-Jan-2016 |
krw |
Use the normal method for determining a disk size. i.e. use the device's default disklabel. Don't spew i/o's at the disk to find the largest address that works, displaying many a 'read failed' message along the way.
Problem noted by Brian Conway on bugs@ and jasper@.
ok jasper@
|
#
1.8 |
|
20-Aug-2015 |
deraadt |
<stdlib.h> is included, so do not need to cast result from malloc, calloc, realloc* ok krw millert
|
Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.7 |
|
08-Aug-2012 |
jsg |
remove mac68k leftovers ok miod@ mpi@ deraadt@ martin@
|
Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.6 |
|
29-Apr-2006 |
martin |
With last pdisk and full functionality for mac68k now in place, start cleaning the maze of ifdef's not relevant for us.
This round wipes most linux and/or MacOS-only bits, more to come.
|
#
1.5 |
|
27-Apr-2006 |
martin |
update for pdisk 0.8a2, from NetBSD, retaining our local changes; summing it up:
- Clean up sources - fix naming, delete old email addresses - Added support for display of Mac volume names - Fix block 0 display to show logical offset of drivers - Require confirmation of quit without write - Fix iteration to not complain about missing devices - Warn when creating/writing a map with more than 15 entries
and, most important, add do_update_dpme() which allows us to partition OpenBSD slices without previous MacOS setup.
Tested with shared MacOS install on macppc, procedure there remains the same.
grammer and spelling help and ok jmc@
ok miod@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.4 |
|
02-Dec-2004 |
miod |
Default to A/UX partition type for OpenBSD newly created partitions on mac68k. ok drahn@
|
Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
|
#
1.3 |
|
09-Jun-2002 |
todd |
rm trailing whitespace
|
Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.2 |
|
12-Oct-2001 |
drahn |
New feature for pdisk, change the type of a parition. Useful since that is part of the OpenBSD/macppc installation procedure. Code by Alexander Guy, examined by drahn@ ok deraadt@
|
#
1.1 |
|
24-Mar-2001 |
drahn |
branches: 1.1.1; Initial revision
|
Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
|
#
1.98 |
|
01-Feb-2016 |
krw |
Un-shorten some lines that don't need breaking anymore. Remove a couple of indent levels by shuffling code bit.
|
#
1.97 |
|
31-Jan-2016 |
krw |
Nuke pointless map field 'physical_block' and just use 'sbBlkSize' which is set to the same value.
|
#
1.96 |
|
31-Jan-2016 |
krw |
Use delete_entry()/create_entry() in delete_partition_from_map() instead of trying to be clever and tweaking the existing entry into a free space entry by manual manipulation of the fields.
|
#
1.95 |
|
31-Jan-2016 |
krw |
Fold add_data_to_map() into create_entry() as the former is always called immediately after the latter, manipulating fields in the same structure.
Use create_entry() in create_partition() rather than doing the same actions manually.
|
#
1.94 |
|
31-Jan-2016 |
krw |
Don't use add_data_to_map() when reading from disk, since it resets some of the dpme_ fields, overwriting data from disk.
Add some paranoia checks for map limits when reading from disk.
|
#
1.93 |
|
31-Jan-2016 |
krw |
Just call contains_driver() when you need to know rather than carrying a flag around. More obviously current data. Nuke unnecessary variables when displaying a partition.
|
#
1.92 |
|
31-Jan-2016 |
krw |
Apple sets lblock_start and lblocks to 0 in free space entries. Do the same.
Don't use lblock_start or lblocks in calculation for length@base display. We no longer display lblock info there.
|
#
1.91 |
|
30-Jan-2016 |
krw |
Move last three lines (#define's) from dpme.h to partition_map.h and tweak #include's as necessary.
|
#
1.90 |
|
30-Jan-2016 |
krw |
Fold struct dpme into struct entry. Same reasons as for folding struct block0 into struct partition_map. Easier to read code.
|
#
1.89 |
|
30-Jan-2016 |
krw |
Refactor add_partition_to_map() to be simpler if perhaps less performance optimized. New logic will simplify merging struct dpme into struct entry.
|
#
1.88 |
|
30-Jan-2016 |
krw |
There is not much to do if we run out of memory, so simply exit if a malloc() or calloc() fails. Simplifies a bunch of logic, makes add_data_to_map() always succeed or exit, so make it a void.
|
#
1.87 |
|
29-Jan-2016 |
krw |
Fold struct block0 into struct partition map. There can be only one and read/write_block0() can move the data from/to disk to/from appropriate fields anywhere. Removes a bunch of dereferencing, malloc'ing and pointer checking.
|
#
1.86 |
|
29-Jan-2016 |
krw |
Warn of partitions extending past the end of the media.
|
#
1.85 |
|
29-Jan-2016 |
krw |
Shorter names means a few whitespace adjustments.
|
#
1.84 |
|
29-Jan-2016 |
krw |
Rename struct partition_map_header to struct partition_map. No change to .o files.
|
#
1.83 |
|
29-Jan-2016 |
krw |
Rename struct partition_map to struct entry. No change to .o files.
|
#
1.82 |
|
29-Jan-2016 |
krw |
Conform to Apple Mac OS X's behaviour of setting dpme_flags on free partitions to 0, and setting them to VALID | ALLOCATED on the map partition.
|
#
1.81 |
|
29-Jan-2016 |
krw |
Conform to Apple Mac OS X's behaviour of not giving 'Apple_Free' partitions a name. Nuke kFreeName.
|
#
1.80 |
|
28-Jan-2016 |
krw |
Flip base_order to a LIST().
|
#
1.79 |
|
28-Jan-2016 |
krw |
Delete a bunch of Morris dancing in delete_partition_from_map(). No need to create a new dpme. Just rename/retype the existing and let combine_entry() suck in any surrounding empty space partitions.
|
#
1.78 |
|
28-Jan-2016 |
krw |
Hand rolled lists suck. First, replace disk_order with an LIST.
|
#
1.77 |
|
28-Jan-2016 |
krw |
Oops. Deleted one too many lines. Need to advance pointer when traversing list.
|
#
1.76 |
|
28-Jan-2016 |
krw |
When adding a new partition to the map, use only existing mapped space. Don't try to create new free space partitions to use. If the map does not know about all of the space on the disk, it is broken.
|
#
1.75 |
|
28-Jan-2016 |
krw |
Since we don't allow maps to be created or opened with an invalid block0, there is no point in checking later if block0 has magically become invalid.
|
#
1.74 |
|
28-Jan-2016 |
krw |
Use consistent 'return' idiom -- no parenthesis since that was the style of the existing code.
|
#
1.73 |
|
28-Jan-2016 |
krw |
Make 'r' (reorder, a.k.a. swap) command work with any two existing partitions. Do NOT allow partition 1 to be moved!
|
#
1.72 |
|
27-Jan-2016 |
krw |
Traverse next_by_base when checking maps coverage, not next_on_disk!
|
#
1.71 |
|
27-Jan-2016 |
krw |
We do not support logical_block != physical_block. Remove logical_block field and left over code that checks for logical != physical.
Removes confusion with dmpe fields lblock_start and lblocks, which have nothing to do with block sizes! lblock_start is the block offset within the partition where the data actually starts. and lblocks is the number of blocks of data within the partition. Both are in units of *physical blocks*, a.k.a. disk sectors.
|
#
1.70 |
|
27-Jan-2016 |
krw |
Check block 0 signature, physical block size and physical block count when reading partition map.
Check for unmapped physical blocks and overlapping partitions when reading partition map.
No need for duplicate checks in validate_map(), so remove validate.c from build and 'v' command from code and docs.
|
#
1.69 |
|
27-Jan-2016 |
krw |
Nuke another (and I hope final) batch of superfluous '{}' around single statements.
|
#
1.68 |
|
26-Jan-2016 |
krw |
dpme_name and dpme_type are NUL-terminated in Apple code, so use strlcpy() to fill them.
They are also supposed to be NUL-padded so zap previous contents before copying in possibly shorter new values.
|
#
1.67 |
|
26-Jan-2016 |
krw |
Whitespace, line wrapping fixes. Nuke many superfluous '{}' around single statements. 0 -> NULL for pointer checks.
|
#
1.66 |
|
26-Jan-2016 |
krw |
Whitespace, line wrapping fixes.
|
#
1.65 |
|
26-Jan-2016 |
krw |
Simplify logic of read_partition_map(), junking retries with various sizes of logical block. Rely on read_dpme() to do the correct thing.
|
#
1.64 |
|
25-Jan-2016 |
krw |
Use new read/write_block0 and read/write_dpme which handle any endian or alignment issues forcefully. Removes need for convert_* functions so unhook convert.c from build. read/write_block become static functions inside file_media.c.
Tweak struct block0 to stop trying to handle alignment issues by clever declaration. Rely on the new functions to accurately translate between on-disk and in-memory layouts.
Enables pdisk to work on amd64 and likely other architectures if it's ever desirable. Does bring back DEV_BSIZE to pdisk.c since the in-memory structure will *not* be 512 bytes on other archs.
|
#
1.63 |
|
24-Jan-2016 |
krw |
Whitespace.
|
#
1.62 |
|
24-Jan-2016 |
krw |
Nuke get_align_long() and put_align_long() #define's. They don't do anything according to gcc & cmp.
cmp suggested by & ok stefan@.
|
#
1.61 |
|
24-Jan-2016 |
krw |
Whitespace fixes.
|
#
1.60 |
|
24-Jan-2016 |
krw |
Delete duplicated line that was setting sbBlkCount to 0; Score one for the 'v' command!
|
#
1.59 |
|
23-Jan-2016 |
krw |
Nuke unused kPatchType. Nuke kStringNot and use " not' where needed. Nuke kStringEmpty and use "" where needed. Nuke unused static 'g'.
Eliminate #include's in *.h files.
Some whitespace fixes.
|
#
1.58 |
|
23-Jan-2016 |
krw |
Pass the disk sector size to open_partition_map(), eliminating it's internal need for DEV_BSIZE. Ditto create_partition_map().
malloc((sizeof(struct [block0|dpme])) instead of malloc(DEV_BSIZE).
Remove another #include <param.h>.
|
#
1.57 |
|
23-Jan-2016 |
krw |
Add comments to ensure future spelunkers realize that struct block0 and struct dpme must be 512-bytes long at the moment.
Use this fact to avoid using DEV_BSIZE and thus replace #include <param.h> with #include <types.h> in pdisk.c.
Constrain media size to UINT32_MAX, the actual limit, instead of LONG_MAX, which could be way more on some theoretical future arch running pdisk. And do the constraint inside open_partition_map().
|
#
1.56 |
|
23-Jan-2016 |
krw |
Avoid double prompt after creating default map on startup.
|
#
1.55 |
|
23-Jan-2016 |
krw |
Flip read_block() and write_block() back to taking sector addresses instead of off_t values. Do the DEV_BSIZE multiplication in these two functions.
Easier to read code and kills two #include <sys/param.h>.
Kill unused label.
|
#
1.54 |
|
23-Jan-2016 |
krw |
map->block0 is always allocated or the map is discarded.
So stop checking for NULL. Nuke get_block_zero() and just use map->block0.
|
#
1.53 |
|
23-Jan-2016 |
krw |
Nuke sync_device_size() and do it's one-field-update in coerce_block0(), right after we read/allocate media->block0. Doing sync *before* media->block0 is allocated is bad.
The map->physical_block is initialized correctly and never to the magic number '1'. So just use map-physical_block to initialize sbBlkSize.
|
#
1.52 |
|
23-Jan-2016 |
krw |
Always initialize media_size to provided mediasz in open_partition_map().
|
#
1.51 |
|
23-Jan-2016 |
krw |
Break annoying long line.
|
#
1.50 |
|
22-Jan-2016 |
krw |
Change partition map field 'data' to 'dmpe'. Change 'create_data' to 'create_dmpe'. Sweep up some 'struct dpme *data' to struct dpme *dpme'.
|
#
1.49 |
|
22-Jan-2016 |
krw |
Rename map field 'misc' to 'block0' since that's what it is.
|
#
1.48 |
|
22-Jan-2016 |
krw |
Lost a fix for one invocation of write_block() in diff juggling. It takes an off_t offset, not a disk address, for now.
|
#
1.47 |
|
22-Jan-2016 |
krw |
Merge read_block() and read_file_media() into read_block(). Ditto write_block() and write_file_media(). One layer of read/write wrappers for pread/pwrite should be enough for anyone.
|
#
1.46 |
|
22-Jan-2016 |
krw |
Repair creation of initial partition table on a blank disk, broken when hoisting file operations and ioctl to main(). Pass media size to open_partition_map() and create_partition_map() so they can properly initialize a map.
|
#
1.45 |
|
22-Jan-2016 |
krw |
In the "why use two variables when one would do" category, eliminate the 'written' field and just use the 'changed' field to mediate when it is appropriate to ask whether changes should be discarded.
|
#
1.44 |
|
22-Jan-2016 |
krw |
Nuke 'expert' mode and the enabling, undocumented, '-d' flag by just making all the commands available all the time. Document the newly available commands.
Remove the former 'P' command (list partitions in base address order) and use 'P' from expert mode (show map data structures).
Stop accepting uppercase aliases for commands documented as lower case.
Bring the 'h' help text and man pages into agreement.
ok jasper@ millert@
|
#
1.43 |
|
21-Jan-2016 |
krw |
Hoist all file opening and ioctl calls into main(), passing a pointer to a valid map to edit(). Should enable pledging a la fdisk at some point.
Since edit() always gets a valid map (and maintains its validity even when 'I'nitializing a new one) many checks for (map == NULL) are junked.
Remove some dances around block sizes by using DEV_BSIZE everywhere since we don't support non-DEV_BSIZE (a.k.a. 512-byte) sectors.
Remove many superfluous #include statements.
|
#
1.42 |
|
21-Jan-2016 |
krw |
Nuke 'writable' field now that it is always in sync with 'rflag'. Since (!rflag && writable == 0) can't be true remove those warning blocks and simply leave the not-writable warning when attempting to write the map. Always show 'w' in the help and rely on the check and warning in do_write_partition_map() so the user always gets a message.
|
#
1.41 |
|
21-Jan-2016 |
krw |
Don't try to be cute by silently opening a disk read-only when R/W access was requested. Just complain when the R/W open fails. Make failure messages consistent.
|
#
1.40 |
|
18-Jan-2016 |
krw |
struct file_media had 1 field left. And one place where struct file_media was actually stored. So move the last field (fd) into the place formerly used to store pointer to the instance. As a result we can just pass fd's around rather than pointers to a struct containing a fd.
close_file_media() becomes empty but for a close(). So just use close() and nuke close_file_media().
|
#
1.39 |
|
18-Jan-2016 |
krw |
os_reload_file_media() doesn't do anything except tell you if you passed it a NULL pointer. And the result is ignored. Nuke it. This removes the only use of the 'regular_file' field of struct file_media. So nuke that too.
|
#
1.38 |
|
18-Jan-2016 |
krw |
Run indent(1) over it and tweak the results a bit manually to look more KNF'ish.
|
#
1.37 |
|
18-Jan-2016 |
krw |
Remove a grab bag of unused #define's, fields, enum's, variables, functions.
|
#
1.36 |
|
17-Jan-2016 |
krw |
Change "//" comments to "/**/". Nuke really stupid ones.
|
#
1.35 |
|
17-Jan-2016 |
krw |
Reduce namespace pollution by eliminating parameter names from forward declarations.
|
#
1.34 |
|
17-Jan-2016 |
krw |
Kill leading, imbedded, trailing whitespace.
|
#
1.33 |
|
17-Jan-2016 |
krw |
Remove a bunch of ridiculous and uninformative comments like "// Defines".
|
#
1.32 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification concludes with u32 -> uint32_t. And a bunch of consequent printf() format corrections.
|
#
1.31 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues.
partition_map -> struct partition_map partition_map_header -> struct partition_map_header
|
#
1.30 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. DDMap -> struct ddmap.
|
#
1.29 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. Block0 -> struct block0.
|
#
1.28 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. DPME -> struct dpme.
|
#
1.27 |
|
17-Jan-2016 |
krw |
Let the great de-typedef'ification begin. MEDIA -> struct file_media *.
|
#
1.26 |
|
17-Jan-2016 |
krw |
A/UX is no more, was m68k only, and we have no sentimental reasons for keeping support.
|
#
1.25 |
|
17-Jan-2016 |
jasper |
- tidy up a bunch of #if's for code that has been either enabled or disabled since forever, or not relevant at all (e.g. some bits for A/UX support) - remove commented code that has never been compiled, etc
ok krw@
|
#
1.24 |
|
16-Jan-2016 |
krw |
Move last field (size_in_bytes) in struct media to struct file_media and replace MEDIA with FILE_MEDIA everywhere. media.h becomes unused.
|
#
1.23 |
|
16-Jan-2016 |
krw |
There can be only one. 'grain' that is. i.e. DEV_BSIZE. No need to track or store. Just use.
No functional change.
|
#
1.22 |
|
16-Jan-2016 |
krw |
Start peeling away excess layers of abstraction.
Since 'file' is the only kind of media, no need to call the appropriate functions via pointers. Just call the _file_ variants directly. Nuke the fields do_read(), do_write(), do_close(), do_os_reload() and the functions read_media(), write_media(), close_media() and os_reload_media().
No functional change.
|
#
1.21 |
|
16-Jan-2016 |
krw |
Nuke support for 1024- and 2048-byte sector devices. Error out if anything other than 512-byte sectors are encountered. Unlink deblock_media.c from the build.
ok jasper@
|
#
1.20 |
|
15-Jan-2016 |
krw |
We don't need yet another alias for DEV_BSIZE. Use DEV_BSIZE and nuke PBLOCK_SIZE and another unused #define.
|
#
1.19 |
|
15-Jan-2016 |
krw |
Replace bitfield_get() and bitfield_set() abstraction with simple masking operations since all the uses but 1 are for 1 bit fields. No functional change intended.
Unhook bitfield.c from build.
|
#
1.18 |
|
14-Jan-2016 |
krw |
Don't include hfs_misc.h, which no longer contains anything of use.
|
#
1.17 |
|
14-Jan-2016 |
krw |
Nuke 'HFS_name' field which was not referenced now other than setting it and freeing it. Unhook hfs_misc.c from build since it now longer contains anything being used.
|
#
1.16 |
|
12-Jan-2016 |
krw |
Use normal err/errx/warn/warnx rather than handrolling new ones. Move usage() to pdisk.c and nuke do_help() and '-h'.
ok jasper@ deraadt@
|
#
1.15 |
|
12-Jan-2016 |
krw |
Retire '-i', a poorly documented interactive mode that tries to mimic the 20th century MacOS version of pdisk more closely than the usual interactive editor. One set of commands is enough for anyone.
ok jasper@
|
#
1.14 |
|
12-Jan-2016 |
krw |
Since we use the disklabel size info we are always in 'device size mode' and '-c' and the '-d' command to toggle cflag are pointless since cflag is never examined.
|
#
1.13 |
|
11-Jan-2016 |
krw |
open_pathname_as_media() simply called open_file_as_media() which takes the same parameters and returns the same value. Nuke open_pathname_as_media() and call open_file_as_media() directly.
Nothing else from pathname.[ch] is used so remove them from build in preparation for moving them to the attic.
ok deraadt@
|
#
1.12 |
|
11-Jan-2016 |
krw |
Remove '-v' and related version handling. Use strncasecmp() instead of handrolled local istrncmp(). No need to compile util.c anymore.
ok deraadt@ jasper@
|
#
1.11 |
|
11-Jan-2016 |
jasper |
trailing whitespace
|
#
1.10 |
|
11-Jan-2016 |
jasper |
add rcs ids
|
#
1.9 |
|
10-Jan-2016 |
krw |
Use the normal method for determining a disk size. i.e. use the device's default disklabel. Don't spew i/o's at the disk to find the largest address that works, displaying many a 'read failed' message along the way.
Problem noted by Brian Conway on bugs@ and jasper@.
ok jasper@
|
#
1.8 |
|
20-Aug-2015 |
deraadt |
<stdlib.h> is included, so do not need to cast result from malloc, calloc, realloc* ok krw millert
|
Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
|
#
1.7 |
|
08-Aug-2012 |
jsg |
remove mac68k leftovers ok miod@ mpi@ deraadt@ martin@
|
Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.6 |
|
29-Apr-2006 |
martin |
With last pdisk and full functionality for mac68k now in place, start cleaning the maze of ifdef's not relevant for us.
This round wipes most linux and/or MacOS-only bits, more to come.
|
#
1.5 |
|
27-Apr-2006 |
martin |
update for pdisk 0.8a2, from NetBSD, retaining our local changes; summing it up:
- Clean up sources - fix naming, delete old email addresses - Added support for display of Mac volume names - Fix block 0 display to show logical offset of drivers - Require confirmation of quit without write - Fix iteration to not complain about missing devices - Warn when creating/writing a map with more than 15 entries
and, most important, add do_update_dpme() which allows us to partition OpenBSD slices without previous MacOS setup.
Tested with shared MacOS install on macppc, procedure there remains the same.
grammer and spelling help and ok jmc@
ok miod@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
|
#
1.4 |
|
02-Dec-2004 |
miod |
Default to A/UX partition type for OpenBSD newly created partitions on mac68k. ok drahn@
|
Revision tags: OPENBSD_3_2_BASE OPENBSD_3_3_BASE OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
|
#
1.3 |
|
09-Jun-2002 |
todd |
rm trailing whitespace
|
Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.2 |
|
12-Oct-2001 |
drahn |
New feature for pdisk, change the type of a parition. Useful since that is part of the OpenBSD/macppc installation procedure. Code by Alexander Guy, examined by drahn@ ok deraadt@
|
#
1.1 |
|
24-Mar-2001 |
drahn |
branches: 1.1.1; Initial revision
|