From 2908d0dd7d7064e00a7dc152363dd2be718bd98f Mon Sep 17 00:00:00 2001 From: krw Date: Thu, 21 Oct 2021 13:16:49 +0000 Subject: [PATCH] Remove 'disk' editing command. Determining the disk geometry on startup (from -l, -c/-h/-s or DIOCGPDINFO) should be enough for anyone. --- sbin/fdisk/cmd.c | 31 +------------------------------ sbin/fdisk/fdisk.8 | 22 ++-------------------- sbin/fdisk/user.c | 3 +-- 3 files changed, 4 insertions(+), 52 deletions(-) diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 3ed1209a2bb..82a5290c84f 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.146 2021/09/10 15:26:36 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.147 2021/10/21 13:16:49 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -78,35 +78,6 @@ Xreinit(char *args, struct mbr *mbr) return CMD_DIRTY; } -int -Xdisk(char *args, struct mbr *mbr) -{ - int maxcyl = 1024; - int maxhead = 256; - int maxsec = 63; - - DISK_printgeometry(args); - -#if defined (__powerpc__) || defined (__mips__) - maxcyl = 9999999; - maxhead = 9999999; - maxsec = 9999999; -#endif - - if (ask_yn("Change disk geometry?")) { - disk.dk_cylinders = ask_num("BIOS Cylinders", - disk.dk_cylinders, 1, maxcyl); - disk.dk_heads = ask_num("BIOS Heads", - disk.dk_heads, 1, maxhead); - disk.dk_sectors = ask_num("BIOS Sectors", - disk.dk_sectors, 1, maxsec); - - disk.dk_size = disk.dk_cylinders * disk.dk_heads * disk.dk_sectors; - } - - return CMD_CONT; -} - int Xswap(char *args, struct mbr *mbr) { diff --git a/sbin/fdisk/fdisk.8 b/sbin/fdisk/fdisk.8 index eb5e49bbcb5..16b5da61ab9 100644 --- a/sbin/fdisk/fdisk.8 +++ b/sbin/fdisk/fdisk.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: fdisk.8,v 1.106 2021/09/13 11:44:40 krw Exp $ +.\" $OpenBSD: fdisk.8,v 1.107 2021/10/21 13:16:49 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: September 13 2021 $ +.Dd $Mdocdate: October 21 2021 $ .Dt FDISK 8 .Os .Sh NAME @@ -374,24 +374,6 @@ By default an MBR is initialized. If .Cm gpt is specified a protective MBR and a GPT are initialized. -.It Cm disk Op Ar unit -Display the current drive geometry that -.Nm -probed using kernel provided information and various heuristics. -A -.Ar unit -.Sq b , -.Sq k , -.Sq m , -.Sq g , -or -.Sq t -may be appended to request that the size of -.Ar disk -be shown as bytes, kilobytes, megabytes, gigabytes, -or terabytes instead of sectors. -The disk geometry may be changed at this point. -Not available when editing a GPT. .It Cm edit Ar # Edit a given table entry in the memory copy of the current boot block. diff --git a/sbin/fdisk/user.c b/sbin/fdisk/user.c index a494fb93371..eb8ce2e61d3 100644 --- a/sbin/fdisk/user.c +++ b/sbin/fdisk/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.78 2021/09/10 15:26:36 krw Exp $ */ +/* $OpenBSD: user.c,v 1.79 2021/10/21 13:16:49 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -43,7 +43,6 @@ const struct cmd cmd_table[] = { {"manual", 1, Xmanual, "Show entire OpenBSD man page for fdisk"}, {"reinit", 1, Xreinit, "Re-initialize loaded MBR (to defaults)"}, {"setpid", 1, Xsetpid, "Set the identifier of a given table entry"}, - {"disk", 0, Xdisk, "Edit current drive stats"}, {"edit", 1, Xedit, "Edit given table entry"}, {"flag", 1, Xflag, "Flag given table entry as bootable"}, {"update", 0, Xupdate, "Update machine code in loaded MBR"}, -- 2.20.1