Revision tags: OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
|
#
1.87 |
|
28-May-2016 |
tb |
Remove all the pledge "disklabel" before ioctl DIOCGPDINFO is called in order to avoid a pledge crash with 'pdisk /dev/tty'. Only the pledge "stdio" right after the ioctl remains.
ok krw
|
#
1.86 |
|
27-Apr-2016 |
krw |
Tweak command line processing vs pledge logic to make things nicer. No functional change.
Prodded (a while ago) and ok (recently) deraadt@
|
#
1.85 |
|
09-Mar-2016 |
krw |
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@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.84 |
|
02-Feb-2016 |
krw |
Pledge, based on what's done in fdisk.
|
#
1.83 |
|
31-Jan-2016 |
krw |
Nuke pointless map field 'physical_block' and just use 'sbBlkSize' which is set to the same value.
|
#
1.82 |
|
30-Jan-2016 |
krw |
Move last three lines (#define's) from dpme.h to partition_map.h and tweak #include's as necessary.
|
#
1.81 |
|
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.80 |
|
29-Jan-2016 |
krw |
Add do_dump_map() to make command processing more consistent. Pass 1/0 (a.k.a. vverbose/not verbose) do do_dump_map() to differentiate P/p.
|
#
1.79 |
|
29-Jan-2016 |
krw |
Rename struct partition_map_header to struct partition_map. No change to .o files.
|
#
1.78 |
|
28-Jan-2016 |
krw |
Hand rolled lists suck. First, replace disk_order with an LIST.
|
#
1.77 |
|
28-Jan-2016 |
krw |
Tweak verbiage for 'r' (reorder) command.
|
#
1.76 |
|
27-Jan-2016 |
krw |
Tweak some verbiage.
|
#
1.75 |
|
27-Jan-2016 |
krw |
On-disk partition name/types/processorid may or may not be NUL terminated after all. So add an extra byte for a NUL in the in-memory struct's.
|
#
1.74 |
|
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.73 |
|
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.72 |
|
26-Jan-2016 |
krw |
Rework and simplify string argument parsing. All string arguments are at most DPISTRLEN (32) characters so there is no need for fancy dynamic growing strings. Use a DPISTRLEN long buffer and bail if it fills up.
Rename get_string() to get_dpistr() and get_string_argument() to get_dpstr_argument() to emphasize they will return strings that fit in DPISTRLEN.
Rework & simplify a pair of their consumers - do_rename_partition() and do_change_type() - to be more obviously identitical to each other bar the displayed verbiage.
|
#
1.71 |
|
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.70 |
|
26-Jan-2016 |
krw |
Whitespace, line wrapping fixes. Nuke many superfluous '{}' around single statements. 0 -> NULL for pointer checks.
|
#
1.69 |
|
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.68 |
|
25-Jan-2016 |
jsg |
remove some uneeded includes ok krw@
|
#
1.67 |
|
24-Jan-2016 |
krw |
Nuke more pointless checks for map NULLness.
|
#
1.66 |
|
24-Jan-2016 |
krw |
Whitespace fixes.
|
#
1.65 |
|
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.64 |
|
23-Jan-2016 |
krw |
No need for 'default_value' parameter for get_number_argument() since we always pass kDefault. a.k.a. -1. Nuke kDefault since it is now unused.
Nuke unused #define MAXIOSIZE in passing.
|
#
1.63 |
|
23-Jan-2016 |
krw |
No need for get_string_argument() parameter 'reprompt' since we always pass it '1'.
|
#
1.62 |
|
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.61 |
|
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.60 |
|
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.59 |
|
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.58 |
|
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.57 |
|
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.56 |
|
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.55 |
|
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.54 |
|
19-Jan-2016 |
krw |
Simplify the main command switch, eliminating a couple of /* fall through */ and two variables by simply calling the target functions with the different parameters.
|
#
1.53 |
|
19-Jan-2016 |
krw |
It's pointless to check for 'dflag' inside do_expert(), since you can't get there unless dflag is set. Makes switch() statement easier to grasp.
|
#
1.52 |
|
19-Jan-2016 |
krw |
Remove forward declarations for functions that do not exist.
|
#
1.51 |
|
19-Jan-2016 |
krw |
Bring code into line with man page and usage() by only allowing one disk to be specified on the command line. Nuke dump() function and hoist its few lines into main() as a result.
|
#
1.50 |
|
19-Jan-2016 |
krw |
No need for pdisk(8) to provide a version of hexdump. Remove the "expert" mode 'd'/'D' command and its supporting code.
ok deraadt@ jasper@
|
#
1.49 |
|
18-Jan-2016 |
krw |
The contents of the Apple_Patches partition is none of our business. Stop pretending we care or know what's in there. Remove 'debugging' mode command to examine the partition contents and the supporting code.
ok deraadt@ jasper@
|
#
1.48 |
|
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.47 |
|
18-Jan-2016 |
krw |
Run indent(1) over it and tweak the results a bit manually to look more KNF'ish.
|
#
1.46 |
|
18-Jan-2016 |
krw |
Fold get_options() into main() and eliminate unneeded nFLAG_DEFAULT #defines. Zero is a well known and acceptable number.
|
#
1.45 |
|
18-Jan-2016 |
krw |
Remove a grab bag of unused #define's, fields, enum's, variables, functions.
|
#
1.44 |
|
17-Jan-2016 |
krw |
Change "//" comments to "/**/". Nuke really stupid ones.
|
#
1.43 |
|
17-Jan-2016 |
krw |
Reduce namespace pollution by eliminating parameter names from forward declarations.
|
#
1.42 |
|
17-Jan-2016 |
krw |
Kill leading, imbedded, trailing whitespace.
|
#
1.41 |
|
17-Jan-2016 |
krw |
Remove a bunch of ridiculous and uninformative comments like "// Defines".
|
#
1.40 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues.
partition_map -> struct partition_map partition_map_header -> struct partition_map_header
|
#
1.39 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. Block0 -> struct block0.
|
#
1.38 |
|
17-Jan-2016 |
krw |
The great de-typedef'ification continues. DPME -> struct dpme.
|
#
1.37 |
|
17-Jan-2016 |
krw |
Let the great de-typedef'ification begin. MEDIA -> struct file_media *.
|
#
1.36 |
|
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.35 |
|
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.34 |
|
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.33 |
|
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.32 |
|
14-Jan-2016 |
krw |
Kill unused variable 'lfile'.
|
#
1.31 |
|
14-Jan-2016 |
krw |
Don't include hfs_misc.h, which no longer contains anything of use.
|
#
1.30 |
|
14-Jan-2016 |
krw |
Remove code supporting undocumented and inaccessible flags 'a' (abbreviate partition type names), 'f' (print HFS partition names) and 'kLogicalOption' (obviously a getopt_long() conversion error).
|
#
1.29 |
|
13-Jan-2016 |
krw |
Remove obsolete flags (h, v, i, c) from getopt() call.
No need for 'flags' variable. Just call usage() on unknown options.
|
#
1.28 |
|
12-Jan-2016 |
krw |
The only thing in pdisk.h is an unused #define. So don't include it.
|
#
1.27 |
|
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.26 |
|
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.25 |
|
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.24 |
|
11-Jan-2016 |
krw |
Remove some '-v' leftovers. Pointed out by jasper@.
|
#
1.23 |
|
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.22 |
|
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.21 |
|
11-Jan-2016 |
jasper |
more whitespace was lurking
|
#
1.20 |
|
11-Jan-2016 |
jasper |
add rcs ids
|
#
1.19 |
|
10-Dec-2015 |
mmcc |
Remove NULL-checks before free(). ok tb@
|
#
1.18 |
|
06-Dec-2015 |
tobias |
Use __progname instead of manually handling argv[0].
ok deraadt, mmcc, tedu
|
#
1.17 |
|
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.16 |
|
08-Aug-2012 |
jsg |
remove mac68k leftovers ok miod@ mpi@ deraadt@ martin@
|
Revision tags: OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.15 |
|
25-May-2010 |
deraadt |
use opendev(), as requested in 6373. document this using text borrowed from disklabel(8), and while at it, fix the usage code to not be utterly distasteful ok drahn
|
Revision tags: OPENBSD_4_7_BASE
|
#
1.14 |
|
23-Dec-2009 |
krw |
partion -> partition. First one (mkfs.c) noted by Brad Tilley on tech@.
|
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
|
#
1.13 |
|
12-May-2006 |
martin |
put back original getopt(3) handling lost during the update
|
#
1.12 |
|
11-May-2006 |
martin |
remove a bunch of linux and NeXT defines and, in turn, -D__unix__
|
#
1.11 |
|
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.10 |
|
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.9 |
|
06-Mar-2005 |
cloder |
Check strdup return value for failure. OK miod
|
Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
|
#
1.8 |
|
24-Apr-2003 |
pvalchev |
get rid of incorrectly sized buffer by using asprintf; ok millert
|
#
1.7 |
|
02-Apr-2003 |
deraadt |
snprintf; drahn ok
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.6 |
|
15-Dec-2002 |
henning |
more writable spelling; torh
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.5 |
|
09-Jun-2002 |
todd |
rm trailing whitespace
|
Revision tags: OPENBSD_3_0_BASE OPENBSD_3_1_BASE
|
#
1.4 |
|
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.3 |
|
04-Jun-2001 |
mickey |
return from main() don't exit
|
Revision tags: OPENBSD_2_9_BASE
|
#
1.2 |
|
24-Mar-2001 |
drahn |
Make the apple code compile for OpenBSD. These changes are mostly from maja.
|
#
1.1 |
|
24-Mar-2001 |
drahn |
branches: 1.1.1; Initial revision
|