diff options
author | tegge <tegge@FreeBSD.org> | 1997-06-23 22:44:51 +0000 |
---|---|---|
committer | tegge <tegge@FreeBSD.org> | 1997-06-23 22:44:51 +0000 |
commit | ad743ec5a780aa7edfe7fb9e64ec9a738e7aceda (patch) | |
tree | b1c3fbc5d1578956174ece912a8ff0721c8ca1b2 /sbin/newfs/newfs.c | |
parent | b2627a7a7f3369f0fb09f620fcf031df7218efd8 (diff) | |
download | FreeBSD-src-ad743ec5a780aa7edfe7fb9e64ec9a738e7aceda.zip FreeBSD-src-ad743ec5a780aa7edfe7fb9e64ec9a738e7aceda.tar.gz |
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
Diffstat (limited to 'sbin/newfs/newfs.c')
-rw-r--r-- | sbin/newfs/newfs.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index 71a3dfd..d0a67d2 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) |