Age | Commit message (Collapse) | Author |
|
ok krw@
|
|
|
|
When reading disk size/geometry from disklabel, clamp disk size to
the maximum number of cylinders that fit into UINT32_MAX sectors.
Don't just use the bottom 32 bits of the DL_GETDSIZE(). Warn that
truncation has been done.
|
|
capablity by using help text as regular prompt for 'size' and
'offset'. Try to detect and handle more overflow/underflow conditions
in getuint() and ensure returned value is always within requested
bounds. Handle zero-length partitions by treating them as UNUSED.
tested & ok halex@
|
|
is now superflous. With rounding gone the offset parameter is
similarly superfluous. Simply getuint() accordingly.
|
|
units handling by copying getuint() from disklabel. MBR partition id
and disklabel partition type are different beasts. So deciding to
round off a MBR partition with id FS_BSDFFS meant rounding off
NTFS partitions. And FS_SWAP partitions meant DOS FAT 12. So just
nuke rounding off for now to simplify getuint().
ok beck@
|
|
partition numbers.
|
|
are thus avoided. Since bounds are now reliable don't check the
returned value for being in-bounds. Since default value is
forced inside bounds, don't bother being tricky and passing a
default that is outside the bounds being specified.
ok beck@
|
|
are all constants. Independantly suggested by guenther@.
|
|
ask_num() function. Remove now unneeded 'flags' and 'help' parameters
from both. Display out of range values in hex in ask_pid(), since
we are seeking hex input.
ok guenther@
|
|
duplicating the code. Allows simplification of the EDIT() #define
in Xedit() since we always ASK_DEC and use a NULL help parameter when
invoking ask_num().
|
|
A #define to simplify a function calling snippet does not simply or
help when it is used only once.
|
|
strtonum(). Make related error messages consistant.
ok haesbaert@
|
|
messages consistant. Check for valid partition when 'select'ing a
partition.
ok haesbaert@
|
|
more than one OpenBSD partition.
ok deraadt
|
|
cylinder. If there is only one head but multiple cylinders reserve
one cylinder. Prevents nonsense MBR being created on scsi attached
floppies, which have a 'geometry' of 1/1/2888. No change to less
pathological cases.
|
|
errno string. Since we are err()'ing out, don't worry about closing
MBR fd first.
|
|
length of 0. And anyway PRT_fix_CHS() writes garbage when length
is zero.
Refresh the in-memory copy to reflect any data that was written
out, so you can see that your changes have taken effect.
Surprise behaviours noted by matthew@ at c2k11.
|
|
place it was missing. Delete now redundant calls to DIOCGDINFO when
getting physical disk info in disklabel(8) and fdisk(8).
Reminded by a fdisk discussion with Andres Perera on tech@.
ok deraadt@
|
|
discussed with lots of people, tested by naddy@,
"move fast" deraadt@
|
|
And files can be smaller (e.g. 512 bytes like /usr/mdec/mbr) than
a disk sector (e.g. 4096 bytes on pirofti's external disk drive).
So relax the length test on the read() result to < DEV_BSIZE (the
amount of data we actually want) instead of < secsize (the minimum
size that read() will accept).
'fdisk -e' and 'fdisk -i' now work on devices with sector sizes
greater than DEV_BSIZE.
|
|
did not successfully read. Tweak some casts.
Fixes infinite loop problem noted by jeremy@ while installing on
boxen with 'random' garbage in MBR. General loop detection may
follow post-4.9.
Tested by jeremy@ and ok miod@
|
|
|
|
by and diff from Roberth via tech@.
ok jmc@
|
|
OpenBSD MBR partition does not span from sector 1 after MBR partition
data is re-initialized.
written with lot of good advice from deraadt@ and jmc@
ok deraadt@
|
|
returning a magic value that is not even handled as such by the caller
ok krw@
|
|
that value, print an error message and repost the question
ok krw@ deraadt@
|
|
block boundary. In most modern (i.e. 'faked' geometry) situations
this will start it at (0-based) block[64] rather than block[63] as
now. This should help performance on disks which really have 4K
sectors but report 512-byte sectors.
Power of 2 idea from deraadt@.
ok toby@ deraadt@
|
|
from disklabel(8), since it describes the effect of using opendev()
|
|
this version after some feedback from krw and otto;
ok otto krw
|
|
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include
<sys/dkio.h> to the places that actually want and use the disk
ioctls.
this became an issue when krw@'s X build failed when he was testing
a change to dkio.h.
tested by krw@
help from and ok miod@
|
|
|
|
from krw and myself;
ok deraadt krw
|
|
requested by miod@; ok miod@ krw@
|
|
a -DHAVE_MBR diff after release)
|
|
as neither arrayified not arrayfied exist -- sanctioned dictionaries
like Merriam-Webster ones suggest a few alternatives (e.g., arrayed),
however these made up words are easy to understand and we are not
certain that current ones are not ok.
ok jmc@
|
|
|
|
|
|
frantisek holop pointing out the issue. ok deraadt@
|
|
will show as NTFS in fdisk output.
ok todd@ otto@ deraadt@
|
|
- clarify the terms geometry sectors field and start field
- change the fdisk prompt from 0 to 1, and explain its meaning
- temper CAVEATS: the note is "common practice", not mandatory
from nick and myself
|
|
ok otto@ beck@
|
|
the multi-line banner announcing that the MBR is being changed.
Also the listing of the partition table in 'fdisk -u'. Display a
consistant message when the MBR is written.
While here cleanup and shrink code without changing any semantics.
Started with a diff posted on tech@ by Tobias Ulmer.
"I like it" marco@ ok jsing@
|
|
e.g. "0.5g".
|
|
returning an error, just reprompt. If there is an error reading
from stdin, use the old (default) value.
Shrinks fdisk a few bytes!
OK deraadt.
|
|
|
|
ok nick
|
|
on modern disk geometries; while here, better alignment of column labels
ok jmc@, jsing@, krw@, and otto@
|
|
ok jmc@
|
|
ok jmc@
|