mkfs.c (8f829a5cf0fa341a95fd4bed7091d6c44129d68f) mkfs.c (34816cb9aeca7b0ad3289c2de04cad0cd1b111ed)
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2002 Networks Associates Technology, Inc.
5 * All rights reserved.
6 *
7 * This software was developed for the FreeBSD Project by Marshall
8 * Kirk McKusick and Network Associates Laboratories, the Security

--- 120 unchanged lines hidden (view full) ---

129 * specified by Oflag.
130 */
131 disk.d_bsize = sectorsize;
132 disk.d_ufs = Oflag;
133 if (Rflag)
134 utime = 1000000000;
135 else
136 time(&utime);
1/*-
2 * SPDX-License-Identifier: BSD-3-Clause
3 *
4 * Copyright (c) 2002 Networks Associates Technology, Inc.
5 * All rights reserved.
6 *
7 * This software was developed for the FreeBSD Project by Marshall
8 * Kirk McKusick and Network Associates Laboratories, the Security

--- 120 unchanged lines hidden (view full) ---

129 * specified by Oflag.
130 */
131 disk.d_bsize = sectorsize;
132 disk.d_ufs = Oflag;
133 if (Rflag)
134 utime = 1000000000;
135 else
136 time(&utime);
137 if ((sblock.fs_si = malloc(sizeof(struct fs_summary_info))) == NULL) {
138 printf("Superblock summary info allocation failed.\n");
139 exit(18);
140 }
137 sblock.fs_old_flags = FS_FLAGS_UPDATED;
138 sblock.fs_flags = 0;
139 if (Uflag)
140 sblock.fs_flags |= FS_DOSOFTDEP;
141 if (Lflag)
142 strlcpy(sblock.fs_volname, volumelabel, MAXVOLLEN);
143 if (Jflag)
144 sblock.fs_flags |= FS_GJOURNAL;

--- 398 unchanged lines hidden (view full) ---

543 if (fsbtodb(&fsdummy, cgsblock(&fsdummy, cg)) >
544 fssize)
545 break;
546 bwrite(&disk, part_ofs + fsbtodb(&fsdummy,
547 cgsblock(&fsdummy, cg)), chdummy, SBLOCKSIZE);
548 }
549 }
550 }
141 sblock.fs_old_flags = FS_FLAGS_UPDATED;
142 sblock.fs_flags = 0;
143 if (Uflag)
144 sblock.fs_flags |= FS_DOSOFTDEP;
145 if (Lflag)
146 strlcpy(sblock.fs_volname, volumelabel, MAXVOLLEN);
147 if (Jflag)
148 sblock.fs_flags |= FS_GJOURNAL;

--- 398 unchanged lines hidden (view full) ---

547 if (fsbtodb(&fsdummy, cgsblock(&fsdummy, cg)) >
548 fssize)
549 break;
550 bwrite(&disk, part_ofs + fsbtodb(&fsdummy,
551 cgsblock(&fsdummy, cg)), chdummy, SBLOCKSIZE);
552 }
553 }
554 }
555 /*
556 * Reference the summary information so it will also be written.
557 */
558 sblock.fs_csp = fscs;
551 if (!Nflag && sbput(disk.d_fd, &disk.d_fs, 0) != 0)
552 err(1, "sbput: %s", disk.d_error);
553 if (Xflag == 1) {
554 printf("** Exiting on Xflag 1\n");
555 exit(0);
556 }
557 if (Xflag == 2)
558 printf("** Leaving BAD MAGIC on Xflag 2\n");

--- 47 unchanged lines hidden (view full) ---

606 sblock.fs_old_cstotal.cs_nbfree = sblock.fs_cstotal.cs_nbfree;
607 sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree;
608 sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree;
609 }
610 if (Xflag == 3) {
611 printf("** Exiting on Xflag 3\n");
612 exit(0);
613 }
559 if (!Nflag && sbput(disk.d_fd, &disk.d_fs, 0) != 0)
560 err(1, "sbput: %s", disk.d_error);
561 if (Xflag == 1) {
562 printf("** Exiting on Xflag 1\n");
563 exit(0);
564 }
565 if (Xflag == 2)
566 printf("** Leaving BAD MAGIC on Xflag 2\n");

--- 47 unchanged lines hidden (view full) ---

614 sblock.fs_old_cstotal.cs_nbfree = sblock.fs_cstotal.cs_nbfree;
615 sblock.fs_old_cstotal.cs_nifree = sblock.fs_cstotal.cs_nifree;
616 sblock.fs_old_cstotal.cs_nffree = sblock.fs_cstotal.cs_nffree;
617 }
618 if (Xflag == 3) {
619 printf("** Exiting on Xflag 3\n");
620 exit(0);
621 }
614 /*
615 * Reference the summary information so it will also be written.
616 */
617 sblock.fs_csp = fscs;
618 if (sbput(disk.d_fd, &disk.d_fs, 0) != 0)
619 err(1, "sbput: %s", disk.d_error);
620 /*
621 * For UFS1 filesystems with a blocksize of 64K, the first
622 * alternate superblock resides at the location used for
623 * the default UFS2 superblock. As there is a valid
624 * superblock at this location, the boot code will use
625 * it as its first choice. Thus we have to ensure that

--- 567 unchanged lines hidden ---
622 if (sbput(disk.d_fd, &disk.d_fs, 0) != 0)
623 err(1, "sbput: %s", disk.d_error);
624 /*
625 * For UFS1 filesystems with a blocksize of 64K, the first
626 * alternate superblock resides at the location used for
627 * the default UFS2 superblock. As there is a valid
628 * superblock at this location, the boot code will use
629 * it as its first choice. Thus we have to ensure that

--- 567 unchanged lines hidden ---