git: bee87a73813d - stable/13 - makefs: Fix warnings and reset WARNS to the default

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 24 May 2022 13:51:47 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=bee87a73813d8599bdb926bd3dfb0704a35665c4

commit bee87a73813d8599bdb926bd3dfb0704a35665c4
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-04-29 13:18:02 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-05-24 13:51:36 +0000

    makefs: Fix warnings and reset WARNS to the default
    
    Leave -Wcast-align disabled, at least for now, since there are numerous
    instances of that warning in places where buffer pointers are cast to
    pointers to various filesystem structures.  Fixing this properly would
    be too much work for too little gain.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit cc1a53bc1aea0675d64e9547cdca241612906592)
---
 usr.sbin/makefs/Makefile               |  2 +-
 usr.sbin/makefs/ffs.c                  |  2 +-
 usr.sbin/makefs/msdos/msdosfs_denode.c | 10 ++++------
 usr.sbin/makefs/msdos/msdosfs_vnops.c  |  3 ++-
 4 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/usr.sbin/makefs/Makefile b/usr.sbin/makefs/Makefile
index cbe4f497d7d1..3fea648f9383 100644
--- a/usr.sbin/makefs/Makefile
+++ b/usr.sbin/makefs/Makefile
@@ -16,7 +16,7 @@ SRCS=	cd9660.c \
 	walk.c
 MAN=	makefs.8
 
-WARNS?=	2
+NO_WCAST_ALIGN=
 CSTD=	c11
 
 .include "${SRCDIR}/cd9660/Makefile.inc"
diff --git a/usr.sbin/makefs/ffs.c b/usr.sbin/makefs/ffs.c
index 7916d6a59ead..6429c54e8a9f 100644
--- a/usr.sbin/makefs/ffs.c
+++ b/usr.sbin/makefs/ffs.c
@@ -578,7 +578,7 @@ ffs_create_image(const char *image, fsinfo_t *fsopts)
 		    (long long)fs->fs_cstotal.cs_ndir);
 	}
 
-	if (fs->fs_cstotal.cs_nifree + UFS_ROOTINO < fsopts->inodes) {
+	if (fs->fs_cstotal.cs_nifree + (off_t)UFS_ROOTINO < fsopts->inodes) {
 		warnx(
 		"Image file `%s' has %lld free inodes; %lld are required.",
 		    image,
diff --git a/usr.sbin/makefs/msdos/msdosfs_denode.c b/usr.sbin/makefs/msdos/msdosfs_denode.c
index 7d37c7df3a3d..2c8a443caacf 100644
--- a/usr.sbin/makefs/msdos/msdosfs_denode.c
+++ b/usr.sbin/makefs/msdos/msdosfs_denode.c
@@ -213,7 +213,6 @@ int
 detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 {
 	int error;
-	int allerror;
 	u_long eofentry;
 	u_long chaintofree;
 	daddr_t bn;
@@ -256,7 +255,7 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 	if (length == 0) {
 		chaintofree = dep->de_StartCluster;
 		dep->de_StartCluster = 0;
-		eofentry = ~0;
+		eofentry = ~0ul;
 	} else {
 		error = pcbmap(dep, de_clcount(pmp, length) - 1, 0,
 		    &eofentry, 0);
@@ -298,14 +297,13 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 	dep->de_FileSize = length;
 	if (!isadir)
 		dep->de_flag |= DE_UPDATE|DE_MODIFIED;
-	MSDOSFS_DPRINTF(("detrunc(): allerror %d, eofentry %lu\n",
-	    allerror, eofentry));
+	MSDOSFS_DPRINTF(("detrunc(): eofentry %lu\n", eofentry));
 
 	/*
 	 * If we need to break the cluster chain for the file then do it
 	 * now.
 	 */
-	if (eofentry != ~0) {
+	if (eofentry != ~0ul) {
 		error = fatentry(FAT_GET_AND_SET, pmp, eofentry,
 				 &chaintofree, CLUST_EOFE);
 		if (error) {
@@ -324,7 +322,7 @@ detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred)
 	if (chaintofree != 0 && !MSDOSFSEOF(pmp, chaintofree))
 		freeclusterchain(pmp, chaintofree);
 
-	return (allerror);
+	return (0);
 }
 
 /*
diff --git a/usr.sbin/makefs/msdos/msdosfs_vnops.c b/usr.sbin/makefs/msdos/msdosfs_vnops.c
index 6f1275ee125d..ff470576ee79 100644
--- a/usr.sbin/makefs/msdos/msdosfs_vnops.c
+++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c
@@ -538,7 +538,8 @@ static const struct {
 };
 
 struct denode *
-msdosfs_mkdire(const char *path, struct denode *pdep, fsnode *node) {
+msdosfs_mkdire(const char *path __unused, struct denode *pdep, fsnode *node)
+{
 	struct denode ndirent;
 	struct denode *dep;
 	struct componentname cn;