diff options
author | obrien <obrien@FreeBSD.org> | 2001-04-02 01:25:55 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2001-04-02 01:25:55 +0000 |
commit | d74457c7fee6b3e0c28e125587ce31c9c85fdb06 (patch) | |
tree | ab28c07b151043b1a77da918c0fbe51aeb91a01c /sbin | |
parent | 3100bf9079fdce415a0e7394dfaeb5914b09c958 (diff) | |
download | FreeBSD-src-d74457c7fee6b3e0c28e125587ce31c9c85fdb06.zip FreeBSD-src-d74457c7fee6b3e0c28e125587ce31c9c85fdb06.tar.gz |
Allow enabling soft updates (with -U) on a new filesystem.
[I first added this functionality, and thought to check prior art. Seeing
OpenBSD had already done this, I changed my addition to reduce the diffs
between the two and went with their option letter.]
Obtained from: OpenBSD
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/newfs/mkfs.c | 9 | ||||
-rw-r--r-- | sbin/newfs/newfs.8 | 6 | ||||
-rw-r--r-- | sbin/newfs/newfs.c | 9 |
3 files changed, 18 insertions, 6 deletions
diff --git a/sbin/newfs/mkfs.c b/sbin/newfs/mkfs.c index 4cf854b..daa5bae 100644 --- a/sbin/newfs/mkfs.c +++ b/sbin/newfs/mkfs.c @@ -95,6 +95,7 @@ extern char *mfs_mtpt; /* mount point for mfs */ extern struct stat mfs_mtstat; /* stat prior to mount */ extern int Nflag; /* run mkfs without writing file system */ extern int Oflag; /* format as an 4.3BSD file system */ +extern int Uflag; /* enable soft updates for file system */ extern int fssize; /* file system size */ extern int ntracks; /* # tracks/cylinder */ extern int nsectors; /* # sectors/track */ @@ -253,6 +254,9 @@ mkfs(pp, fsys, fi, fo) sblock.fs_inodefmt = FS_44INODEFMT; sblock.fs_maxsymlinklen = MAXSYMLINKLEN; } + if (Uflag) { + sblock.fs_flags |= FS_DOSOFTDEP; + } /* * Validate the given file system size. * Verify that its last block can actually be accessed. @@ -673,11 +677,12 @@ next: fsys, sblock.fs_size * NSPF(&sblock), sblock.fs_ncyl, "cylinders", sblock.fs_ntrak, sblock.fs_nsect); #define B2MBFACTOR (1 / (1024.0 * 1024.0)) - printf("\t%.1fMB in %d cyl groups (%d c/g, %.2fMB/g, %d i/g)\n", + printf("\t%.1fMB in %d cyl groups (%d c/g, %.2fMB/g, %d i/g)%s\n", (float)sblock.fs_size * sblock.fs_fsize * B2MBFACTOR, sblock.fs_ncg, sblock.fs_cpg, (float)sblock.fs_fpg * sblock.fs_fsize * B2MBFACTOR, - sblock.fs_ipg); + sblock.fs_ipg, + sblock.fs_flags & FS_DOSOFTDEP ? " SOFTUPDATES" : ""); #undef B2MBFACTOR } /* diff --git a/sbin/newfs/newfs.8 b/sbin/newfs/newfs.8 index ef90f88..d39ea4d 100644 --- a/sbin/newfs/newfs.8 +++ b/sbin/newfs/newfs.8 @@ -41,7 +41,7 @@ .Nd construct a new file system .Sh SYNOPSIS .Nm -.Op Fl NO +.Op Fl NOU .Op Fl S Ar sector-size .Op Fl T Ar disktype .Op Fl a Ar maxcontig @@ -65,7 +65,7 @@ .Op Fl x Ar sectors .Ar special .Nm mount_mfs -.Op Fl N +.Op Fl NU .Op Fl F Ar file .Op Fl T Ar disktype .Op Fl a Ar maxcontig @@ -148,6 +148,8 @@ Cause the file system parameters to be printed out without really creating the file system. .It Fl O Create a +.It Fl U +Enables soft updates on the new filesystem. .Bx 4.3 format filesystem. This options is primarily used to build root filesystems diff --git a/sbin/newfs/newfs.c b/sbin/newfs/newfs.c index b006a8a..e755993 100644 --- a/sbin/newfs/newfs.c +++ b/sbin/newfs/newfs.c @@ -173,6 +173,7 @@ char *mfs_mtpt; /* mount point for mfs */ struct stat mfs_mtstat; /* stat prior to mount */ int Nflag; /* run without writing file system */ int Oflag; /* format as an 4.3BSD file system */ +int Uflag; /* enable soft updates for file system */ int fssize; /* file system size */ int ntracks = NTRACKS; /* # tracks/cylinder */ int nsectors = NSECTORS; /* # sectors/track */ @@ -255,8 +256,8 @@ main(argc, argv) } opstring = mfs ? - "NF:T:a:b:c:d:e:f:i:m:o:s:" : - "NOS:T:a:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:vx:"; + "NF:T:Ua:b:c:d:e:f:i:m:o:s:" : + "NOS:T:Ua:b:c:d:e:f:i:k:l:m:n:o:p:r:s:t:u:vx:"; while ((ch = getopt(argc, argv, opstring)) != -1) switch (ch) { case 'N': @@ -277,6 +278,9 @@ main(argc, argv) case 'F': filename = optarg; break; + case 'U': + Uflag = 1; + break; case 'a': if ((maxcontig = atoi(optarg)) <= 0) fatal("%s: bad maximum contiguous blocks", @@ -757,6 +761,7 @@ usage() #ifdef COMPAT fprintf(stderr, "\t-T disktype\n"); #endif + fprintf(stderr, "\t-U enable soft updates\n"); fprintf(stderr, "\t-a maximum contiguous blocks\n"); fprintf(stderr, "\t-b block size\n"); fprintf(stderr, "\t-c cylinders/group\n"); |