-/* $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
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);
-/* $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
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);
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;
-/* $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
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);
-/* $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
#include "mbrcode.h"
};
-u_int32_t b_arg;
+uint32_t b_arg;
int y_flag;
static void
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;
-/* $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 <mmu@grummel.net>
* Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org>
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;
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;
{
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);
-/* $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
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)
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;
/*
* 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++) {
-/* $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
off_t offset;
unsigned char code[DOSPARTOFF];
struct prt part[NDOSPART];
- u_int16_t signature;
+ uint16_t signature;
};
extern struct mbr initial_mbr;
-/* $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
/*
* 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';
}
} while (1);
- return((u_int64_t)d);
+ return((uint64_t)d);
}
char *
* 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;
}
char *
-utf16le_to_string(u_int16_t *utf)
+utf16le_to_string(uint16_t *utf)
{
static char name[GPTPARTNAMESIZE];
int i;
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++) {
-/* $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
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 */
-/* $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
struct prt *partn)
{
off_t off;
- u_int32_t t;
+ uint32_t t;
partn->flag = prt->dp_flag;
partn->shead = prt->dp_shd;
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
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;
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;
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) {
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) {
-/* $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
#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;
};