From 206308cccca68d659f49b756cddf62c790f4bbef Mon Sep 17 00:00:00 2001 From: krw Date: Sat, 17 Jul 2021 14:16:34 +0000 Subject: [PATCH] Nuke a bunch of Capt. Obvious or misleading comments. No functional change. --- sbin/fdisk/cmd.c | 9 +-------- sbin/fdisk/disk.c | 18 ++---------------- sbin/fdisk/fdisk.c | 3 +-- sbin/fdisk/mbr.c | 8 +------- sbin/fdisk/misc.c | 3 +-- 5 files changed, 6 insertions(+), 35 deletions(-) diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index c2fe406c1f5..aa2ca120351 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.130 2021/07/17 13:37:01 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.131 2021/07/17 14:16:34 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -99,7 +99,6 @@ Xdisk(char *args, struct mbr *mbr) maxsec = 9999999; #endif - /* Ask for new info */ if (ask_yn("Change disk geometry?")) { disk.dk_cylinders = ask_num("BIOS Cylinders", disk.dk_cylinders, 1, maxcyl); @@ -313,7 +312,6 @@ gsetpid(int pn) gg = &gp[pn]; - /* Print out current table entry */ GPT_print_parthdr(TERSE); GPT_print_part(pn, "s", TERSE); @@ -356,11 +354,9 @@ setpid(int pn, struct mbr *mbr) pp = &mbr->mbr_prt[pn]; - /* Print out current table entry */ PRT_print(0, NULL, NULL); PRT_print(pn, pp, NULL); - /* Ask for MBR partition type */ pp->prt_id = ask_pid(pp->prt_id, NULL); return 0; @@ -528,7 +524,6 @@ Xhelp(char *args, struct mbr *mbr) int Xupdate(char *args, struct mbr *mbr) { - /* Update code */ memcpy(mbr->mbr_code, initial_mbr.mbr_code, sizeof(mbr->mbr_code)); mbr->mbr_signature = DOSMBR_SIGNATURE; printf("Machine code updated.\n"); @@ -551,7 +546,6 @@ Xflag(char *args, struct mbr *mbr) return CMD_CONT; if (flag != NULL) { - /* Set flag to value provided. */ if (letoh64(gh.gh_sig) == GPTSIGNATURE) val = strtonum(flag, 0, INT64_MAX, &errstr); else @@ -566,7 +560,6 @@ Xflag(char *args, struct mbr *mbr) mbr->mbr_prt[pn].prt_flag = val; printf("Partition %d flag value set to 0x%llx.\n", pn, val); } else { - /* Set active flag */ if (letoh64(gh.gh_sig) == GPTSIGNATURE) { for (i = 0; i < NGPTPARTITIONS; i++) { if (i == pn) diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index 5f7a296cc19..60a9d3d18a9 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.66 2021/07/16 13:26:04 krw Exp $ */ +/* $OpenBSD: disk.c,v 1.67 2021/07/17 14:16:34 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -96,10 +96,6 @@ DISK_open(const char *name, const int oflags) } } -/* - * Print the disk geometry information. Take an optional modifier - * to indicate the units that should be used for display. - */ void DISK_printgeometry(const char *units) { @@ -121,11 +117,7 @@ DISK_printgeometry(const char *units) } /* - * Read the sector at 'where' from the file descriptor 'fd' into newly - * calloc'd memory. Return a pointer to the memory if it contains the - * requested data, or NULL if it does not. - * - * The caller must free() the memory it gets. + * The caller must free() the returned memory! */ char * DISK_readsector(const uint64_t sector) @@ -155,11 +147,6 @@ DISK_readsector(const uint64_t sector) return secbuf; } -/* - * Write the sector-sized 'secbuf' to the sector 'where' on the file - * descriptor 'fd'. Return 0 if the write works. Return -1 and set - * errno if the write fails. - */ int DISK_writesector(const char *secbuf, const uint64_t sector) { @@ -176,7 +163,6 @@ DISK_writesector(const char *secbuf, const uint64_t sector) len = write(disk.dk_fd, secbuf, secsize); if (len == -1 || len != secsize) { - /* short read or write */ errno = EIO; return -1; } diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 6ff56d20a98..8cb0be0bed0 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.122 2021/07/15 23:25:46 krw Exp $ */ +/* $OpenBSD: fdisk.c,v 1.123 2021/07/17 14:16:34 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -143,7 +143,6 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - /* Argument checking */ if (argc != 1 || (i_flag && u_flag) || (i_flag == 0 && g_flag)) usage(); diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index c318194c1a8..7bc0c2f0476 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.86 2021/07/15 21:58:02 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.87 2021/07/17 14:16:34 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -193,12 +193,10 @@ MBR_print(const struct mbr *mbr, const char *units) DISK_printgeometry(NULL); - /* Header */ printf("Offset: %lld\t", (long long)mbr->mbr_lba_self); printf("Signature: 0x%X\n", (int)mbr->mbr_signature); PRT_print(0, NULL, units); - /* Entries */ for (i = 0; i < NDOSPART; i++) PRT_print(i, &mbr->mbr_prt[i], units); } @@ -227,10 +225,6 @@ MBR_write(const uint64_t sector, const struct dos_mbr *dos_mbr) if (secbuf == NULL) return -1; - /* - * Place the new MBR at the start of the sector and - * write the sector back to "disk". - */ memcpy(secbuf, dos_mbr, sizeof(*dos_mbr)); DISK_writesector(secbuf, sector); diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c index 997ce44f683..ed9eb773e07 100644 --- a/sbin/fdisk/misc.c +++ b/sbin/fdisk/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.77 2021/07/16 13:26:04 krw Exp $ */ +/* $OpenBSD: misc.c,v 1.78 2021/07/17 14:16:34 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -55,7 +55,6 @@ unit_lookup(const char *units) break; i++; } - /* default */ if (unit_types[i].ut_abbr == NULL) return SECTORS; -- 2.20.1