BSD 4_3_Net_2 release
[unix-history] / usr / src / sbin / newfs / mkfs.c
index bb1b58a..d180509 100644 (file)
@@ -2,23 +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.
  *
- * Redistribution and use in source and binary forms are permitted provided
- * that: (1) source distributions retain this entire copyright notice and
- * comment, and (2) distributions including binaries display the following
- * acknowledgement:  ``This product includes software developed by the
- * University of California, Berkeley and its contributors'' in the
- * documentation or other materials provided with the distribution and in
- * all advertising materials mentioning features or use of this software.
- * 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 ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ * 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.15 (Berkeley) 6/29/90";
+static char sccsid[] = "@(#)mkfs.c     6.18 (Berkeley) 7/3/91";
 #endif /* not lint */
 
 #ifndef STANDALONE
 #endif /* not lint */
 
 #ifndef STANDALONE
@@ -115,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)
@@ -128,7 +141,9 @@ mkfs(pp, fsys, fi, fo)
        long used, mincpgcnt, bpcg;
        long mapcramped, inodecramped;
        long postblsize, rotblsize, totalsbsize;
        long used, mincpgcnt, bpcg;
        long mapcramped, inodecramped;
        long postblsize, rotblsize, totalsbsize;
-       int ppid, status, started();
+       int ppid, status;
+       time_t utime;
+       void started();
 
 #ifndef STANDALONE
        time(&utime);
 
 #ifndef STANDALONE
        time(&utime);
@@ -577,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)
@@ -592,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)
@@ -631,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;
@@ -765,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;
 
@@ -917,6 +934,7 @@ iput(ip, ino)
 /*
  * Notify parent process that the filesystem has created itself successfully.
  */
 /*
  * Notify parent process that the filesystem has created itself successfully.
  */
+void
 started()
 {
 
 started()
 {