BSD 4_3_Net_2 release
[unix-history] / usr / src / sbin / newfs / mkfs.c
index b37828d..d180509 100644 (file)
@@ -2,11 +2,37 @@
  * Copyright (c) 1980, 1989 The Regents of the University of California.
  * All rights reserved.
  *
  * Copyright (c) 1980, 1989 The Regents of the University of California.
  * All rights reserved.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)mkfs.c     6.17 (Berkeley) %G%";
+static char sccsid[] = "@(#)mkfs.c     6.18 (Berkeley) 7/3/91";
 #endif /* not lint */
 
 #ifndef STANDALONE
 #endif /* not lint */
 
 #ifndef STANDALONE
@@ -103,7 +129,6 @@ union {
 struct dinode zino[MAXBSIZE / sizeof(struct dinode)];
 
 int    fsi, fso;
 struct dinode zino[MAXBSIZE / sizeof(struct dinode)];
 
 int    fsi, fso;
-time_t utime;
 daddr_t        alloc();
 
 mkfs(pp, fsys, fi, fo)
 daddr_t        alloc();
 
 mkfs(pp, fsys, fi, fo)
@@ -117,6 +142,7 @@ mkfs(pp, fsys, fi, fo)
        long mapcramped, inodecramped;
        long postblsize, rotblsize, totalsbsize;
        int ppid, status;
        long mapcramped, inodecramped;
        long postblsize, rotblsize, totalsbsize;
        int ppid, status;
+       time_t utime;
        void started();
 
 #ifndef STANDALONE
        void started();
 
 #ifndef STANDALONE
@@ -453,7 +479,7 @@ mkfs(pp, fsys, fi, fo)
                    "Warning: insufficient space in super block for\n",
                    "rotational layout tables with nsect", sblock.fs_nsect,
                    "and ntrak", sblock.fs_ntrak,
                    "Warning: insufficient space in super block for\n",
                    "rotational layout tables with nsect", sblock.fs_nsect,
                    "and ntrak", sblock.fs_ntrak,
-                   "\nFile system performance may be impared.\n");
+                   "\nFile system performance may be impaired.\n");
                sblock.fs_cpc = 0;
                goto next;
        }
                sblock.fs_cpc = 0;
                goto next;
        }
@@ -566,7 +592,7 @@ next:
        if (!mfs)
                printf("super-block backups (for fsck -b #) at:");
        for (cylno = 0; cylno < sblock.fs_ncg; cylno++) {
        if (!mfs)
                printf("super-block backups (for fsck -b #) at:");
        for (cylno = 0; cylno < sblock.fs_ncg; cylno++) {
-               initcg(cylno);
+               initcg(cylno, utime);
                if (mfs)
                        continue;
                if (cylno % 9 == 0)
                if (mfs)
                        continue;
                if (cylno % 9 == 0)
@@ -581,7 +607,7 @@ next:
         * Now construct the initial file system,
         * then write out the super-block.
         */
         * Now construct the initial file system,
         * then write out the super-block.
         */
-       fsinit();
+       fsinit(utime);
        sblock.fs_time = utime;
        wtfs(SBOFF / sectorsize, sbsize, (char *)&sblock);
        for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize)
        sblock.fs_time = utime;
        wtfs(SBOFF / sectorsize, sbsize, (char *)&sblock);
        for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize)
@@ -620,8 +646,9 @@ next:
 /*
  * Initialize a cylinder group.
  */
 /*
  * Initialize a cylinder group.
  */
-initcg(cylno)
+initcg(cylno, utime)
        int cylno;
        int cylno;
+       time_t utime;
 {
        daddr_t cbase, d, dlower, dupper, dmax;
        long i, j, s;
 {
        daddr_t cbase, d, dlower, dupper, dmax;
        long i, j, s;
@@ -754,7 +781,8 @@ struct direct lost_found_dir[] = {
 #endif
 char buf[MAXBSIZE];
 
 #endif
 char buf[MAXBSIZE];
 
-fsinit()
+fsinit(utime)
+       time_t utime;
 {
        int i;
 
 {
        int i;