From dc6f8d1bd5a4a121a4ee9aaa10ed65a672fc5f27 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Mon, 23 Jun 1997 22:44:51 +0000 Subject: [PATCH] Allow use of the name "swap" instead of an actual swap device. This makes configuration of mfs /tmp on diskless clients more intuitive for people like me, that have used this feature on NetBSD and SunOS. Using the -T option and /dev/null, while already supported, is neither intuitive nor documented in the handbook. Obtained from: NetBSD --- sbin/newfs/newfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 71a3dfd14ea2..d0a67d242905 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -211,6 +211,7 @@ main(argc, argv) register int ch; register struct partition *pp; register struct disklabel *lp; + struct disklabel mfsfakelabel; struct disklabel *getdisklabel(); struct partition oldpartition; struct stat st; @@ -356,6 +357,35 @@ main(argc, argv) usage(); special = argv[0]; + /* Copy the NetBSD way of faking up a disk label */ + if (mfs && !strcmp(special, "swap")) { + /* + * it's an MFS, mounted on "swap." fake up a label. + * XXX XXX XXX + */ + fso = -1; /* XXX; normally done below. */ + + memset(&mfsfakelabel, 0, sizeof(mfsfakelabel)); + mfsfakelabel.d_secsize = 512; + mfsfakelabel.d_nsectors = 64; + mfsfakelabel.d_ntracks = 16; + mfsfakelabel.d_ncylinders = 16; + mfsfakelabel.d_secpercyl = 1024; + mfsfakelabel.d_secperunit = 16384; + mfsfakelabel.d_rpm = 3600; + mfsfakelabel.d_interleave = 1; + mfsfakelabel.d_npartitions = 1; + mfsfakelabel.d_partitions[0].p_size = 16384; + mfsfakelabel.d_partitions[0].p_fsize = 1024; + mfsfakelabel.d_partitions[0].p_frag = 8; + mfsfakelabel.d_partitions[0].p_cpg = 16; + + lp = &mfsfakelabel; + pp = &mfsfakelabel.d_partitions[0]; + + goto havelabel; + } + cp = strrchr(special, '/'); if (cp == 0) { /* @@ -430,6 +460,7 @@ main(argc, argv) fatal("%s: `%c' partition overlaps boot program", argv[0], *cp); } +havelabel: if (fssize == 0) fssize = pp->p_size; if (fssize > pp->p_size && !mfs)