From 2a536aa25d7c804618360568402ee17c9f9e78be Mon Sep 17 00:00:00 2001 From: krw Date: Sun, 11 Jul 2021 12:51:36 +0000 Subject: [PATCH] 'return' is not a function call. No functional change. --- sbin/fdisk/cmd.c | 84 +++++++++++++++++++++++----------------------- sbin/fdisk/disk.c | 16 ++++----- sbin/fdisk/fdisk.c | 4 +-- sbin/fdisk/gpt.c | 48 +++++++++++++------------- sbin/fdisk/mbr.c | 18 +++++----- sbin/fdisk/misc.c | 32 +++++++++--------- sbin/fdisk/part.c | 16 ++++----- 7 files changed, 109 insertions(+), 109 deletions(-) diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 76701b11f13..2a16a6c2a2e 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.118 2021/06/28 19:50:30 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.119 2021/07/11 12:51:36 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -55,7 +55,7 @@ Xreinit(char *args, struct mbr *mbr) dogpt = 0; else if (strlen(args) > 0) { printf("Unrecognized modifier '%s'\n", args); - return (CMD_CONT); + return CMD_CONT; } MBR_make(&initial_mbr, &dos_mbr); @@ -73,7 +73,7 @@ Xreinit(char *args, struct mbr *mbr) printf("Use 'write' to update disk.\n"); - return (CMD_DIRTY); + return CMD_DIRTY; } int @@ -104,7 +104,7 @@ Xdisk(char *args, struct mbr *mbr) disk.size = disk.cylinders * disk.heads * disk.sectors; } - return (CMD_CONT); + return CMD_CONT; } int @@ -120,15 +120,15 @@ Xswap(char *args, struct mbr *mbr) pt = parsepn(to); if (pt == -1) - return (CMD_CONT); + return CMD_CONT; pf = parsepn(from); if (pf == -1) - return (CMD_CONT); + return CMD_CONT; if (pt == pf) { printf("%d same partition as %d, doing nothing.\n", pt, pf); - return (CMD_CONT); + return CMD_CONT; } if (letoh64(gh.gh_sig) == GPTSIGNATURE) { @@ -141,7 +141,7 @@ Xswap(char *args, struct mbr *mbr) mbr->part[pf] = pp; } - return (CMD_DIRTY); + return CMD_DIRTY; } int @@ -164,7 +164,7 @@ gedit(int pn) goto done; memset(gg, 0, sizeof(struct gpt_partition)); printf("Partition %d is disabled.\n", pn); - return (CMD_DIRTY); + return CMD_DIRTY; } if (GPT_get_lba_start(pn) == -1 || @@ -190,13 +190,13 @@ gedit(int pn) } if (memcmp(gg, &oldgg, sizeof(*gg))) - return (CMD_DIRTY); + return CMD_DIRTY; else - return (CMD_CLEAN); + return CMD_CLEAN; done: *gg = oldgg; - return (CMD_CONT); + return CMD_CONT; } int @@ -273,9 +273,9 @@ edit(int pn, struct mbr *mbr) done: if (memcmp(pp, &oldpp, sizeof(*pp))) - return (CMD_DIRTY); + return CMD_DIRTY; else - return (CMD_CONT); + return CMD_CONT; } int @@ -285,12 +285,12 @@ Xedit(char *args, struct mbr *mbr) pn = parsepn(args); if (pn == -1) - return (CMD_CONT); + return CMD_CONT; if (letoh64(gh.gh_sig) == GPTSIGNATURE) - return (gedit(pn)); + return gedit(pn); else - return (edit(pn, mbr)); + return edit(pn, mbr); } int @@ -337,13 +337,13 @@ gsetpid(int pn) } if (memcmp(gg, &oldgg, sizeof(*gg))) - return (CMD_DIRTY); + return CMD_DIRTY; else - return (CMD_CLEAN); + return CMD_CLEAN; done: *gg = oldgg; - return (CMD_CONT); + return CMD_CONT; } int @@ -361,11 +361,11 @@ setpid(int pn, struct mbr *mbr) /* Ask for MBR partition type */ num = ask_pid(pp->id, NULL); if (num == pp->id) - return (CMD_CONT); + return CMD_CONT; pp->id = num; - return (CMD_DIRTY); + return CMD_DIRTY; } int @@ -375,12 +375,12 @@ Xsetpid(char *args, struct mbr *mbr) pn = parsepn(args); if (pn == -1) - return (CMD_CONT); + return CMD_CONT; if (letoh64(gh.gh_sig) == GPTSIGNATURE) - return (gsetpid(pn)); + return gsetpid(pn); else - return (setpid(pn, mbr)); + return setpid(pn, mbr); } int @@ -392,7 +392,7 @@ Xselect(char *args, struct mbr *mbr) pn = parsepn(args); if (pn == -1) - return (CMD_CONT); + return CMD_CONT; off = mbr->part[pn].bs; @@ -400,7 +400,7 @@ Xselect(char *args, struct mbr *mbr) if ((mbr->part[pn].id != DOSPTYP_EXTEND) && (mbr->part[pn].id != DOSPTYP_EXTENDL)) { printf("Partition %d is not an extended partition.\n", pn); - return (CMD_CONT); + return CMD_CONT; } if (firstoff == 0) @@ -408,7 +408,7 @@ Xselect(char *args, struct mbr *mbr) if (!off) { printf("Loop to offset 0! Not selected.\n"); - return (CMD_CONT); + return CMD_CONT; } else { printf("Selected extended partition %d\n", pn); printf("New MBR at offset %lld.\n", (long long)off); @@ -417,7 +417,7 @@ Xselect(char *args, struct mbr *mbr) /* Recursion is beautiful! */ USER_edit(off, firstoff); - return (CMD_CONT); + return CMD_CONT; } int @@ -431,7 +431,7 @@ Xprint(char *args, struct mbr *mbr) else MBR_print(mbr, args); - return (CMD_CONT); + return CMD_CONT; } int @@ -446,7 +446,7 @@ Xwrite(char *args, struct mbr *mbr) if (n >= 2) { warnx("MBR contains more than one OpenBSD partition!"); if (!ask_yn("Write MBR anyway?")) - return (CMD_CONT); + return CMD_CONT; } MBR_make(mbr, &dos_mbr); @@ -454,7 +454,7 @@ Xwrite(char *args, struct mbr *mbr) printf("Writing MBR at offset %lld.\n", (long long)mbr->offset); if (MBR_write(mbr->offset, &dos_mbr) == -1) { warn("error writing MBR"); - return (CMD_CONT); + return CMD_CONT; } if (letoh64(gh.gh_sig) == GPTSIGNATURE) { @@ -462,7 +462,7 @@ Xwrite(char *args, struct mbr *mbr) efi = MBR_protective_mbr(mbr); if (efi == -1 || GPT_write() == -1) { warn("error writing GPT"); - return (CMD_CONT); + return CMD_CONT; } } else { GPT_zap_headers(); @@ -471,13 +471,13 @@ Xwrite(char *args, struct mbr *mbr) /* Refresh in memory copy to reflect what was just written. */ MBR_parse(&dos_mbr, mbr->offset, mbr->reloffset, mbr); - return (CMD_CLEAN); + return CMD_CLEAN; } int Xquit(char *args, struct mbr *mbr) { - return (CMD_SAVE); + return CMD_SAVE; } int @@ -489,7 +489,7 @@ Xabort(char *args, struct mbr *mbr) int Xexit(char *args, struct mbr *mbr) { - return (CMD_EXIT); + return CMD_EXIT; } int @@ -511,7 +511,7 @@ Xhelp(char *args, struct mbr *mbr) printf("\t%s\t\t%s\n", cmd_table[i].cmd, help); } - return (CMD_CONT); + return CMD_CONT; } int @@ -521,7 +521,7 @@ Xupdate(char *args, struct mbr *mbr) memcpy(mbr->code, initial_mbr.code, sizeof(mbr->code)); mbr->signature = DOSMBR_SIGNATURE; printf("Machine code updated.\n"); - return (CMD_DIRTY); + return CMD_DIRTY; } int @@ -537,7 +537,7 @@ Xflag(char *args, struct mbr *mbr) pn = parsepn(part); if (pn == -1) - return (CMD_CONT); + return CMD_CONT; if (flag != NULL) { /* Set flag to value provided. */ @@ -547,7 +547,7 @@ Xflag(char *args, struct mbr *mbr) val = strtonum(flag, 0, 0xff, &errstr); if (errstr) { printf("flag value is %s: %s.\n", errstr, flag); - return (CMD_CONT); + return CMD_CONT; } if (letoh64(gh.gh_sig) == GPTSIGNATURE) gp[pn].gp_attrs = htole64(val); @@ -574,7 +574,7 @@ Xflag(char *args, struct mbr *mbr) printf("Partition %d marked active.\n", pn); } - return (CMD_DIRTY); + return CMD_DIRTY; } int @@ -601,5 +601,5 @@ Xmanual(char *args, struct mbr *mbr) signal(SIGPIPE, opipe); - return (CMD_CONT); + return CMD_CONT; } diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index ce1c11252a3..3e8ab4e0cd2 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.57 2021/05/07 22:15:13 krw Exp $ */ +/* $OpenBSD: disk.c,v 1.58 2021/07/11 12:51:36 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -102,7 +102,7 @@ DISK_printgeometry(char *units) } else printf("geometry: \n"); - return (0); + return 0; } /* @@ -125,19 +125,19 @@ DISK_readsector(off_t where) where *= secsize; off = lseek(disk.fd, where, SEEK_SET); if (off != where) - return (NULL); + return NULL; secbuf = calloc(1, secsize); if (secbuf == NULL) - return (NULL); + return NULL; len = read(disk.fd, secbuf, secsize); if (len == -1 || len != secsize) { free(secbuf); - return (NULL); + return NULL; } - return (secbuf); + return secbuf; } /* @@ -163,8 +163,8 @@ DISK_writesector(char *secbuf, off_t where) if (len == -1 || len != secsize) { /* short read or write */ errno = EIO; - return (-1); + return -1; } - return (0); + return 0; } diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index 59a43da8daf..568bede6162 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.114 2021/06/28 19:50:30 krw Exp $ */ +/* $OpenBSD: fdisk.c,v 1.115 2021/07/11 12:51:36 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -250,5 +250,5 @@ main(int argc, char *argv[]) done: close(disk.fd); - return (0); + return 0; } diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index df8b0f2240a..909db73e077 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.34 2021/06/28 19:50:30 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.35 2021/07/11 12:51:36 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -61,7 +61,7 @@ get_header(off_t where) secbuf = DISK_readsector(where); if (secbuf == 0) - return (1); + return 1; memcpy(&gh, secbuf, sizeof(struct gpt_header)); free(secbuf); @@ -69,37 +69,37 @@ get_header(off_t where) if (letoh64(gh.gh_sig) != GPTSIGNATURE) { DPRINTF("gpt signature: expected 0x%llx, got 0x%llx\n", GPTSIGNATURE, letoh64(gh.gh_sig)); - return (1); + return 1; } if (letoh32(gh.gh_rev) != GPTREVISION) { DPRINTF("gpt revision: expected 0x%x, got 0x%x\n", GPTREVISION, letoh32(gh.gh_rev)); - return (1); + return 1; } if (letoh64(gh.gh_lba_self) != where) { DPRINTF("gpt self lba: expected %lld, got %llu\n", (long long)where, letoh64(gh.gh_lba_self)); - return (1); + return 1; } if (letoh32(gh.gh_size) != GPTMINHDRSIZE) { DPRINTF("gpt header size: expected %u, got %u\n", GPTMINHDRSIZE, letoh32(gh.gh_size)); - return (1); + return 1; } if (letoh32(gh.gh_part_size) != GPTMINPARTSIZE) { DPRINTF("gpt partition size: expected %u, got %u\n", GPTMINPARTSIZE, letoh32(gh.gh_part_size)); - return (1); + return 1; } if (letoh32(gh.gh_part_num) > NGPTPARTITIONS) { DPRINTF("gpt partition count: expected <= %u, got %u\n", NGPTPARTITIONS, letoh32(gh.gh_part_num)); - return (1); + return 1; } orig_gh_csum = gh.gh_csum; @@ -109,7 +109,7 @@ get_header(off_t where) if (letoh32(orig_gh_csum) != new_gh_csum) { DPRINTF("gpt header checksum: expected 0x%x, got 0x%x\n", orig_gh_csum, new_gh_csum); - return (1); + return 1; } /* XXX Assume part_num * part_size is multiple of secsize. */ @@ -125,7 +125,7 @@ get_header(off_t where) if (letoh64(gh.gh_lba_start) >= letoh64(gh.gh_lba_end)) { DPRINTF("gpt first usable LBA: expected < %llu, got %llu\n", letoh64(gh.gh_lba_end), letoh64(gh.gh_lba_start)); - return (1); + return 1; } if (letoh64(gh.gh_part_lba) <= letoh64(gh.gh_lba_end) && @@ -133,7 +133,7 @@ get_header(off_t where) DPRINTF("gpt partition table start lba: expected < %llu or " "> %llu, got %llu\n", letoh64(gh.gh_lba_start), letoh64(gh.gh_lba_end), letoh64(gh.gh_part_lba)); - return (1); + return 1; } partspersec = dl.d_secsize / letoh32(gh.gh_part_size); @@ -144,7 +144,7 @@ get_header(off_t where) DPRINTF("gpt partition table last LBA: expected < %llu or " "> %llu, got %llu\n", letoh64(gh.gh_lba_start), letoh64(gh.gh_lba_end), partlastlba); - return (1); + return 1; } /* @@ -153,7 +153,7 @@ get_header(off_t where) * 2) partition table extends into lowest partition. * 3) alt partition table starts before gh_lba_end. */ - return (0); + return 0; } int @@ -171,7 +171,7 @@ get_partition_table(void) if (partspersec * letoh32(gh.gh_part_size) != dl.d_secsize) { DPRINTF("gpt partition table entry invalid size. %u\n", letoh32(gh.gh_part_size)); - return (1); + return 1; } secs = (letoh32(gh.gh_part_num) + partspersec - 1) / partspersec; @@ -182,12 +182,12 @@ get_partition_table(void) if (off == -1) { DPRINTF("seek to gpt partition table @ sector %llu failed\n", (unsigned long long)where / dl.d_secsize); - return (1); + return 1; } len = read(disk.fd, &gp, secs * dl.d_secsize); if (len == -1 || len != secs * dl.d_secsize) { DPRINTF("gpt partition table read failed.\n"); - return (1); + return 1; } checksum = crc32((unsigned char *)&gp, letoh32(gh.gh_part_num) * @@ -195,10 +195,10 @@ get_partition_table(void) if (checksum != letoh32(gh.gh_part_csum)) { DPRINTF("gpt partition table checksum: expected %x, got %x\n", checksum, letoh32(gh.gh_part_csum)); - return (1); + return 1; } - return (0); + return 0; } void @@ -515,7 +515,7 @@ GPT_write(void) secbuf = DISK_readsector(prigh); if (secbuf == NULL) - return (-1); + return -1; memcpy(secbuf, &gh, sizeof(gh)); DISK_writesector(secbuf, prigh); @@ -529,7 +529,7 @@ GPT_write(void) secbuf = DISK_readsector(altgh); if (secbuf == NULL) - return (-1); + return -1; memcpy(secbuf, &gh, sizeof(gh)); DISK_writesector(secbuf, altgh); @@ -542,7 +542,7 @@ GPT_write(void) len = -1; if (len == -1 || len != gpbytes) { errno = EIO; - return (-1); + return -1; } off = lseek(disk.fd, secsize * altgp, SEEK_SET); @@ -553,13 +553,13 @@ GPT_write(void) if (len == -1 || len != gpbytes) { errno = EIO; - return (-1); + return -1; } /* Refresh in-kernel disklabel from the updated disk information. */ ioctl(disk.fd, DIOCRLDINFO, 0); - return (0); + return 0; } int @@ -602,7 +602,7 @@ sort_gpt(void) } } - return (sgp); + return sgp; } int diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index 6bedb18d1cc..5fa91ecdce6 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.78 2021/07/04 20:37:11 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.79 2021/07/11 12:51:36 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -43,7 +43,7 @@ MBR_protective_mbr(struct mbr *mbr) int i; if (mbr->offset != 0) - return (-1); + return -1; for (i = 0; i < NDOSPART; i++) { PRT_make(&mbr->part[i], mbr->offset, mbr->reloffset, @@ -51,7 +51,7 @@ MBR_protective_mbr(struct mbr *mbr) memcpy(&dp[i], &dos_partition, sizeof(dp[i])); } - return (gpt_chk_mbr(dp, DL_GETDSIZE(&dl))); + return gpt_chk_mbr(dp, DL_GETDSIZE(&dl)); } void @@ -214,12 +214,12 @@ MBR_read(off_t where, struct dos_mbr *dos_mbr) secbuf = DISK_readsector(where); if (secbuf == NULL) - return (-1); + return -1; memcpy(dos_mbr, secbuf, sizeof(*dos_mbr)); free(secbuf); - return (0); + return 0; } int @@ -229,7 +229,7 @@ MBR_write(off_t where, struct dos_mbr *dos_mbr) secbuf = DISK_readsector(where); if (secbuf == NULL) - return (-1); + return -1; /* * Place the new MBR at the start of the sector and @@ -243,7 +243,7 @@ MBR_write(off_t where, struct dos_mbr *dos_mbr) free(secbuf); - return (0); + return 0; } /* @@ -276,7 +276,7 @@ gpt_chk_mbr(struct dos_partition *dp, u_int64_t dsize) } } if (found == 1 && eficnt == 1) - return (efi); + return efi; - return (-1); + return -1; } diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c index 56a80686e5c..f1d89a89a7e 100644 --- a/sbin/fdisk/misc.c +++ b/sbin/fdisk/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.69 2021/06/25 19:24:53 krw Exp $ */ +/* $OpenBSD: misc.c,v 1.70 2021/07/11 12:51:36 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -48,7 +48,7 @@ unit_lookup(char *units) int i = 0; if (units == NULL) - return (SECTORS); + return SECTORS; while (unit_types[i].abbr != NULL) { if (strncasecmp(unit_types[i].abbr, units, 1) == 0) @@ -57,9 +57,9 @@ unit_lookup(char *units) } /* default */ if (unit_types[i].abbr == NULL) - return (SECTORS); + return SECTORS; - return (i); + return i; } int @@ -71,14 +71,14 @@ string_from_line(char *buf, size_t buflen) len = getline(&line, &sz, stdin); if (len == -1) - return (1); + return 1; if (line[len - 1] == '\n') line[len - 1] = '\0'; strlcpy(buf, line, buflen); - return (0); + return 0; } void @@ -129,7 +129,7 @@ ask_num(const char *str, int dflt, int low, int high) } } while (errstr); - return (num); + return num; } int @@ -153,7 +153,7 @@ ask_pid(int dflt, struct uuid *guid) if (guid && strlen(lbuf) == UUID_STR_LEN) { uuid_from_string(lbuf, guid, &status); if (status == uuid_s_ok) - return (0x100); + return 0x100; } /* Convert */ @@ -173,7 +173,7 @@ ask_pid(int dflt, struct uuid *guid) } } while (num < 0 || num > 0xff); - return (num); + return num; } int @@ -183,7 +183,7 @@ ask_yn(const char *str) extern int y_flag; if (y_flag) - return (1); + return 1; printf("%s [n] ", str); fflush(stdout); @@ -195,7 +195,7 @@ ask_yn(const char *str) if (ch == EOF || first == EOF) errx(1, "eof"); - return (first == 'y' || first == 'Y'); + return first == 'y' || first == 'Y'; } /* @@ -231,7 +231,7 @@ getuint64(char *prompt, uint64_t oval, uint64_t minval, uint64_t maxval) if (rslt < 0 || rslt >= sizeof(buf)) errx(1, "default value too long"); } else if (buf[0] == '*' && buf[1] == '\0') { - return (maxval); + return maxval; } /* deal with units */ @@ -319,7 +319,7 @@ getuint64(char *prompt, uint64_t oval, uint64_t minval, uint64_t maxval) } } while (1); - return((uint64_t)d); + return (uint64_t)d; } char * @@ -335,7 +335,7 @@ ask_string(const char *prompt, const char *oval) if (buf[0] == '\0' && oval) strlcpy(buf, oval, sizeof(buf)); - return(buf); + return buf; } /* @@ -383,7 +383,7 @@ utf16le_to_string(const uint16_t *utf) if (i == GPTPARTNAMESIZE) name[i - 1] = '\0'; - return (name); + return name; } uint16_t * @@ -400,7 +400,7 @@ string_to_utf16le(const char *ch) if (i == GPTPARTNAMESIZE) utf[i - 1] = 0; - return (utf); + return utf; } void diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c index a09f84a9223..8b570bada4c 100644 --- a/sbin/fdisk/part.c +++ b/sbin/fdisk/part.c @@ -1,4 +1,4 @@ -/* $OpenBSD: part.c,v 1.87 2021/06/21 13:17:20 krw Exp $ */ +/* $OpenBSD: part.c,v 1.88 2021/07/11 12:51:36 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -215,10 +215,10 @@ ascii_id(int id) for (i = 0; i < sizeof(part_types)/sizeof(struct part_type); i++) { if (part_types[i].type == id) - return (part_types[i].sname); + return part_types[i].sname; } - return (unknown); + return unknown; } void @@ -271,9 +271,9 @@ check_chs(struct prt *partn) (partn->esect >63) || (partn->ecyl > 1023) ) { - return (0); + return 0; } - return (1); + return 1; } void @@ -461,7 +461,7 @@ PRT_uuid_to_typename(struct uuid *uuid) done: free(uuidstr); - return (partition_type); + return partition_type; } int @@ -487,7 +487,7 @@ PRT_uuid_to_type(struct uuid *uuid) done: free(uuidstr); - return (type); + return type; } struct uuid * @@ -509,5 +509,5 @@ PRT_type_to_uuid(int type) if (i == entries || status != uuid_s_ok) uuid_from_string(part_types[0].guid, &guid, &status); - return (&guid); + return &guid; } -- 2.20.1