From 1640467be5e63cf69faeba1b8a8a4c3962228d4b Mon Sep 17 00:00:00 2001 From: krw Date: Mon, 19 Jul 2021 23:24:54 +0000 Subject: [PATCH] Tweak one comment and nuke a bunch of pointless ones. --- sbin/fdisk/mbr.c | 4 ++-- sbin/fdisk/part.c | 8 +------- sbin/fdisk/user.c | 11 +---------- 3 files changed, 4 insertions(+), 19 deletions(-) diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index fe291a99856..3027c752d22 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.92 2021/07/19 19:30:35 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.93 2021/07/19 23:24:54 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -116,7 +116,7 @@ MBR_init(struct mbr *mbr) PRT_fix_BN(&mbr->mbr_prt[3], 3); #if defined(__powerpc__) || defined(__mips__) - /* Now fix up for the MS-DOS boot partition on PowerPC. */ + /* Now fix up for the MS-DOS boot partition on PowerPC/MIPS. */ mbr->mbr_prt[0].prt_flag = DOSACTIVE; /* Boot from dos part */ mbr->mbr_prt[3].prt_flag = 0; mbr->mbr_prt[3].prt_ns += mbr->mbr_prt[3].prt_bs; diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c index c062cc003c6..178e4126287 100644 --- a/sbin/fdisk/part.c +++ b/sbin/fdisk/part.c @@ -1,4 +1,4 @@ -/* $OpenBSD: part.c,v 1.100 2021/07/18 21:40:13 krw Exp $ */ +/* $OpenBSD: part.c,v 1.101 2021/07/19 23:24:54 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -350,13 +350,11 @@ PRT_fix_BN(struct prt *prt, const int pn) uint32_t start = 0; uint32_t end = 0; - /* Zero out entry if not used */ if (prt->prt_id == DOSPTYP_UNUSED) { memset(prt, 0, sizeof(*prt)); return; } - /* Disk geometry. */ spt = disk.dk_sectors; tpc = disk.dk_heads; spc = spt * tpc; @@ -384,13 +382,11 @@ PRT_fix_CHS(struct prt *prt) uint32_t start, end, size; uint32_t cyl, head, sect; - /* Zero out entry if not used */ if (prt->prt_id == DOSPTYP_UNUSED || prt->prt_ns == 0) { memset(prt, 0, sizeof(*prt)); return; } - /* Disk geometry. */ spt = disk.dk_sectors; tpc = disk.dk_heads; spc = spt * tpc; @@ -399,7 +395,6 @@ PRT_fix_CHS(struct prt *prt) size = prt->prt_ns; end = (start + size) - 1; - /* Figure out starting CHS values */ cyl = (start / spc); start -= (cyl * spc); head = (start / spt); start -= (head * spt); sect = (start + 1); @@ -408,7 +403,6 @@ PRT_fix_CHS(struct prt *prt) prt->prt_shead = head; prt->prt_ssect = sect; - /* Figure out ending CHS values */ cyl = (end / spc); end -= (cyl * spc); head = (end / spt); end -= (head * spt); sect = (end + 1); diff --git a/sbin/fdisk/user.c b/sbin/fdisk/user.c index cd8b8ea606f..ae5d1ed75d3 100644 --- a/sbin/fdisk/user.c +++ b/sbin/fdisk/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.65 2021/07/18 15:28:37 krw Exp $ */ +/* $OpenBSD: user.c,v 1.66 2021/07/19 23:24:54 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -33,7 +33,6 @@ #include "gpt.h" #include "disk.h" -/* Our command table */ const struct cmd cmd_table[] = { {"help", 1, Xhelp, "Command help list"}, {"manual", 1, Xmanual, "Show entire OpenBSD man page for fdisk"}, @@ -78,7 +77,6 @@ USER_edit(const uint64_t lba_self, const uint64_t lba_firstembr) printf("Enter 'help' for information\n"); - /* Edit cycle */ again: do { printf("%s%s: %d> ", disk.dk_name, modified ? "*" : "", editlevel); @@ -95,14 +93,12 @@ again: if (!strcmp(cmd, "?")) i = 0; - /* Check for valid command */ if ((cmd_table[i].cmd_name == NULL) || (letoh64(gh.gh_sig) == GPTSIGNATURE && cmd_table[i].cmd_gpt == 0)) { printf("Invalid command '%s'. Try 'help'.\n", cmd); continue; } - /* Call function */ st = cmd_table[i].cmd_fcn(args, &mbr); /* Update status */ @@ -116,7 +112,6 @@ again: modified = 1; } while (1); - /* Write out MBR */ if (modified) { if (st == CMD_SAVE) { if (Xwrite(NULL, &mbr) == CMD_CONT) @@ -126,7 +121,6 @@ again: } done: - /* One level less */ editlevel -= 1; } @@ -153,7 +147,6 @@ USER_print_disk(const int verbosity) GPT_print("s", verbosity); return; } else { - /*. Read & print both primary and secondary GPT. */ printf("Primary GPT:\n"); GPT_read(PRIMARYGPT); if (letoh64(gh.gh_sig) == GPTSIGNATURE) @@ -173,7 +166,6 @@ USER_print_disk(const int verbosity) MBR_print(&mbr, NULL); - /* Print out extended partitions too */ for (lba_self = i = 0; i < 4; i++) if (mbr.mbr_prt[i].prt_id == DOSPTYP_EXTEND || mbr.mbr_prt[i].prt_id == DOSPTYP_EXTENDL) { @@ -190,7 +182,6 @@ ask_cmd(char **cmd, char **arg) static char lbuf[100]; size_t cmdstart, cmdend, argstart; - /* Get NUL terminated string from stdin. */ if (string_from_line(lbuf, sizeof(lbuf))) errx(1, "eof"); -- 2.20.1