diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-11-11 15:39:19 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2015-11-11 15:39:19 +0000 |
commit | f3fe9cd8de45e0749634e923096072faf69da20c (patch) | |
tree | 1c99042cb2b1f7a71a1cd7ccee99a43fbd4b625c /sbin/fdisk | |
parent | 31dc60de7b1b338aeebfee4d6ba73109fda229e3 (diff) |
Display full disk size when editing GPT, not the truncated MBR size. Display
'disk too large' message only when no GPT is found.
Problems found, fix tested and ok naddy@.
Diffstat (limited to 'sbin/fdisk')
-rw-r--r-- | sbin/fdisk/disk.c | 4 | ||||
-rw-r--r-- | sbin/fdisk/fdisk.c | 5 | ||||
-rw-r--r-- | sbin/fdisk/gpt.c | 4 |
3 files changed, 7 insertions, 6 deletions
diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index cf0aef6aab4..d6829094fb3 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.48 2015/08/27 20:58:27 krw Exp $ */ +/* $OpenBSD: disk.c,v 1.49 2015/11/11 15:39:18 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -74,8 +74,6 @@ DISK_getlabelgeometry(void) if (sz > UINT32_MAX) { disk.cylinders = UINT32_MAX / spc; disk.size = disk.cylinders * spc; - warnx("disk too large (%llu sectors)." - " size truncated.", sz); } else disk.size = sz; unit_types[SECTORS].conversion = dl.d_secsize; diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 450d41edd19..e19396bfbc7 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.79 2015/10/26 15:08:26 krw Exp $ */ +/* $OpenBSD: fdisk.c,v 1.80 2015/11/11 15:39:18 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -166,6 +166,9 @@ main(int argc, char *argv[]) if (GPT_get_gpt()) { memset(&gh, 0, sizeof(gh)); memset(&gp, 0, sizeof(gp)); + if (DL_GETDSIZE(&dl) > UINT32_MAX) + warnx("disk too large (%llu sectors). size truncated.", + (unsigned long long)DL_GETDSIZE(&dl)); } if (c_arg | h_arg | s_arg) { diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index 7f37628c16f..968ca5f8985 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.2 2015/10/26 15:08:26 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.3 2015/11/11 15:39:18 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller <mmu@grummel.net> * Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org> @@ -242,7 +242,7 @@ GPT_print(char *units) free(guidstr); u = unit_lookup(units); - size = ((double)disk.size * secsize) / unit_types[u].conversion; + size = ((double)DL_GETDSIZE(&dl) * secsize) / unit_types[u].conversion; printf("[%.0f ", size); if (u == SECTORS && secsize != DEV_BSIZE) printf("%d-byte ", secsize); |