Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/dump_lfs use a union to eliminate strict alias warnings.
details: https://anonhg.NetBSD.org/src/rev/5aa6a4bddc49
branches: trunk
changeset: 768309:5aa6a4bddc49
user: christos <christos%NetBSD.org@localhost>
date: Sun Aug 14 12:13:24 2011 +0000
description:
use a union to eliminate strict alias warnings.
diffstat:
sbin/dump_lfs/Makefile | 7 +------
sbin/dump_lfs/lfs_inode.c | 25 +++++++++++++++----------
2 files changed, 16 insertions(+), 16 deletions(-)
diffs (81 lines):
diff -r 2a1cbc8d082a -r 5aa6a4bddc49 sbin/dump_lfs/Makefile
--- a/sbin/dump_lfs/Makefile Sun Aug 14 12:09:35 2011 +0000
+++ b/sbin/dump_lfs/Makefile Sun Aug 14 12:13:24 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2011/06/22 02:49:43 mrg Exp $
+# $NetBSD: Makefile,v 1.13 2011/08/14 12:13:24 christos Exp $
# @(#)Makefile 8.1 (Berkeley) 6/5/93
# lfs_inode.c LFS filestore-specific routines
@@ -29,8 +29,3 @@
${NETBSDSRCDIR}/sys/ufs/ffs
.include <bsd.prog.mk>
-
-# XXX
-.if ${HAVE_GCC} == 45
-COPTS.lfs_inode.c+= -fno-strict-aliasing
-.endif
diff -r 2a1cbc8d082a -r 5aa6a4bddc49 sbin/dump_lfs/lfs_inode.c
--- a/sbin/dump_lfs/lfs_inode.c Sun Aug 14 12:09:35 2011 +0000
+++ b/sbin/dump_lfs/lfs_inode.c Sun Aug 14 12:13:24 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lfs_inode.c,v 1.14 2008/07/20 01:20:22 lukem Exp $ */
+/* $NetBSD: lfs_inode.c,v 1.15 2011/08/14 12:13:24 christos Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -39,7 +39,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/1/95";
#else
-__RCSID("$NetBSD: lfs_inode.c,v 1.14 2008/07/20 01:20:22 lukem Exp $");
+__RCSID("$NetBSD: lfs_inode.c,v 1.15 2011/08/14 12:13:24 christos Exp $");
#endif
#endif /* not lint */
@@ -79,7 +79,11 @@
int
fs_read_sblock(char *superblock)
{
- char tbuf[LFS_SBPAD];
+ union {
+ char tbuf[LFS_SBPAD];
+ struct lfs lfss;
+ } u;
+
int ns = 0;
off_t sboff = LFS_LABELPAD;
@@ -105,23 +109,24 @@
/*
* Read the secondary and take the older of the two
*/
- rawread(fsbtob(sblock, (off_t)sblock->lfs_sboffs[1]), tbuf, LFS_SBPAD);
+ rawread(fsbtob(sblock, (off_t)sblock->lfs_sboffs[1]), u.tbuf,
+ sizeof(u.tbuf));
#ifdef notyet
if (ns)
- lfs_sb_swap(tbuf, tbuf, 0);
+ lfs_sb_swap(u.tbuf, u.tbuf, 0);
#endif
- if (((struct lfs *)tbuf)->lfs_magic != LFS_MAGIC) {
+ if (u.lfss.lfs_magic != LFS_MAGIC) {
msg("Warning: secondary superblock at 0x%" PRIx64 " bad magic\n",
fsbtodb(sblock, (off_t)sblock->lfs_sboffs[1]));
} else {
if (sblock->lfs_version > 1) {
- if (((struct lfs *)tbuf)->lfs_serial < sblock->lfs_serial) {
- memcpy(sblock, tbuf, LFS_SBPAD);
+ if (u.lfss.lfs_serial < sblock->lfs_serial) {
+ memcpy(sblock, u.tbuf, sizeof(u.tbuf));
sboff = fsbtob(sblock, (off_t)sblock->lfs_sboffs[1]);
}
} else {
- if (((struct lfs *)tbuf)->lfs_otstamp < sblock->lfs_otstamp) {
- memcpy(sblock, tbuf, LFS_SBPAD);
+ if (u.lfss.lfs_otstamp < sblock->lfs_otstamp) {
+ memcpy(sblock, u.tbuf, sizeof(u.tbuf));
sboff = fsbtob(sblock, (off_t)sblock->lfs_sboffs[1]);
}
}
Home |
Main Index |
Thread Index |
Old Index