dsl
4d8b353d15
Put #endif in correct place - fixes PR/42500
...
Update usage() for -A, and rename one of the variables for clarity.
2009-12-23 18:50:40 +00:00
dsl
9193c05dda
Add support for partition being aligned on non-cylinder boundaries.
...
Info can be specified with -A parameter.
Default is based on how the first partition is defined.
For empty disks larger than 128GB (arbitrary figure) use 1MB alignment.
2009-12-22 21:55:12 +00:00
dsl
5cb32d7a27
Editing partitions larger than 1TB works better if 'decimal' returns
...
64 bit integer values!
2009-12-22 21:04:37 +00:00
dsl
795733c59e
Add a large comment about disk geometries.
...
Rename (with #defines) the variables use for aligning partitions to
separate them from the bios geometry.
All in advance of allowing other partition alignments (eg 2048 sectors).
2009-12-20 17:32:09 +00:00
pooka
3d1523b600
Use implicit -F for regular files, much like disklabel(8).
2009-12-17 14:27:49 +00:00
dsl
fb64c309b2
Allow MB, GB and CYL (not just M, G and C) and lower case.
...
Don't output a splurious 'd' before "cyl".
Fixes PR/37414.
Patch in PR is wrong!
2009-11-04 22:25:56 +00:00
dsl
3b8f95158f
Make absence of /usr/mdec/mbr only a warning.
...
Fixes PR/26510
2009-10-31 20:41:00 +00:00
dsl
68a8748cf1
Change arguments to decimal() to be int64_t.
...
They need to be able to hold disk sector numbers > 2^31 and also -1.
Should fix PR/34807
2009-08-05 21:31:50 +00:00
christos
1f751faed6
make this compile one non mbr machines (move #define to the general section)
2009-06-02 21:15:53 +00:00
christos
cb3a6fdee7
Delete GPT partitions if we overwrite with MBR to avoid confusion with disks
...
that have both MBR and a secondary left over GPT partition signature. From
Mike M. Volokhov
2009-06-01 19:57:33 +00:00
drochner
dff56c2587
also fix a comment wrt use of the csysid/cstart/csize vars
2009-04-20 17:06:55 +00:00
sborrill
45a4197562
When using -s flag, read start and size as unsigned to allow for larger
...
disks. (Thanks to drochner@ for catching it).
2009-04-20 15:03:56 +00:00
lukem
428fc016ff
fix sign-compare issues
2009-04-06 12:18:19 +00:00
apb
44f43cf298
Remove local definitions of PRIxxxx macros in favour of the
...
centralised definitions from tools/compat/compat_defs.h, which
are included via nbtool_config.h.
2009-01-18 21:15:14 +00:00
tnn
bc465dcf63
mbr_dsn is unsigned, print it as such.
2008-03-09 14:57:10 +00:00
dsl
7ddd81a137
Add support for mbr code with ascii keycodes
2008-01-25 23:19:10 +00:00
tsutsui
aa7cb7b8f0
- add a sanity check to avoid possible division by zero
...
- adjust sector numbers _after_ "Sanity check the data against all zeroes"
Should close PR bin/37656.
2008-01-20 06:39:31 +00:00
apb
ca6bb6217d
Track zero is not strictly reserved for the BIOS, that's just a
...
convention, so don't make it an error in check_overlap(). Sector 0 is
reserved for the MBR, so make that an error in check_overlap().
2007-12-23 10:43:57 +00:00
apb
49b1fa58d7
Report the first active partition.
2007-12-23 08:58:34 +00:00
apb
29a92a49d4
If the partition is unused, then attempting to decode the PBR would
...
actually decode the MBR from sector 0 of the disk. Don't do it if
v_flag < 3.
2007-12-23 08:14:28 +00:00
dsl
fe8a8005c1
Make this compile without -Wno-pointer-sign
...
(Needs updated bootblock.h)
2007-11-29 23:19:25 +00:00
dsl
0d1f6529aa
Change -F to not use opendisk().
...
Don't change default to the boot volume until after we've found we aren't
doing -F.
For tool-fdisk enforce -F and use #defines to make code that can no
longer possibly execute compile.
2007-11-29 23:02:00 +00:00
apb
02c42d6bae
Remove unwanted ">" from a printed message.
2007-11-18 19:19:00 +00:00
tsutsui
b682074ae4
Don't print Drive serial number if -S (setting shell variables) is specified.
2007-10-28 10:02:08 +00:00
tls
ae75a5cdbe
This program is a host tool, so when we use newfangled C features like
...
PRIxyz we have to ensure it still builds on hosts with Old compilers.
Noticed while building a cross-toolchain on FreeBSD 4.
2007-09-04 00:34:58 +00:00
dsl
4c11bfb2e9
Preserve the mbr 'driver serial number' when copying in the netbsd
...
mbr code. Should leave windows vista bootable.
Print the dsn from the mbr, not each pbr.
2007-07-05 20:30:29 +00:00
christos
7731d9378a
PR/36223: Milos Negovanovic: Don't ask if we want to install mbr_bootselect
...
with -f.
2007-04-26 18:51:00 +00:00
apb
4c9d64d78e
Try to check whether each partition is bootable. If not,
...
always print an error message. If bootable and -v flag was
specified, print a success message. If -v flag was specified
more than once, also try to decode more information from
the PBR.
Input from dsl and bad.
2007-03-10 14:18:28 +00:00
dsl
26ad77c3e1
Report the last sector number of a partition, instead of that of the first
...
of the next - with appropriate discarding of the head/sector values
if the partition is cylinder aligned.
Fixes PR 26921
2006-11-25 16:10:32 +00:00
christos
e5ea88eb01
PR/33633: Yoshito Komatsu: /sbin/fdisk does not work
...
Downgrade error getting heads to a warning.
2006-06-02 17:40:34 +00:00
christos
124bff0089
PR/33522: Peter Bex: Sanity checks to avoid zerodivide.
2006-05-21 16:00:17 +00:00
dsl
df7e187ccb
Appease Coverty CID 7449. Avoid close(-1) in error path.
2006-03-18 08:36:50 +00:00
rumble
e948e1b17f
Check for allocation failures in malloc, calloc, realloc, asprintf, and
...
vasprintf and try to handle them.
2006-03-17 15:53:46 +00:00
dyoung
6c1041b8b7
So that we can build a full-featured fdisk cross-tool with -DBOOTSEL,
...
condition the definition of DEFAULT_BOOTxxx variables and SCAN_xxx
on defined(BOOTSEL), instead of defined(__i386__) || defined(__x86_64__).
While I'm here, only build get_diskname in the same conditions as
get_geometry is built, since only the latter calls the former.
2006-02-14 04:48:15 +00:00
dsl
c28e0ae4af
Byteswap the constant MBR_{BS_}MAGIC throughout, should genetate better code.
...
Except that non all architectures have that optimisation :-(
2006-01-29 12:55:16 +00:00
uwe
39ab40b2aa
PRI* macros should not contain percent sign.
...
While here, conditionalise use of "lld" for PRId64 on HAVE_LONG_LONG.
2005-10-07 23:57:10 +00:00
dogcow
7babc7145c
Fix cross-compilation on FreeBSD 4.x (and other OSes) where PRId64 isn't
...
defined.
2005-10-07 01:04:08 +00:00
uwe
25503c6713
When building as host tool don't include "../../include/util.h".
...
opendisk() declared in that file is not used in this case anyway, and
<util.h> pulls in unwatned includes (e.g. <utmpx.h> doesn't exist on
FreeBSD 4.*).
2005-08-27 22:43:40 +00:00
christos
2c6eadc9ce
Move WARNS=3 to the Makefile.inc, and add a little const to the remaining
...
programs that did not compile before.
2005-06-27 01:00:04 +00:00
dyoung
4580f13f42
Turn fdisk(8) into a host tool. Still todo: commit the host-tool
...
build infrastructure to src/tools/fdisk/.
2005-06-12 19:14:10 +00:00
dyoung
023801f122
For portability, use standard types: s/uint/unsigned int/,
...
s/ulong/unsigned long/, s/u_int8_t/uint8_t/.
2005-06-12 19:06:43 +00:00
dsl
4118385742
Allow partition sizes to be input in GB
2005-04-07 20:23:13 +00:00
xtraeme
784c275927
Remove main() prototype; WARNS=2
2005-01-20 16:01:02 +00:00
wiz
7913b43af5
Fix typo in error message, reported by Nicolas Joly in PR 28347.
2004-11-18 12:00:18 +00:00
christos
fdad6cabc9
Use the 1st element's size as the argument to bsearch.
2004-11-15 21:59:23 +00:00
christos
88825a8a55
Use ptype table from <sys/bootblock.h>
2004-11-12 16:57:46 +00:00
christos
88ddc79ebd
Add 0xBF for Solaris. From Larry Lee <lclee at west.sun.com>
2004-11-10 02:39:48 +00:00
dsl
25b17683bd
Add (unsigned char) to isdigit() calls
2004-10-28 19:48:41 +00:00
dsl
9721e88965
Fix intuit_translated_geometry() calculation.
...
From Izumi Tsutsui in PR bin/26917
2004-09-12 07:46:24 +00:00
dbj
3aca86e05b
check sysctl error return on both calls.
...
this prevents sysctl from coredumping if the second call fails while the
first succeeds. This isn't supposed to happen, but there is another bug
in the i386 kernel implementation of sysctl machdep.diskinfo that excites this
2004-07-30 23:42:29 +00:00