Age | Commit message (Collapse) | Author |
|
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.
|
|
|
|
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.
|
|
|
|
statements.
|
|
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.
|
|
strlcpy() to fill them.
They are also supposed to be NUL-padded so zap previous contents
before copying in possibly shorter new values.
|
|
statements. 0 -> NULL for pointer checks.
|
|
|
|
of logical block. Rely on read_dpme() to do the correct thing.
|
|
|
|
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.
|
|
|
|
Better comments, make all reserved fields uint8_t arrays, don't
claim uint32_t fields are actually pointers.
|
|
ok krw@
|
|
|
|
anything according to gcc & cmp.
cmp suggested by & ok stefan@.
|
|
|
|
|
|
get_block_n() and removes a whack of pointless static variables.
|
|
for the 'v' command!
|
|
Nuke kStringEmpty and use "" where needed. Nuke unused static 'g'.
Eliminate #include's in *.h files.
Some whitespace fixes.
|
|
always pass kDefault. a.k.a. -1. Nuke kDefault since it is now unused.
Nuke unused #define MAXIOSIZE in passing.
|
|
always pass it '1'.
|
|
internal need for DEV_BSIZE. Ditto create_partition_map().
malloc((sizeof(struct [block0|dpme])) instead of malloc(DEV_BSIZE).
Remove another #include <param.h>.
|
|
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().
|
|
|
|
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.
|
|
So stop checking for NULL. Nuke get_block_zero() and just use
map->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.
|
|
|
|
|
|
to 'create_dmpe'. Sweep up some 'struct dpme *data' to struct dpme
*dpme'.
|
|
said parameter to the new name.
|
|
|
|
|
|
|
|
|
|
|
|
takes an off_t offset, not a disk address, for now.
|
|
write_block() and write_file_media(). One layer of read/write
wrappers for pread/pwrite should be enough for anyone.
|
|
|
|
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.
|
|
the 'written' field and just use the 'changed' field to mediate
when it is appropriate to ask whether changes should be discarded.
|
|
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@
|
|
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.
|
|
(!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.
|
|
access was requested. Just complain when the R/W open fails. Make
failure messages consistent.
|
|
through */ and two variables by simply calling the target functions
with the different parameters.
|
|
get there unless dflag is set. Makes switch() statement easier to grasp.
|