summaryrefslogtreecommitdiff
path: root/sbin/disklabel/editor.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2022-09-03 13:59:26 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2022-09-03 13:59:26 +0000
commitde0eac2186993ad87ba0c283e85717de7acf9aef (patch)
tree53be71cf069775f7960cec2d23297f6b9e7e99a7 /sbin/disklabel/editor.c
parentf53ee6ba62a51e1ce82b8f5fbdf5642cb4b87758 (diff)
Add a new keyword to template files, 'raid', to allow the auto
allocation of RAID partitions. Make both 'raid' and 'swap' keywords case insensitive. Suggested by kn@ ok kn@ miod@
Diffstat (limited to 'sbin/disklabel/editor.c')
-rw-r--r--sbin/disklabel/editor.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c
index e43314fa001..47579948367 100644
--- a/sbin/disklabel/editor.c
+++ b/sbin/disklabel/editor.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: editor.c,v 1.374 2022/09/01 13:35:02 krw Exp $ */
+/* $OpenBSD: editor.c,v 1.375 2022/09/03 13:59:25 krw Exp $ */
/*
* Copyright (c) 1997-2000 Todd C. Miller <millert@openbsd.org>
@@ -675,9 +675,12 @@ again:
/* Everything seems ok so configure the partition. */
DL_SETPSIZE(pp, secs);
DL_SETPOFFSET(pp, chunkstart);
- if (ap->mp[0] != '/')
- pp->p_fstype = FS_SWAP;
- else {
+ if (ap->mp[0] != '/') {
+ if (strcasecmp(ap->mp, "raid") == 0)
+ pp->p_fstype = FS_RAID;
+ else
+ pp->p_fstype = FS_SWAP;
+ } else {
pp->p_fstype = FS_BSDFFS;
pp->p_fragblock = 0;
if (get_fsize(lp, partno) == 1 ||
@@ -1700,6 +1703,8 @@ mpsave(struct disklabel *lp)
for (i = 0; i < MAXPARTITIONS; i++) {
j = mi[i].partno;
fstype = lp->d_partitions[j].p_fstype;
+ if (fstype == FS_RAID)
+ continue;
if (fstype == FS_SWAP) {
fprintf(fp, "%s%c none swap sw\n", bdev, 'a'+j);
} else if (mi[i].mountpoint) {
@@ -2165,7 +2170,8 @@ parse_autotable(char *filename)
buf = line;
if ((sa->mp = get_token(&buf)) == NULL ||
- (sa->mp[0] != '/' && strcmp(sa->mp, "swap")))
+ (sa->mp[0] != '/' && strcasecmp(sa->mp, "swap") &&
+ strcasecmp(sa->mp, "raid")))
errx(1, "%s: parse error on line %u", filename, idx);
if ((t = get_token(&buf)) == NULL ||
parse_sizerange(t, &sa->minsz, &sa->maxsz) == -1)