diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-04-16 23:01:18 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2011-04-16 23:01:18 +0000 |
commit | 758666d4f052b1f9739bf20f7bda1e354c0b052c (patch) | |
tree | 68c4667cf0d09cc2819b63e89f29b41357937a88 /sbin | |
parent | 2e7b1d859b78148ac118ecdb68f1b680e1b63787 (diff) |
Add swap partition entries to -F and -f output. man page
updates to follow. This will simplify install script fstab
creation.
ok deraadt@
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/disklabel/editor.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/sbin/disklabel/editor.c b/sbin/disklabel/editor.c index eb3bd1b357b..8b13a5eb1ec 100644 --- a/sbin/disklabel/editor.c +++ b/sbin/disklabel/editor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: editor.c,v 1.251 2011/04/16 11:44:41 krw Exp $ */ +/* $OpenBSD: editor.c,v 1.252 2011/04/16 23:01:17 krw Exp $ */ /* * Copyright (c) 1997-2000 Todd C. Miller <Todd.Miller@courtesan.com> @@ -1817,6 +1817,7 @@ mpsave(struct disklabel *lp) char bdev[MAXPATHLEN], *p; struct mountinfo mi[MAXPARTITIONS]; FILE *fp; + u_int8_t fstype; if (!fstabfile) return; @@ -1824,7 +1825,8 @@ mpsave(struct disklabel *lp) memset(&mi, 0, sizeof(mi)); for (i = 0; i < MAXPARTITIONS; i++) { - if (mountpoints[i] != NULL) { + fstype = lp->d_partitions[i].p_fstype; + if (mountpoints[i] != NULL || fstype == FS_SWAP) { mi[i].mountpoint = mountpoints[i]; mi[i].partno = i; } @@ -1854,12 +1856,16 @@ mpsave(struct disklabel *lp) qsort((void *)mi, MAXPARTITIONS, sizeof(struct mountinfo), micmp); if ((fp = fopen(fstabfile, "w"))) { - for (i = 0; i < MAXPARTITIONS && mi[i].mountpoint; i++) { + for (i = 0; i < MAXPARTITIONS; i++) { j = mi[i].partno; - fprintf(fp, "%s%c %s %s rw 1 %d\n", bdev, 'a' + j, - mi[i].mountpoint, - fstypesnames[lp->d_partitions[j].p_fstype], - j == 0 ? 1 : 2); + fstype = lp->d_partitions[j].p_fstype; + if (fstype == FS_SWAP) { + fprintf(fp, "%s%c none swap sw\n", bdev, 'a'+j); + } else if (mi[i].mountpoint) { + fprintf(fp, "%s%c %s %s rw 1 %d\n", bdev, + 'a' + j, mi[i].mountpoint, + fstypesnames[fstype], j == 0 ? 1 : 2); + } } fclose(fp); } |