| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $ */ | | 1 | /* $NetBSD: mkfs.c,v 1.137 2024/05/10 20:36:34 andvar Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1980, 1989, 1993 | | 4 | * Copyright (c) 1980, 1989, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -63,27 +63,27 @@ | | | @@ -63,27 +63,27 @@ |
63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 63 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 64 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 65 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 66 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 67 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
68 | * SUCH DAMAGE. | | 68 | * SUCH DAMAGE. |
69 | */ | | 69 | */ |
70 | | | 70 | |
71 | #include <sys/cdefs.h> | | 71 | #include <sys/cdefs.h> |
72 | #ifndef lint | | 72 | #ifndef lint |
73 | #if 0 | | 73 | #if 0 |
74 | static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; | | 74 | static char sccsid[] = "@(#)mkfs.c 8.11 (Berkeley) 5/3/95"; |
75 | #else | | 75 | #else |
76 | __RCSID("$NetBSD: mkfs.c,v 1.136 2024/02/22 02:11:29 mrg Exp $"); | | 76 | __RCSID("$NetBSD: mkfs.c,v 1.137 2024/05/10 20:36:34 andvar Exp $"); |
77 | #endif | | 77 | #endif |
78 | #endif /* not lint */ | | 78 | #endif /* not lint */ |
79 | | | 79 | |
80 | #include <sys/param.h> | | 80 | #include <sys/param.h> |
81 | #include <sys/mman.h> | | 81 | #include <sys/mman.h> |
82 | #include <sys/time.h> | | 82 | #include <sys/time.h> |
83 | #include <sys/resource.h> | | 83 | #include <sys/resource.h> |
84 | #include <ufs/ufs/dinode.h> | | 84 | #include <ufs/ufs/dinode.h> |
85 | #include <ufs/ufs/dir.h> | | 85 | #include <ufs/ufs/dir.h> |
86 | #include <ufs/ufs/ufs_bswap.h> | | 86 | #include <ufs/ufs/ufs_bswap.h> |
87 | #include <ufs/ufs/quota2.h> | | 87 | #include <ufs/ufs/quota2.h> |
88 | #include <ufs/ffs/fs.h> | | 88 | #include <ufs/ffs/fs.h> |
89 | #include <ufs/ffs/ffs_extern.h> | | 89 | #include <ufs/ffs/ffs_extern.h> |
| @@ -601,27 +601,27 @@ mkfs(const char *fsys, int fi, int fo, | | | @@ -601,27 +601,27 @@ mkfs(const char *fsys, int fi, int fo, |
601 | /* | | 601 | /* |
602 | * Validate the given file system size. | | 602 | * Validate the given file system size. |
603 | * Verify that its last block can actually be accessed. | | 603 | * Verify that its last block can actually be accessed. |
604 | * Convert to file system fragment sized units. | | 604 | * Convert to file system fragment sized units. |
605 | */ | | 605 | */ |
606 | if (fssize <= 0) { | | 606 | if (fssize <= 0) { |
607 | printf("preposterous size %lld\n", (long long)fssize); | | 607 | printf("preposterous size %lld\n", (long long)fssize); |
608 | fserr(13); | | 608 | fserr(13); |
609 | } | | 609 | } |
610 | wtfs(fssize - 1, sectorsize, iobuf); | | 610 | wtfs(fssize - 1, sectorsize, iobuf); |
611 | | | 611 | |
612 | /* | | 612 | /* |
613 | * Ensure there is nothing that looks like a filesystem | | 613 | * Ensure there is nothing that looks like a filesystem |
614 | * superbock anywhere other than where ours will be. | | 614 | * superblock anywhere other than where ours will be. |
615 | * If fsck finds the wrong one all hell breaks loose! | | 615 | * If fsck finds the wrong one all hell breaks loose! |
616 | */ | | 616 | */ |
617 | for (i = 0; ; i++) { | | 617 | for (i = 0; ; i++) { |
618 | static const int sblocklist[] = SBLOCKSEARCH; | | 618 | static const int sblocklist[] = SBLOCKSEARCH; |
619 | int sblkoff = sblocklist[i]; | | 619 | int sblkoff = sblocklist[i]; |
620 | int sz; | | 620 | int sz; |
621 | if (sblkoff == -1) | | 621 | if (sblkoff == -1) |
622 | break; | | 622 | break; |
623 | /* Remove main superblock */ | | 623 | /* Remove main superblock */ |
624 | zap_old_sblock(sblkoff); | | 624 | zap_old_sblock(sblkoff); |
625 | /* and all possible locations for the first alternate */ | | 625 | /* and all possible locations for the first alternate */ |
626 | sblkoff += SBLOCKSIZE; | | 626 | sblkoff += SBLOCKSIZE; |
627 | for (sz = SBLOCKSIZE; sz <= 0x10000; sz <<= 1) | | 627 | for (sz = SBLOCKSIZE; sz <= 0x10000; sz <<= 1) |