Don't use cast expressions as lvalues as newer versions of gcc warn.

This commit is contained in:
skrll 2006-04-21 15:00:49 +00:00
parent 93127a7b4c
commit 7ba7efe154
9 changed files with 77 additions and 56 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: dump.h,v 1.41 2005/12/24 20:55:03 perry Exp $ */
/* $NetBSD: dump.h,v 1.42 2006/04/21 15:00:49 skrll Exp $ */
/*-
* Copyright (c) 1980, 1993
@ -40,6 +40,13 @@ union dinode {
#define DIP(dp, field) \
(is_ufs2 ? (dp)->dp2.di_##field : (dp)->dp1.di_##field)
#define DIP_SET(dp, field, val) do { \
if (is_ufs2) \
(dp)->dp2.di_##field = (val); \
else \
(dp)->dp1.di_##field = (val); \
} while (0)
/*
* Filestore-independent UFS data, so code can be more easily shared
* between ffs, lfs, and maybe ext2fs and others as well.

View File

@ -1,4 +1,4 @@
/* $NetBSD: traverse.c,v 1.45 2005/08/19 02:07:18 christos Exp $ */
/* $NetBSD: traverse.c,v 1.46 2006/04/21 15:00:49 skrll Exp $ */
/*-
* Copyright (c) 1980, 1988, 1991, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)traverse.c 8.7 (Berkeley) 6/15/95";
#else
__RCSID("$NetBSD: traverse.c,v 1.45 2005/08/19 02:07:18 christos Exp $");
__RCSID("$NetBSD: traverse.c,v 1.46 2006/04/21 15:00:49 skrll Exp $");
#endif
#endif /* not lint */
@ -488,8 +488,8 @@ dumpino(union dinode *dp, ino_t ino)
* as a zero length file.
*/
if (DIP(dp, flags) & SF_SNAPSHOT) {
DIP(dp, size) = 0;
DIP(dp, flags) &= ~SF_SNAPSHOT;
DIP_SET(dp, size, 0);
DIP_SET(dp, flags, DIP(dp, flags) & ~SF_SNAPSHOT);
}
if (!is_ufs2) {
if (needswap)

View File

@ -1,4 +1,4 @@
/* $NetBSD: dir.c,v 1.47 2005/12/23 12:58:11 yamt Exp $ */
/* $NetBSD: dir.c,v 1.48 2006/04/21 15:00:49 skrll Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)dir.c 8.8 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: dir.c,v 1.47 2005/12/23 12:58:11 yamt Exp $");
__RCSID("$NetBSD: dir.c,v 1.48 2006/04/21 15:00:49 skrll Exp $");
#endif
#endif /* not lint */
@ -418,7 +418,7 @@ adjust(struct inodesc *idesc, int lcnt)
printf(" (ADJUSTED)\n");
}
if (preen || reply("ADJUST") == 1) {
DIP(dp, nlink) = iswap16(nlink - lcnt);
DIP_SET(dp, nlink, iswap16(nlink - lcnt));
inodirty();
} else
markclean= 0;
@ -600,7 +600,7 @@ linkup(ino_t orphan, ino_t parentdir, char *name)
(void)makeentry(orphan, lfdir, "..");
dp = ginode(lfdir);
nlink = DIP(dp, nlink);
DIP(dp, nlink) = iswap16(iswap16(nlink) + 1);
DIP_SET(dp, nlink, iswap16(iswap16(nlink) + 1));
inodirty();
inoinfo(lfdir)->ino_linkcnt++;
reparent(orphan, lfdir);
@ -654,8 +654,8 @@ makeentry(ino_t parent, ino_t ino, const char *name)
idesc.id_name = name;
dp = ginode(parent);
if (iswap64(DIP(dp, size)) % dirblksiz) {
DIP(dp, size) =
iswap64(roundup(iswap64(DIP(dp, size)), dirblksiz));
DIP_SET(dp, size,
iswap64(roundup(iswap64(DIP(dp, size)), dirblksiz)));
inodirty();
}
if ((ckinode(dp, &idesc) & ALTERED) != 0)
@ -799,7 +799,7 @@ allocdir(ino_t parent, ino_t request, int mode)
cp += dirblksiz)
memmove(cp, &emptydir, sizeof emptydir);
dirty(bp);
DIP(dp, nlink) = iswap16(2);
DIP_SET(dp, nlink, iswap16(2));
inodirty();
if (ino == ROOTINO) {
inoinfo(ino)->ino_linkcnt = iswap16(DIP(dp, nlink));
@ -821,7 +821,7 @@ allocdir(ino_t parent, ino_t request, int mode)
inoinfo(parent)->ino_linkcnt++;
}
dp = ginode(parent);
DIP(dp, nlink) = iswap16(iswap16(DIP(dp, nlink)) + 1);
DIP_SET(dp, nlink, iswap16(iswap16(DIP(dp, nlink)) + 1));
inodirty();
return (ino);
}
@ -836,7 +836,7 @@ freedir(ino_t ino, ino_t parent)
if (ino != parent) {
dp = ginode(parent);
DIP(dp, nlink) = iswap16(iswap16(DIP(dp, nlink)) -1);
DIP_SET(dp, nlink, iswap16(iswap16(DIP(dp, nlink)) - 1));
inodirty();
}
freeino(ino);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsck.h,v 1.44 2005/12/24 20:55:04 perry Exp $ */
/* $NetBSD: fsck.h,v 1.45 2006/04/21 15:00:49 skrll Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -57,6 +57,13 @@ union dinode {
#define DIP(dp, field) \
(is_ufs2 ? (dp)->dp2.di_##field : (dp)->dp1.di_##field)
#define DIP_SET(dp, field, val) do { \
if (is_ufs2) \
(dp)->dp2.di_##field = (val); \
else \
(dp)->dp1.di_##field = (val); \
} while (0)
#ifndef BUFSIZ
#define BUFSIZ 1024
#endif
@ -120,6 +127,12 @@ struct bufarea {
#define IBLK(bp, i) \
(is_ufs2 ? (bp)->b_un.b_indir2[i] : (bp)->b_un.b_indir1[i])
#define IBLK_SET(bp, i, val) do { \
if (is_ufs2) \
(bp)->b_un.b_indir2[i] = (val); \
else \
(bp)->b_un.b_indir1[i] = (val); \
} while (0)
#define B_INUSE 1

View File

@ -1,4 +1,4 @@
/* $NetBSD: inode.c,v 1.56 2005/08/19 02:07:19 christos Exp $ */
/* $NetBSD: inode.c,v 1.57 2006/04/21 15:00:49 skrll Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)inode.c 8.8 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: inode.c,v 1.56 2005/08/19 02:07:19 christos Exp $");
__RCSID("$NetBSD: inode.c,v 1.57 2006/04/21 15:00:49 skrll Exp $");
#endif
#endif /* not lint */
@ -109,8 +109,8 @@ ckinode(union dinode *dp, struct inodesc *idesc)
pathbuf);
if (reply("ADJUST LENGTH") == 1) {
dp = ginode(idesc->id_number);
DIP(dp, size) = iswap64(i *
sblock->fs_bsize);
DIP_SET(dp, size, iswap64(i *
sblock->fs_bsize));
printf(
"YOU MUST RERUN FSCK AFTERWARDS\n");
rerun = 1;
@ -152,9 +152,9 @@ ckinode(union dinode *dp, struct inodesc *idesc)
pathbuf);
if (reply("ADJUST LENGTH") == 1) {
dp = ginode(idesc->id_number);
DIP(dp, size) =
DIP_SET(dp, size,
iswap64(iswap64(DIP(dp, size))
- remsize);
- remsize));
remsize = 0;
printf(
"YOU MUST RERUN FSCK AFTERWARDS\n");
@ -217,7 +217,7 @@ iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
"PARTIALLY TRUNCATED INODE I=%llu",
(unsigned long long)idesc->id_number);
if (dofix(idesc, buf)) {
IBLK(bp, i) = 0;
IBLK_SET(bp, i, 0);
dirty(bp);
} else
markclean= 0;
@ -248,9 +248,9 @@ iblock(struct inodesc *idesc, long ilevel, u_int64_t isize)
pathbuf);
if (reply("ADJUST LENGTH") == 1) {
dp = ginode(idesc->id_number);
DIP(dp, size) =
DIP_SET(dp, size,
iswap64(iswap64(DIP(dp, size))
- isize);
- isize));
isize = 0;
printf(
"YOU MUST RERUN FSCK AFTERWARDS\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass1.c,v 1.40 2005/12/05 23:59:43 christos Exp $ */
/* $NetBSD: pass1.c,v 1.41 2006/04/21 15:00:49 skrll Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass1.c 8.6 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: pass1.c,v 1.40 2005/12/05 23:59:43 christos Exp $");
__RCSID("$NetBSD: pass1.c,v 1.41 2006/04/21 15:00:49 skrll Exp $");
#endif
#endif /* not lint */
@ -260,9 +260,9 @@ checkinode(ino_t inumber, struct inodesc *idesc)
}
if (!preen && mode == IFMT && reply("HOLD BAD BLOCK") == 1) {
dp = ginode(inumber);
DIP(dp, size) = iswap64(sblock->fs_fsize);
DIP_SET(dp, size, iswap64(sblock->fs_fsize));
size = sblock->fs_fsize;
DIP(dp, mode) = iswap16(IFREG|0600);
DIP_SET(dp, mode, iswap16(IFREG|0600));
inodirty();
}
ndb = howmany(size, sblock->fs_bsize);
@ -298,7 +298,7 @@ checkinode(ino_t inumber, struct inodesc *idesc)
}
dp = ginode(inumber);
memmove(dp->dp1.di_db, symbuf, (long)size);
DIP(dp, blocks) = 0;
DIP_SET(dp, blocks, 0);
inodirty();
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pass2.c,v 1.42 2005/06/27 01:25:35 christos Exp $ */
/* $NetBSD: pass2.c,v 1.43 2006/04/21 15:00:49 skrll Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)pass2.c 8.9 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: pass2.c,v 1.42 2005/06/27 01:25:35 christos Exp $");
__RCSID("$NetBSD: pass2.c,v 1.43 2006/04/21 15:00:49 skrll Exp $");
#endif
#endif /* not lint */
@ -115,8 +115,8 @@ pass2(void)
exit(EEXIT);
}
dp = ginode(ROOTINO);
DIP(dp, mode) =
iswap16((iswap16(DIP(dp, mode)) & ~IFMT) | IFDIR);
DIP_SET(dp, mode,
iswap16((iswap16(DIP(dp, mode)) & ~IFMT) | IFDIR));
inodirty();
break;
@ -162,7 +162,7 @@ pass2(void)
inp->i_isize = roundup(MINDIRSIZE, dirblksiz);
if (reply("FIX") == 1) {
dp = ginode(inp->i_number);
DIP(dp, size) = iswap64(inp->i_isize);
DIP_SET(dp, size, iswap64(inp->i_isize));
inodirty();
} else
markclean = 0;
@ -182,7 +182,7 @@ pass2(void)
inp->i_isize = roundup(inp->i_isize, dirblksiz);
if (preen || reply("ADJUST") == 1) {
dp = ginode(inp->i_number);
DIP(dp, size) = iswap64(inp->i_isize);
DIP_SET(dp, size, iswap64(inp->i_isize));
inodirty();
} else
markclean = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: fsdb.c,v 1.33 2005/08/19 02:07:19 christos Exp $ */
/* $NetBSD: fsdb.c,v 1.34 2006/04/21 15:00:49 skrll Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: fsdb.c,v 1.33 2005/08/19 02:07:19 christos Exp $");
__RCSID("$NetBSD: fsdb.c,v 1.34 2006/04/21 15:00:49 skrll Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -390,7 +390,7 @@ CMDFUNCSTART(uplink)
return 1;
nlink = iswap16(DIP(curinode, nlink));
nlink++;
DIP(curinode, nlink) = iswap16(nlink);
DIP_SET(curinode, nlink, iswap16(nlink));
printf("inode %llu link count now %d\n", (unsigned long long)curinum,
nlink);
inodirty();
@ -405,7 +405,7 @@ CMDFUNCSTART(downlink)
return 1;
nlink = iswap16(DIP(curinode, nlink));
nlink--;
DIP(curinode, nlink) = iswap16(nlink);
DIP_SET(curinode, nlink, iswap16(nlink));
printf("inode %llu link count now %d\n", (unsigned long long)curinum,
nlink);
inodirty();
@ -1078,7 +1078,7 @@ CMDFUNCSTART(newtype)
warnx("try one of `file', `dir', `socket', `fifo'");
return 1;
}
DIP(curinode, mode) = iswap16((mode & ~IFMT) | type);
DIP_SET(curinode, mode, iswap16((mode & ~IFMT) | type));
inodirty();
printactive();
return 0;
@ -1099,7 +1099,7 @@ CMDFUNCSTART(chmode)
return 1;
}
mode = iswap16(DIP(curinode, mode));
DIP(curinode, mode) = iswap16((mode & ~07777) | modebits);
DIP_SET(curinode, mode, iswap16((mode & ~07777) | modebits));
inodirty();
printactive();
return 0;
@ -1118,7 +1118,7 @@ CMDFUNCSTART(chlen)
warnx("bad length '%s'", argv[1]);
return 1;
}
DIP(curinode, size) = iswap64(len);
DIP_SET(curinode, size, iswap64(len));
inodirty();
printactive();
return 0;
@ -1142,7 +1142,7 @@ CMDFUNCSTART(chaflags)
flags);
return (1);
}
DIP(curinode, flags) = iswap32(flags);
DIP_SET(curinode, flags, iswap32(flags));
inodirty();
printactive();
return 0;
@ -1165,7 +1165,7 @@ CMDFUNCSTART(chgen)
warnx("gen set beyond 32-bit range of field (0x%lx)", gen);
return (1);
}
DIP(curinode, gen) = iswap32(gen);
DIP_SET(curinode, gen, iswap32(gen));
inodirty();
printactive();
return 0;
@ -1188,7 +1188,7 @@ CMDFUNCSTART(linkcount)
warnx("max link count is %d", USHRT_MAX);
return 1;
}
DIP(curinode, nlink) = iswap16(lcnt);
DIP_SET(curinode, nlink, iswap16(lcnt));
inodirty();
printactive();
return 0;
@ -1216,7 +1216,7 @@ CMDFUNCSTART(chowner)
if (!is_ufs2 && sblock->fs_old_inodefmt < FS_44INODEFMT)
curinode->dp1.di_ouid = iswap32(uid);
else
DIP(curinode, uid) = iswap32(uid);
DIP_SET(curinode, uid, iswap32(uid));
inodirty();
printactive();
return 0;
@ -1243,7 +1243,7 @@ CMDFUNCSTART(chgroup)
if (sblock->fs_old_inodefmt < FS_44INODEFMT)
curinode->dp1.di_ogid = iswap32(gid);
else
DIP(curinode, gid) = iswap32(gid);
DIP_SET(curinode, gid, iswap32(gid));
inodirty();
printactive();
return 0;
@ -1309,8 +1309,8 @@ CMDFUNCSTART(chmtime)
if (dotime(argv[1], &rsec, &nsec))
return 1;
DIP(curinode, mtime) = rsec;
DIP(curinode, mtimensec) = nsec;
DIP_SET(curinode, mtime, rsec);
DIP_SET(curinode, mtimensec, nsec);
inodirty();
printactive();
return 0;
@ -1322,8 +1322,8 @@ CMDFUNCSTART(chatime)
if (dotime(argv[1], &rsec, &nsec))
return 1;
DIP(curinode, atime) = rsec;
DIP(curinode, atimensec) = nsec;
DIP_SET(curinode, atime, rsec);
DIP_SET(curinode, atimensec, nsec);
inodirty();
printactive();
return 0;
@ -1335,8 +1335,8 @@ CMDFUNCSTART(chctime)
if (dotime(argv[1], &rsec, &nsec))
return 1;
DIP(curinode, ctime) = rsec;
DIP(curinode, ctimensec) = nsec;
DIP_SET(curinode, ctime, rsec);
DIP_SET(curinode, ctimensec, nsec);
inodirty();
printactive();
return 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: pt_filter.c,v 1.6 2006/03/21 21:34:01 christos Exp $ */
/* $NetBSD: pt_filter.c,v 1.7 2006/04/21 15:00:49 skrll Exp $ */
/*
* Copyright (c) 1999 The NetBSD Foundation, Inc.
@ -39,7 +39,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: pt_filter.c,v 1.6 2006/03/21 21:34:01 christos Exp $");
__RCSID("$NetBSD: pt_filter.c,v 1.7 2006/04/21 15:00:49 skrll Exp $");
#endif /* not lint */
#include <stdio.h>
@ -91,6 +91,7 @@ portal_rfilter(struct portal_cred *pcr, char *key, char **v, int kso, int *fdp)
char *path;
FILE *fp;
int error = 0;
char percent_s[] = "%s";
/* We don't use this parameter. */
(void) kso;
@ -124,7 +125,7 @@ portal_rfilter(struct portal_cred *pcr, char *key, char **v, int kso, int *fdp)
* v[3] could be NULL, or could point to "".
*/
if (!v[3] || strlen(v[3]) == 0)
(const char *)v[3] = "%s"; /* Handle above assumption. */
v[3] = percent_s; /* Handle above assumption. */
path = key;
/* Strip out stripkey if it matches leading part of key. */
if (!strncmp(v[1], key, strlen(v[1])))