to read.
No functional change.
-/* $OpenBSD: cmd.c,v 1.119 2021/07/11 12:51:36 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.120 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
int setpid(int, struct mbr *);
int parsepn(char *);
+extern const unsigned char manpage[];
+extern const int manpage_sz;
+
int
Xreinit(char *args, struct mbr *mbr)
{
- struct dos_mbr dos_mbr;
- int dogpt;
+ struct dos_mbr dos_mbr;
+ int dogpt;
dogpt = 0;
int
Xdisk(char *args, struct mbr *mbr)
{
- int maxcyl = 1024;
- int maxhead = 256;
- int maxsec = 63;
+ int maxcyl = 1024;
+ int maxhead = 256;
+ int maxsec = 63;
/* Print out disk info */
DISK_printgeometry(args);
int
Xswap(char *args, struct mbr *mbr)
{
- char *from, *to;
- int pf, pt;
- struct prt pp;
- struct gpt_partition gg;
+ char *from, *to;
+ int pf, pt;
+ struct prt pp;
+ struct gpt_partition gg;
to = args;
from = strsep(&to, " \t");
int
gedit(int pn)
{
- struct gpt_partition oldgg;
- struct gpt_partition *gg;
- char *name;
- uint16_t *utf;
- int i;
+ struct gpt_partition oldgg;
+ struct gpt_partition *gg;
+ char *name;
+ uint16_t *utf;
+ int i;
gg = &gp[pn];
oldgg = *gg;
int
parsepn(char *pnstr)
{
- const char *errstr;
- int maxpn, pn;
+ const char *errstr;
+ int maxpn, pn;
if (pnstr == NULL) {
printf("no partition number\n");
int
edit(int pn, struct mbr *mbr)
{
- struct prt oldpp;
- struct prt *pp;
+ struct prt oldpp;
+ struct prt *pp;
pp = &mbr->part[pn];
oldpp = *pp;
int
Xedit(char *args, struct mbr *mbr)
{
- int pn;
+ int pn;
pn = parsepn(args);
if (pn == -1)
int
gsetpid(int pn)
{
- struct uuid guid;
- struct gpt_partition *gg, oldgg;
- int num, status;
+ struct uuid guid;
+ struct gpt_partition *gg, oldgg;
+ int num, status;
gg = &gp[pn];
oldgg = *gg;
int
setpid(int pn, struct mbr *mbr)
{
- struct prt *pp;
- int num;
+ struct prt *pp;
+ int num;
pp = &mbr->part[pn];
int
Xsetpid(char *args, struct mbr *mbr)
{
- int pn;
+ int pn;
pn = parsepn(args);
if (pn == -1)
int
Xselect(char *args, struct mbr *mbr)
{
- static off_t firstoff = 0;
- off_t off;
- int pn;
+ static off_t firstoff = 0;
+ off_t off;
+ int pn;
pn = parsepn(args);
if (pn == -1)
int
Xprint(char *args, struct mbr *mbr)
{
- int efi;
+ int efi;
efi = MBR_protective_mbr(mbr);
if (efi != -1 && letoh64(gh.gh_sig) == GPTSIGNATURE)
int
Xwrite(char *args, struct mbr *mbr)
{
- struct dos_mbr dos_mbr;
- int efi, i, n;
+ struct dos_mbr dos_mbr;
+ int efi, i, n;
for (i = 0, n = 0; i < NDOSPART; i++)
if (mbr->part[i].id == 0xA6)
int
Xhelp(char *args, struct mbr *mbr)
{
- char help[80];
- char *mbrstr;
- int i;
+ char help[80];
+ char *mbrstr;
+ int i;
for (i = 0; cmd_table[i].cmd != NULL; i++) {
strlcpy(help, cmd_table[i].help, sizeof(help));
int
Xflag(char *args, struct mbr *mbr)
{
- const char *errstr;
- int i, pn;
- long long val = -1;
- char *part, *flag;
+ const char *errstr;
+ char *part, *flag;
+ long long val = -1;
+ int i, pn;
flag = args;
part = strsep(&flag, " \t");
int
Xmanual(char *args, struct mbr *mbr)
{
- char *pager = "/usr/bin/less";
- char *p;
- sig_t opipe;
- extern const unsigned char manpage[];
- extern const int manpage_sz;
- FILE *f;
+ char *pager = "/usr/bin/less";
+ char *p;
+ FILE *f;
+ sig_t opipe;
opipe = signal(SIGPIPE, SIG_IGN);
if ((p = getenv("PAGER")) != NULL && (*p != '\0'))
-/* $OpenBSD: disk.c,v 1.58 2021/07/11 12:51:36 krw Exp $ */
+/* $OpenBSD: disk.c,v 1.59 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
#include "disk.h"
#include "misc.h"
-struct disk disk;
-struct disklabel dl;
+struct disk disk;
+struct disklabel dl;
void
DISK_open(int rw)
{
- struct stat st;
- uint64_t sz, spc;
+ struct stat st;
+ uint64_t sz, spc;
disk.fd = opendev(disk.name, rw ? O_RDWR : O_RDONLY, OPENDEV_PART,
NULL);
int
DISK_printgeometry(char *units)
{
- const int secsize = unit_types[SECTORS].conversion;
- double size;
- int i;
+ const int secsize = unit_types[SECTORS].conversion;
+ double size;
+ int i;
i = unit_lookup(units);
size = ((double)disk.size * secsize) / unit_types[i].conversion;
char *
DISK_readsector(off_t where)
{
- int secsize;
- char *secbuf;
- ssize_t len;
- off_t off;
+ char *secbuf;
+ ssize_t len;
+ off_t off;
+ int secsize;
secsize = dl.d_secsize;
int
DISK_writesector(char *secbuf, off_t where)
{
- int secsize;
- ssize_t len;
- off_t off;
+ int secsize;
+ ssize_t len;
+ off_t off;
len = -1;
secsize = dl.d_secsize;
-/* $OpenBSD: fdisk.c,v 1.115 2021/07/11 12:51:36 krw Exp $ */
+/* $OpenBSD: fdisk.c,v 1.116 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
#include "user.h"
#include "gpt.h"
-#define _PATH_MBR _PATH_BOOTDIR "mbr"
-static unsigned char builtin_mbr[] = {
+#define _PATH_MBR _PATH_BOOTDIR "mbr"
+static unsigned char builtin_mbr[] = {
#include "mbrcode.h"
};
-uint32_t b_sectors, b_offset;
-uint8_t b_type;
-int A_flag, y_flag;
+uint32_t b_sectors, b_offset;
+uint8_t b_type;
+int A_flag, y_flag;
static void
usage(void)
{
- extern char * __progname;
+ extern char * __progname;
fprintf(stderr, "usage: %s "
"[-evy] [-i [-g] | -u | -A ] [-b blocks[@offset[:type]]]\n"
int
main(int argc, char *argv[])
{
- ssize_t len;
- int ch, fd, efi, error;
- unsigned int bps;
- int e_flag = 0, g_flag = 0, i_flag = 0, u_flag = 0;
- int verbosity = TERSE;
- int c_arg = 0, h_arg = 0, s_arg = 0;
- uint32_t l_arg = 0;
- char *query;
+ struct dos_mbr dos_mbr;
+ struct mbr mbr;
#ifdef HAS_MBR
- char *mbrfile = _PATH_MBR;
+ char *mbrfile = _PATH_MBR;
#else
- char *mbrfile = NULL;
+ char *mbrfile = NULL;
#endif
- struct dos_mbr dos_mbr;
- struct mbr mbr;
+ ssize_t len;
+ int ch, fd, efi, error;
+ unsigned int bps;
+ int e_flag = 0, g_flag = 0, i_flag = 0, u_flag = 0;
+ int verbosity = TERSE;
+ int c_arg = 0, h_arg = 0, s_arg = 0;
+ uint32_t l_arg = 0;
+ char *query;
while ((ch = getopt(argc, argv, "Aiegpuvf:c:h:s:l:b:y")) != -1) {
const char *errstr;
-/* $OpenBSD: gpt.c,v 1.35 2021/07/11 12:51:36 krw Exp $ */
+/* $OpenBSD: gpt.c,v 1.36 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 2015 Markus Muller <mmu@grummel.net>
* Copyright (c) 2015 Kenneth R Westerback <krw@openbsd.org>
#define DPRINTF(x...)
#endif
-struct gpt_header gh;
-struct gpt_partition gp[NGPTPARTITIONS];
+struct gpt_header gh;
+struct gpt_partition gp[NGPTPARTITIONS];
struct gpt_partition **sort_gpt(void);
int lba_start_cmp(const void *e1, const void *e2);
int
get_header(off_t where)
{
- char *secbuf;
- uint64_t partlastlba, partslen, lba_end;
- int partspersec;
- uint32_t orig_gh_csum, new_gh_csum;
+ char *secbuf;
+ uint64_t partlastlba, partslen, lba_end;
+ int partspersec;
+ uint32_t orig_gh_csum, new_gh_csum;
secbuf = DISK_readsector(where);
if (secbuf == 0)
int
get_partition_table(void)
{
- ssize_t len;
- off_t off, where;
- int secs;
- uint32_t checksum, partspersec;
+ ssize_t len;
+ off_t off, where;
+ int secs;
+ uint32_t checksum, partspersec;
DPRINTF("gpt partition table being read from LBA %llu\n",
letoh64(gh.gh_part_lba));
void
GPT_read(int which)
{
- int valid;
+ int valid;
switch (which) {
case PRIMARYGPT:
void
GPT_print(char *units, int verbosity)
{
- const int secsize = unit_types[SECTORS].conversion;
- struct uuid guid;
- char *guidstr = NULL;
- double size;
- int i, u, status;
+ const int secsize = unit_types[SECTORS].conversion;
+ struct uuid guid;
+ char *guidstr = NULL;
+ double size;
+ int i, u, status;
u = unit_lookup(units);
size = ((double)DL_GETDSIZE(&dl) * secsize) / unit_types[u].conversion;
void
GPT_print_part(int n, char *units, int verbosity)
{
- struct uuid guid;
- const int secsize = unit_types[SECTORS].conversion;
- struct gpt_partition *partn = &gp[n];
- char *guidstr = NULL;
- double size;
- int u, status;
+ struct uuid guid;
+ struct gpt_partition *partn = &gp[n];
+ char *guidstr = NULL;
+ const int secsize = unit_types[SECTORS].conversion;
+ double size;
+ int u, status;
uuid_dec_le(&partn->gp_type, &guid);
u = unit_lookup(units);
int
add_partition(const uint8_t *beuuid, const char *name, uint64_t sectors)
{
- struct uuid uuid, gp_type;
- int rslt;
- uint64_t end, freesectors, start;
- uint32_t status, pn, pncnt;
+ struct uuid uuid, gp_type;
+ int rslt;
+ uint64_t end, freesectors, start;
+ uint32_t status, pn, pncnt;
uuid_dec_be(beuuid, &uuid);
uuid_enc_le(&gp_type, &uuid);
int
init_gh(void)
{
- const int secsize = unit_types[SECTORS].conversion;
struct gpt_header oldgh;
struct uuid guid;
+ const int secsize = unit_types[SECTORS].conversion;
int needed;
uint32_t status;
int
init_gp(int how, uint32_t bootsectors)
{
- const uint8_t gpt_uuid_efi_system[] = GPT_UUID_EFI_SYSTEM;
- const uint8_t gpt_uuid_openbsd[] = GPT_UUID_OPENBSD;
- struct gpt_partition oldgp[NGPTPARTITIONS];
- int pn, rslt;
+ struct gpt_partition oldgp[NGPTPARTITIONS];
+ const uint8_t gpt_uuid_efi_system[] = GPT_UUID_EFI_SYSTEM;
+ const uint8_t gpt_uuid_openbsd[] = GPT_UUID_OPENBSD;
+ int pn, rslt;
memcpy(&oldgp, &gp, sizeof(oldgp));
if (how == GHANDGP)
int
GPT_init(int how, uint32_t bootsectors)
{
- int rslt = 0;
+ int rslt = 0;
if (how == GHANDGP)
rslt = init_gh();
void
GPT_zap_headers(void)
{
- char *secbuf;
- uint64_t sig;
+ char *secbuf;
+ uint64_t sig;
secbuf = DISK_readsector(GPTSECTOR);
if (secbuf == NULL)
int
GPT_write(void)
{
- char *secbuf;
- const int secsize = unit_types[SECTORS].conversion;
- ssize_t len;
- off_t off;
- uint64_t altgh, altgp, prigh, prigp, gpbytes;
+ char *secbuf;
+ ssize_t len;
+ off_t off;
+ const int secsize = unit_types[SECTORS].conversion;
+ uint64_t altgh, altgp, prigh, prigp, gpbytes;
/*
* XXX Assume size of gp is multiple of sector size.
int
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;
- uint64_t o1;
- uint64_t o2;
+ struct gpt_partition *p1 = *(struct gpt_partition **)e1;
+ struct gpt_partition *p2 = *(struct gpt_partition **)e2;
+ uint64_t o1;
+ uint64_t o2;
o1 = letoh64(p1->gp_lba_start);
o2 = letoh64(p2->gp_lba_start);
struct gpt_partition **
sort_gpt(void)
{
- static struct gpt_partition *sgp[NGPTPARTITIONS+2];
- unsigned int i, j;
+ static struct gpt_partition *sgp[NGPTPARTITIONS+2];
+ unsigned int i, j;
memset(sgp, 0, sizeof(sgp));
int
GPT_get_lba_start(unsigned int pn)
{
- uint64_t bs;
- unsigned int i;
- int rslt;
+ uint64_t bs;
+ unsigned int i;
+ int rslt;
bs = letoh64(gh.gh_lba_start);
-/* $OpenBSD: mbr.c,v 1.79 2021/07/11 12:51:36 krw Exp $ */
+/* $OpenBSD: mbr.c,v 1.80 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
#include "mbr.h"
#include "gpt.h"
-struct mbr initial_mbr;
+struct mbr initial_mbr;
-static int gpt_chk_mbr(struct dos_partition *, uint64_t);
+static int gpt_chk_mbr(struct dos_partition *, uint64_t);
int
MBR_protective_mbr(struct mbr *mbr)
{
- struct dos_partition dp[NDOSPART], dos_partition;
- int i;
+ struct dos_partition dp[NDOSPART], dos_partition;
+ int i;
if (mbr->offset != 0)
return -1;
void
MBR_init(struct mbr *mbr)
{
- extern uint32_t b_sectors, b_offset;
- extern uint8_t b_type;
- uint64_t adj;
- daddr_t daddr;
+ extern uint32_t b_sectors, b_offset;
+ extern uint8_t b_type;
+ uint64_t adj;
+ daddr_t daddr;
memset(&gh, 0, sizeof(gh));
memset(&gp, 0, sizeof(gp));
void
MBR_parse(struct dos_mbr *dos_mbr, off_t offset, off_t reloff, struct mbr *mbr)
{
- struct dos_partition dos_parts[NDOSPART];
- int i;
+ struct dos_partition dos_parts[NDOSPART];
+ int i;
memcpy(mbr->code, dos_mbr->dmbr_boot, sizeof(mbr->code));
mbr->offset = offset;
void
MBR_make(struct mbr *mbr, struct dos_mbr *dos_mbr)
{
- struct dos_partition dos_partition;
- int i;
+ struct dos_partition dos_partition;
+ int i;
memcpy(dos_mbr->dmbr_boot, mbr->code, sizeof(dos_mbr->dmbr_boot));
dos_mbr->dmbr_sign = htole16(DOSMBR_SIGNATURE);
void
MBR_print(struct mbr *mbr, char *units)
{
- int i;
+ int i;
DISK_printgeometry(NULL);
int
MBR_read(off_t where, struct dos_mbr *dos_mbr)
{
- char *secbuf;
+ char *secbuf;
secbuf = DISK_readsector(where);
if (secbuf == NULL)
int
MBR_write(off_t where, struct dos_mbr *dos_mbr)
{
- char *secbuf;
+ char *secbuf;
secbuf = DISK_readsector(where);
if (secbuf == NULL)
int
gpt_chk_mbr(struct dos_partition *dp, u_int64_t dsize)
{
- struct dos_partition *dp2;
- int efi, eficnt, found, i;
- uint32_t psize;
+ struct dos_partition *dp2;
+ int efi, eficnt, found, i;
+ uint32_t psize;
found = efi = eficnt = 0;
for (dp2 = dp, i = 0; i < NDOSPART; i++, dp2++) {
-/* $OpenBSD: misc.c,v 1.70 2021/07/11 12:51:36 krw Exp $ */
+/* $OpenBSD: misc.c,v 1.71 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
#include "misc.h"
#include "part.h"
-struct unit_type unit_types[] = {
+struct unit_type unit_types[] = {
{ "b" , 1LL , "Bytes" },
{ " " , 0LL , "Sectors" },
{ "K" , 1024LL , "Kilobytes" },
int
unit_lookup(char *units)
{
- int i = 0;
+ int i = 0;
if (units == NULL)
return SECTORS;
int
string_from_line(char *buf, size_t buflen)
{
- static char *line;
- static size_t sz;
- ssize_t len;
+ static char *line;
+ static size_t sz;
+ ssize_t len;
len = getline(&line, &sz, stdin);
if (len == -1)
void
ask_cmd(char **cmd, char **arg)
{
- static char lbuf[100];
- size_t cmdstart, cmdend, argstart;
+ static char lbuf[100];
+ size_t cmdstart, cmdend, argstart;
/* Get NUL terminated string from stdin. */
if (string_from_line(lbuf, sizeof(lbuf)))
int
ask_num(const char *str, int dflt, int low, int high)
{
- char lbuf[100];
- const char *errstr;
- int num;
+ char lbuf[100];
+ const char *errstr;
+ int num;
if (dflt < low)
dflt = low;
int
ask_pid(int dflt, struct uuid *guid)
{
- char lbuf[100], *cp;
- int num = -1, status;
+ char lbuf[100], *cp;
+ int num = -1, status;
do {
printf("Partition id ('0' to disable) [01 - FF]: [%X] ", dflt);
int
ask_yn(const char *str)
{
- int ch, first;
- extern int y_flag;
+ int ch, first;
+ extern int y_flag;
if (y_flag)
return 1;
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';
- size_t n;
- int64_t mult = 1;
- double d, d2;
- int rslt, secpercyl, saveerr;
- char unit;
+ char buf[BUFSIZ], *endptr, *p, operator = '\0';
+ const int secsize = unit_types[SECTORS].conversion;
+ size_t n;
+ int64_t mult = 1;
+ double d, d2;
+ int rslt, secpercyl, saveerr;
+ char unit;
if (oval > maxval)
oval = maxval;
char *
ask_string(const char *prompt, const char *oval)
{
- static char buf[UUID_STR_LEN + 1];
+ static char buf[UUID_STR_LEN + 1];
buf[0] = '\0';
printf("%s: [%s] ", prompt, oval ? oval : "");
uint32_t
crc32(const u_char *buf, const uint32_t size)
{
- int j;
- uint32_t i, byte, crc, mask;
+ int j;
+ uint32_t i, byte, crc, mask;
crc = 0xFFFFFFFF;
char *
utf16le_to_string(const uint16_t *utf)
{
- static char name[GPTPARTNAMESIZE];
- int i;
+ static char name[GPTPARTNAMESIZE];
+ int i;
for (i = 0; i < GPTPARTNAMESIZE; i++) {
name[i] = letoh16(utf[i]) & 0x7F;
uint16_t *
string_to_utf16le(const char *ch)
{
- static uint16_t utf[GPTPARTNAMESIZE];
- int i;
+ static uint16_t utf[GPTPARTNAMESIZE];
+ int i;
for (i = 0; i < GPTPARTNAMESIZE; i++) {
utf[i] = htole16((unsigned int)ch[i]);
void
parse_b(const char *arg, uint32_t *blocks, uint32_t *offset, uint8_t *type)
{
- const char *errstr;
- char *poffset, *ptype;
- uint32_t blockcount, blockoffset;
- uint8_t partitiontype;
+ const char *errstr;
+ char *poffset, *ptype;
+ uint32_t blockcount, blockoffset;
+ uint8_t partitiontype;
blockoffset = BLOCKALIGNMENT;
partitiontype = DOSPTYP_EFISYS;
-/* $OpenBSD: part.c,v 1.88 2021/07/11 12:51:36 krw Exp $ */
+/* $OpenBSD: part.c,v 1.89 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
#include "misc.h"
#include "part.h"
-int check_chs(struct prt *partn);
-const char *ascii_id(int);
+int check_chs(struct prt *partn);
+const char *ascii_id(int);
static const struct part_type {
int type;
int
PRT_protected_guid(struct uuid *leuuid)
{
- struct uuid uuid;
- char *str = NULL;
- int rslt;
- unsigned int i;
- uint32_t status;
+ struct uuid uuid;
+ char *str = NULL;
+ int rslt;
+ unsigned int i;
+ uint32_t status;
uuid_dec_le(leuuid, &uuid);
uuid_to_string(&uuid, &str, &status);
void
PRT_printall(void)
{
- int i, idrows;
+ int i, idrows;
idrows = ((sizeof(part_types)/sizeof(struct part_type))+3)/4;
const char *
ascii_id(int id)
{
- static char unknown[] = "<Unknown ID>";
- int i;
+ static char unknown[] = "<Unknown ID>";
+ int i;
for (i = 0; i < sizeof(part_types)/sizeof(struct part_type); i++) {
if (part_types[i].type == id)
PRT_parse(struct dos_partition *prt, off_t offset, off_t reloff,
struct prt *partn)
{
- off_t off;
- uint32_t t;
+ off_t off;
+ uint32_t t;
partn->flag = prt->dp_flag;
partn->shead = prt->dp_shd;
PRT_make(struct prt *partn, off_t offset, off_t reloff,
struct dos_partition *prt)
{
- off_t off;
- uint32_t ecsave, scsave;
- uint64_t t;
+ off_t off;
+ uint32_t ecsave, scsave;
+ uint64_t t;
/* Save (and restore below) cylinder info we may fiddle with. */
scsave = partn->scyl;
void
PRT_print(int num, struct prt *partn, char *units)
{
- const int secsize = unit_types[SECTORS].conversion;
- double size;
- int i;
+ const int secsize = unit_types[SECTORS].conversion;
+ double size;
+ int i;
i = unit_lookup(units);
void
PRT_fix_BN(struct prt *part, int pn)
{
- uint32_t spt, tpc, spc;
- uint32_t start = 0;
- uint32_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)
{
- uint32_t spt, tpc, spc;
- uint32_t start, end, size;
- uint32_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) {
char *
PRT_uuid_to_typename(struct uuid *uuid)
{
- static char partition_type[UUID_STR_LEN + 1];
- char *uuidstr = NULL;
- int i, entries, status;
+ static char partition_type[UUID_STR_LEN + 1];
+ char *uuidstr = NULL;
+ int i, entries, status;
memset(partition_type, 0, sizeof(partition_type));
int
PRT_uuid_to_type(struct uuid *uuid)
{
- char *uuidstr;
- int entries, i, status, type;
+ char *uuidstr;
+ int entries, i, status, type;
type = 0;
struct uuid *
PRT_type_to_uuid(int type)
{
- static struct uuid guid;
- int i, entries, status = uuid_s_ok;
+ static struct uuid guid;
+ int i, entries, status = uuid_s_ok;
memset(&guid, 0, sizeof(guid));
-/* $OpenBSD: user.c,v 1.55 2021/05/15 15:20:17 krw Exp $ */
+/* $OpenBSD: user.c,v 1.56 2021/07/11 13:38:27 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
#include "disk.h"
/* Our command table */
-struct cmd cmd_table[] = {
+struct cmd cmd_table[] = {
{"help", 1, Xhelp, "Command help list"},
{"manual", 1, Xmanual, "Show entire OpenBSD man page for fdisk"},
{"reinit", 1, Xreinit, "Re-initialize loaded MBR (to defaults)"},
};
-int modified;
+int modified;
void
USER_edit(off_t offset, off_t reloff)
{
- static int editlevel;
- struct dos_mbr dos_mbr;
- struct mbr mbr;
- char *cmd, *args;
- int i, st, efi, error;
+ struct dos_mbr dos_mbr;
+ struct mbr mbr;
+ char *cmd, *args;
+ int i, st, efi, error;
+ static int editlevel;
/* One level deeper */
editlevel += 1;
void
USER_print_disk(int verbosity)
{
- off_t offset, firstoff;
- int i, efi, error;
- struct dos_mbr dos_mbr;
- struct mbr mbr;
+ struct dos_mbr dos_mbr;
+ struct mbr mbr;
+ off_t offset, firstoff;
+ int i, efi, error;
offset = firstoff = 0;