summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2021-06-23 13:07:14 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2021-06-23 13:07:14 +0000
commitf7692a7681bac711fe804a0f9d97410c891041d7 (patch)
tree11a55ee98ecc26c335844214e0ff5f71ff04cc8f /sbin
parentbce21238c201abe321f57543e2b2416fdcf4811b (diff)
The value of -l should be treated as a 512-byte block count.
Tweak man page.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fdisk/fdisk.87
-rw-r--r--sbin/fdisk/fdisk.c11
2 files changed, 13 insertions, 5 deletions
diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8
index 780ac3ca03b..c83ddb670c9 100644
--- a/sbin/fdisk/fdisk.8
+++ b/sbin/fdisk/fdisk.8
@@ -1,4 +1,4 @@
-.\" $OpenBSD: fdisk.8,v 1.103 2021/06/22 15:01:55 jmc Exp $
+.\" $OpenBSD: fdisk.8,v 1.104 2021/06/23 13:07:13 krw Exp $
.\"
.\"
.\" Copyright (c) 1997 Tobias Weingartner
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: June 22 2021 $
+.Dd $Mdocdate: June 23 2021 $
.Dt FDISK 8
.Os
.Sh NAME
@@ -144,8 +144,7 @@ MBR partition containing all available space not allocated by a
.Fl b
specification.
.It Fl l Ar blocks
-Specify the number of blocks in the disk, and force the MBR to be in LBA
-mode only.
+Treat the disk as if it has the specified number of blocks.
.It Fl u
Update MBR bootcode, preserving existing MBR partition table.
The MBR bootcode extends from offset 0x000 to the start of the MBR partition
diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c
index d6fee5a5976..c76ae1f366a 100644
--- a/sbin/fdisk/fdisk.c
+++ b/sbin/fdisk/fdisk.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fdisk.c,v 1.111 2021/06/22 14:01:58 krw Exp $ */
+/* $OpenBSD: fdisk.c,v 1.112 2021/06/23 13:07:13 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
@@ -165,6 +165,15 @@ main(int argc, char *argv[])
b_sectors = DL_BLKTOSEC(&dl, b_sectors);
b_offset = DL_BLKTOSEC(&dl, b_offset);
}
+ if (l_arg > 0) {
+ if (l_arg % bps != 0)
+ l_arg += bps - l_arg % bps;
+ l_arg = DL_BLKTOSEC(&dl, l_arg);
+ disk.cylinders = l_arg / 64;
+ disk.heads = 1;
+ disk.sectors = 64;
+ disk.size = l_arg;
+ }
/* "proc exec" for man page display */
if (pledge("stdio rpath wpath disklabel proc exec", NULL) == -1)