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
This commit is contained in:
Mark Johnston 2022-04-29 09:18:02 -04:00
parent f775c417fd
commit cc1a53bc1a
4 changed files with 8 additions and 9 deletions

View File

@ -16,7 +16,7 @@ SRCS= cd9660.c \
walk.c
MAN= makefs.8
WARNS?= 2
NO_WCAST_ALIGN=
CSTD= c11
.include "${SRCDIR}/cd9660/Makefile.inc"

View File

@ -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,

View File

@ -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);
}
/*

View File

@ -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;