From: krw Date: Fri, 7 May 2021 22:15:13 +0000 (+0000) Subject: Replace random mix of u_int* and uint* types with consistent uint* types. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b87d3542bcfd022b062fc9f4b759042f9fa9d876;p=openbsd Replace random mix of u_int* and uint* types with consistent uint* types. --- diff --git a/sbin/fdisk/cmd.c b/sbin/fdisk/cmd.c index 12fb757f559..70a1c34d38b 100644 --- a/sbin/fdisk/cmd.c +++ b/sbin/fdisk/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.100 2021/05/02 20:07:14 krw Exp $ */ +/* $OpenBSD: cmd.c,v 1.101 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -167,7 +167,7 @@ Xgedit(char *args) const char *errstr; struct gpt_partition *gg; char *name; - u_int16_t *utf; + uint16_t *utf; int i, pn; pn = strtonum(args, 0, NGPTPARTITIONS - 1, &errstr); diff --git a/sbin/fdisk/disk.c b/sbin/fdisk/disk.c index 415cf450453..ce1c11252a3 100644 --- a/sbin/fdisk/disk.c +++ b/sbin/fdisk/disk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.c,v 1.56 2018/04/26 15:55:14 guenther Exp $ */ +/* $OpenBSD: disk.c,v 1.57 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -41,7 +41,7 @@ void DISK_open(int rw) { struct stat st; - u_int64_t sz, spc; + uint64_t sz, spc; disk.fd = opendev(disk.name, rw ? O_RDWR : O_RDONLY, OPENDEV_PART, NULL); @@ -63,7 +63,7 @@ DISK_open(int rw) disk.heads = dl.d_ntracks; disk.sectors = dl.d_nsectors; /* MBR handles only first UINT32_MAX sectors. */ - spc = (u_int64_t)disk.heads * disk.sectors; + spc = (uint64_t)disk.heads * disk.sectors; sz = DL_GETDSIZE(&dl); if (sz > UINT32_MAX) { disk.cylinders = UINT32_MAX / spc; diff --git a/sbin/fdisk/disk.h b/sbin/fdisk/disk.h index 0d4d5ab2fa7..4f549e4bd3b 100644 --- a/sbin/fdisk/disk.h +++ b/sbin/fdisk/disk.h @@ -1,4 +1,4 @@ -/* $OpenBSD: disk.h,v 1.21 2015/12/12 02:49:50 krw Exp $ */ +/* $OpenBSD: disk.h,v 1.22 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -22,10 +22,10 @@ struct disk { char *name; int fd; - u_int32_t cylinders; - u_int32_t heads; - u_int32_t sectors; - u_int32_t size; + uint32_t cylinders; + uint32_t heads; + uint32_t sectors; + uint32_t size; }; void DISK_open(int); diff --git a/sbin/fdisk/fdisk.c b/sbin/fdisk/fdisk.c index c453a63228e..f84ad6985aa 100644 --- a/sbin/fdisk/fdisk.c +++ b/sbin/fdisk/fdisk.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fdisk.c,v 1.104 2021/05/02 20:07:14 krw Exp $ */ +/* $OpenBSD: fdisk.c,v 1.105 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -41,7 +41,7 @@ static unsigned char builtin_mbr[] = { #include "mbrcode.h" }; -u_int32_t b_arg; +uint32_t b_arg; int y_flag; static void @@ -75,7 +75,7 @@ main(int argc, char *argv[]) int e_flag = 0, g_flag = 0, i_flag = 0, u_flag = 0; int verbosity = 0; int c_arg = 0, h_arg = 0, s_arg = 0; - u_int32_t l_arg = 0; + uint32_t l_arg = 0; char *query; #ifdef HAS_MBR char *mbrfile = _PATH_MBR; diff --git a/sbin/fdisk/gpt.c b/sbin/fdisk/gpt.c index 105035d3bbc..7a15a0d11a3 100644 --- a/sbin/fdisk/gpt.c +++ b/sbin/fdisk/gpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gpt.c,v 1.12 2021/01/30 18:16:36 krw Exp $ */ +/* $OpenBSD: gpt.c,v 1.13 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 2015 Markus Muller * Copyright (c) 2015 Kenneth R Westerback @@ -304,7 +304,7 @@ GPT_print_part(int n, char *units, int verbosity) int GPT_init(void) { - extern u_int32_t b_arg; + extern uint32_t b_arg; const int secsize = unit_types[SECTORS].conversion; struct uuid guid; int needed; @@ -387,7 +387,7 @@ GPT_write(void) const int secsize = unit_types[SECTORS].conversion; ssize_t len; off_t off; - u_int64_t altgh, altgp; + uint64_t altgh, altgp; /* Assume we always write full-size partition table. XXX */ altgh = DL_GETDSIZE(&dl) - 1; @@ -465,8 +465,8 @@ gp_lba_start_cmp(const void *e1, const void *e2) { struct gpt_partition *p1 = *(struct gpt_partition **)e1; struct gpt_partition *p2 = *(struct gpt_partition **)e2; - u_int64_t o1; - u_int64_t o2; + uint64_t o1; + uint64_t o2; o1 = letoh64(p1->gp_lba_start); o2 = letoh64(p2->gp_lba_start); diff --git a/sbin/fdisk/mbr.c b/sbin/fdisk/mbr.c index 4239c9951b5..9ae252354e4 100644 --- a/sbin/fdisk/mbr.c +++ b/sbin/fdisk/mbr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.c,v 1.67 2016/09/01 16:17:46 krw Exp $ */ +/* $OpenBSD: mbr.c,v 1.68 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -34,7 +34,7 @@ struct mbr initial_mbr; -static int gpt_chk_mbr(struct dos_partition *, u_int64_t); +static int gpt_chk_mbr(struct dos_partition *, uint64_t); int MBR_protective_mbr(struct mbr *mbr) @@ -74,8 +74,8 @@ MBR_init_GPT(struct mbr *mbr) void MBR_init(struct mbr *mbr) { - extern u_int32_t b_arg; - u_int64_t adj; + extern uint32_t b_arg; + uint64_t adj; daddr_t i; /* @@ -299,11 +299,11 @@ MBR_zapgpt(struct dos_mbr *dos_mbr, uint64_t lastsec) * NOTE: MS always uses a size of UINT32_MAX for the EFI partition!** */ int -gpt_chk_mbr(struct dos_partition *dp, u_int64_t dsize) +gpt_chk_mbr(struct dos_partition *dp, uint64_t dsize) { struct dos_partition *dp2; int efi, found, i; - u_int32_t psize; + uint32_t psize; found = efi = 0; for (dp2=dp, i=0; i < NDOSPART; i++, dp2++) { diff --git a/sbin/fdisk/mbr.h b/sbin/fdisk/mbr.h index 25c0581797a..e75e83d65e1 100644 --- a/sbin/fdisk/mbr.h +++ b/sbin/fdisk/mbr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbr.h,v 1.28 2015/11/18 15:31:15 krw Exp $ */ +/* $OpenBSD: mbr.h,v 1.29 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -24,7 +24,7 @@ struct mbr { off_t offset; unsigned char code[DOSPARTOFF]; struct prt part[NDOSPART]; - u_int16_t signature; + uint16_t signature; }; extern struct mbr initial_mbr; diff --git a/sbin/fdisk/misc.c b/sbin/fdisk/misc.c index 759dfb3ae67..fa10b5d5375 100644 --- a/sbin/fdisk/misc.c +++ b/sbin/fdisk/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.64 2021/01/31 14:24:47 naddy Exp $ */ +/* $OpenBSD: misc.c,v 1.65 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -200,8 +200,8 @@ ask_yn(const char *str) /* * adapted from sbin/disklabel/editor.c */ -u_int64_t -getuint64(char *prompt, u_int64_t oval, u_int64_t minval, u_int64_t maxval) +uint64_t +getuint64(char *prompt, uint64_t oval, uint64_t minval, uint64_t maxval) { const int secsize = unit_types[SECTORS].conversion; char buf[BUFSIZ], *endptr, *p, operator = '\0'; @@ -318,7 +318,7 @@ getuint64(char *prompt, u_int64_t oval, u_int64_t minval, u_int64_t maxval) } } while (1); - return((u_int64_t)d); + return((uint64_t)d); } char * @@ -348,11 +348,11 @@ ask_string(const char *prompt, const char *oval) * in Hacker's Delight), the Hacker's Assistant, and any code submitted * by readers. Submitters implicitly agree to this." */ -u_int32_t -crc32(const u_char *buf, const u_int32_t size) +uint32_t +crc32(const u_char *buf, const uint32_t size) { int j; - u_int32_t i, byte, crc, mask; + uint32_t i, byte, crc, mask; crc = 0xFFFFFFFF; @@ -369,7 +369,7 @@ crc32(const u_char *buf, const u_int32_t size) } char * -utf16le_to_string(u_int16_t *utf) +utf16le_to_string(uint16_t *utf) { static char name[GPTPARTNAMESIZE]; int i; @@ -385,10 +385,10 @@ utf16le_to_string(u_int16_t *utf) return (name); } -u_int16_t * +uint16_t * string_to_utf16le(char *ch) { - static u_int16_t utf[GPTPARTNAMESIZE]; + static uint16_t utf[GPTPARTNAMESIZE]; int i; for (i = 0; i < GPTPARTNAMESIZE; i++) { diff --git a/sbin/fdisk/misc.h b/sbin/fdisk/misc.h index e80ae59edda..50e1dc2de82 100644 --- a/sbin/fdisk/misc.h +++ b/sbin/fdisk/misc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.h,v 1.33 2015/11/21 16:45:41 krw Exp $ */ +/* $OpenBSD: misc.h,v 1.34 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -35,9 +35,9 @@ int ask_num(const char *, int, int, int); int ask_pid(int, struct uuid *); char *ask_string(const char *, const char *); int ask_yn(const char *); -u_int64_t getuint64(char *, u_int64_t, u_int64_t, u_int64_t); -u_int32_t crc32(const u_char *, const u_int32_t); -char *utf16le_to_string(u_int16_t *); -u_int16_t *string_to_utf16le(char *); +uint64_t getuint64(char *, uint64_t, uint64_t, uint64_t); +uint32_t crc32(const u_char *, const uint32_t); +char *utf16le_to_string(uint16_t *); +uint16_t *string_to_utf16le(char *); #endif /* _MISC_H */ diff --git a/sbin/fdisk/part.c b/sbin/fdisk/part.c index 542c169d4e6..c119e21da86 100644 --- a/sbin/fdisk/part.c +++ b/sbin/fdisk/part.c @@ -1,4 +1,4 @@ -/* $OpenBSD: part.c,v 1.77 2017/03/26 00:22:49 sobrado Exp $ */ +/* $OpenBSD: part.c,v 1.78 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -175,7 +175,7 @@ PRT_parse(struct dos_partition *prt, off_t offset, off_t reloff, struct prt *partn) { off_t off; - u_int32_t t; + uint32_t t; partn->flag = prt->dp_flag; partn->shead = prt->dp_shd; @@ -197,9 +197,9 @@ PRT_parse(struct dos_partition *prt, off_t offset, off_t reloff, partn->bs = letoh32(prt->dp_start) + off; partn->ns = letoh32(prt->dp_size); #else - memcpy(&t, &prt->dp_start, sizeof(u_int32_t)); + memcpy(&t, &prt->dp_start, sizeof(uint32_t)); partn->bs = letoh32(t) + off; - memcpy(&t, &prt->dp_size, sizeof(u_int32_t)); + memcpy(&t, &prt->dp_size, sizeof(uint32_t)); partn->ns = letoh32(t); #endif @@ -226,8 +226,8 @@ PRT_make(struct prt *partn, off_t offset, off_t reloff, struct dos_partition *prt) { off_t off; - u_int32_t ecsave, scsave; - u_int64_t t; + uint32_t ecsave, scsave; + uint64_t t; /* Save (and restore below) cylinder info we may fiddle with. */ scsave = partn->scyl; @@ -259,9 +259,9 @@ PRT_make(struct prt *partn, off_t offset, off_t reloff, prt->dp_typ = partn->id & 0xFF; t = htole64(partn->bs - off); - memcpy(&prt->dp_start, &t, sizeof(u_int32_t)); + memcpy(&prt->dp_start, &t, sizeof(uint32_t)); t = htole64(partn->ns); - memcpy(&prt->dp_size, &t, sizeof(u_int32_t)); + memcpy(&prt->dp_size, &t, sizeof(uint32_t)); partn->scyl = scsave; partn->ecyl = ecsave; @@ -300,9 +300,9 @@ PRT_print(int num, struct prt *partn, char *units) void PRT_fix_BN(struct prt *part, int pn) { - u_int32_t spt, tpc, spc; - u_int32_t start = 0; - u_int32_t end = 0; + uint32_t spt, tpc, spc; + uint32_t start = 0; + uint32_t end = 0; /* Zero out entry if not used */ if (part->id == DOSPTYP_UNUSED) { @@ -334,9 +334,9 @@ PRT_fix_BN(struct prt *part, int pn) void PRT_fix_CHS(struct prt *part) { - u_int32_t spt, tpc, spc; - u_int32_t start, end, size; - u_int32_t cyl, head, sect; + uint32_t spt, tpc, spc; + uint32_t start, end, size; + uint32_t cyl, head, sect; /* Zero out entry if not used */ if (part->id == DOSPTYP_UNUSED || part->ns == 0) { diff --git a/sbin/fdisk/part.h b/sbin/fdisk/part.h index f075c113dd5..46076db1129 100644 --- a/sbin/fdisk/part.h +++ b/sbin/fdisk/part.h @@ -1,4 +1,4 @@ -/* $OpenBSD: part.h,v 1.21 2015/11/26 08:15:07 tim Exp $ */ +/* $OpenBSD: part.h,v 1.22 2021/05/07 22:15:13 krw Exp $ */ /* * Copyright (c) 1997 Tobias Weingartner @@ -20,10 +20,10 @@ #define _PART_H struct prt { - u_int64_t bs; - u_int64_t ns; - u_int32_t shead, scyl, ssect; - u_int32_t ehead, ecyl, esect; + uint64_t bs; + uint64_t ns; + uint32_t shead, scyl, ssect; + uint32_t ehead, ecyl, esect; unsigned char flag; unsigned char id; };