-/* $OpenBSD: disklabel.c,v 1.226 2017/09/29 18:32:09 otto Exp $ */
+/* $OpenBSD: disklabel.c,v 1.227 2018/02/25 17:24:44 krw Exp $ */
/*
* Copyright (c) 1987, 1993
case '?':
default:
usage();
- }
+ }
argc -= optind;
argv += optind;
op = READ;
if (argc < 1 || (fstabfile && !(op == EDITOR || op == RESTORE ||
- aflag)))
+ aflag)))
usage();
if (argv[0] == NULL)
else
ret = WEXITSTATUS(st);
- fail:
+fail:
saved_errno = errno;
(void)signal(SIGHUP, sighup);
(void)signal(SIGINT, sigint);
v = GETNUM(lp->d_drivedata[i], cp, 0, &errstr);
if (errstr)
warnx("line %d: bad drivedata %s",
- lineno, cp);
+ lineno, cp);
lp->d_drivedata[i++] = v;
tp = word(cp);
}
}
}
pp = &lp->d_partitions[part];
-#define NXTNUM(n, field, errstr) { \
- if (tp == NULL) { \
- warnx("line %d: too few fields", lineno); \
- errors++; \
- break; \
- } else \
+#define NXTNUM(n, field, errstr) { \
+ if (tp == NULL) { \
+ warnx("line %d: too few fields", lineno); \
+ errors++; \
+ break; \
+ } else \
cp = tp, tp = word(cp), (n) = GETNUM(field, cp, 0, errstr); \
}
NXTNUM(lv, lv, &errstr);
v = FS_UNUSED;
}
pp->p_fstype = v;
- gottype:
+gottype:
switch (pp->p_fstype) {
case FS_UNUSED: /* XXX */
}
warnx("line %d: unknown field: %s", lineno, cp);
errors++;
- next:
+next:
;
}
errors += checklabel(lp);
-/* $OpenBSD: editor.c,v 1.312 2018/02/24 21:00:00 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.313 2018/02/25 17:24:44 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com>
void editor_name(struct disklabel *, char *);
char *getstring(const char *, const char *, const char *);
u_int64_t getuint64(struct disklabel *, char *, char *, u_int64_t, u_int64_t,
- u_int64_t, int);
+ u_int64_t, int);
int has_overlap(struct disklabel *);
int partition_cmp(const void *, const void *);
struct partition **sort_partitions(struct disklabel *);
int get_size(struct disklabel *, int);
void get_geometry(int, struct disklabel **);
void set_geometry(struct disklabel *, struct disklabel *, struct disklabel *,
- char *);
+ char *);
void zero_partitions(struct disklabel *);
u_int64_t max_partition_size(struct disklabel *, int);
void display_edit(struct disklabel *, char, u_int64_t);
new_size = new_offset = 0;
for (i = 0; chunks[i].start != 0 || chunks[i].stop != 0; i++) {
if (chunks[i].stop - chunks[i].start > new_size) {
- new_size = chunks[i].stop - chunks[i].start;
- new_offset = chunks[i].start;
+ new_size = chunks[i].stop - chunks[i].start;
+ new_offset = chunks[i].start;
}
}
DL_SETPSIZE(pp, new_size);
if (strcasecmp(p, "IDE") == 0)
ui = DTYPE_ESDI;
else
- for (ui = 1; ui < DKMAXTYPES &&
- strcasecmp(p, dktypenames[ui]); ui++)
+ for (ui = 1; ui < DKMAXTYPES && strcasecmp(p,
+ dktypenames[ui]); ui++)
;
if (ui < DKMAXTYPES) {
break;
fputs("Command aborted\n", stderr);
*lp = oldlabel; /* undo damage */
return;
- } if (ui == ULLONG_MAX)
+ } else if (ui == ULLONG_MAX)
fputs("Invalid entry\n", stderr);
else
break;
/* Starting sector */
do {
ui = getuint64(lp, "Starting sector",
- "The start of the OpenBSD portion of the disk.",
- starting_sector, DL_GETDSIZE(lp), 0, 0);
+ "The start of the OpenBSD portion of the disk.",
+ starting_sector, DL_GETDSIZE(lp), 0, 0);
if (ui == ULLONG_MAX - 1) {
fputs("Command aborted\n", stderr);
return;
/* Size */
do {
ui = getuint64(lp, "Size ('*' for entire disk)",
- "The size of the OpenBSD portion of the disk ('*' for the "
- "entire disk).", ending_sector - starting_sector,
- DL_GETDSIZE(lp) - start_temp, 0, 0);
+ "The size of the OpenBSD portion of the disk ('*' for the "
+ "entire disk).", ending_sector - starting_sector,
+ DL_GETDSIZE(lp) - start_temp, 0, 0);
if (ui == ULLONG_MAX - 1) {
fputs("Command aborted\n", stderr);
return;
int i, fstype;
ui = getuint64(lp, "offset",
- "Starting sector for this partition.",
- DL_GETPOFFSET(pp),
- DL_GETPOFFSET(pp), 0, DO_CONVERSIONS |
- (pp->p_fstype == FS_BSDFFS ? DO_ROUNDING : 0));
+ "Starting sector for this partition.",
+ DL_GETPOFFSET(pp),
+ DL_GETPOFFSET(pp), 0, DO_CONVERSIONS |
+ (pp->p_fstype == FS_BSDFFS ? DO_ROUNDING : 0));
if (ui == ULLONG_MAX - 1)
fputs("Command aborted\n", stderr);
if (ui == ULLONG_MAX - 1) {
fputs("Command aborted\n", stderr);
return(1);
- } if (ui == ULLONG_MAX)
+ } else if (ui == ULLONG_MAX)
fputs("Invalid entry\n", stderr);
else
break;
switch (tolower(unit)) {
case 't':
- factor *= 1024;
+ factor *= 1024;
/* FALLTHROUGH */
case 'g':
- factor *= 1024;
+ factor *= 1024;
/* FALLTHROUGH */
case 'm':
- factor *= 1024;
+ factor *= 1024;
/* FALLTHROUGH */
case 'k':
factor *= 1024;