From cc1a53bc1aea0675d64e9547cdca241612906592 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Fri, 29 Apr 2022 09:18:02 -0400 Subject: [PATCH] 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. MFC after: 2 weeks Sponsored by: The FreeBSD Foundation --- 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 cbe4f497d7d..3fea648f938 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 9cfbcbc30d7..1e68b0931f1 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 3fbd867275d..ff706ad9956 100644 --- a/usr.sbin/makefs/msdos/msdosfs_denode.c +++ b/usr.sbin/makefs/msdos/msdosfs_denode.c @@ -210,7 +210,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; @@ -253,7 +252,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); @@ -295,14 +294,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) { @@ -321,7 +319,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 ed33856716f..5bc9b495c58 100644 --- a/usr.sbin/makefs/msdos/msdosfs_vnops.c +++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c @@ -537,7 +537,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;