Subject: removing incorrect 32 bit ufs casts
To: None <tech-kern@netbsd.org>
From: Darrin B. Jewell <dbj@netbsd.org>
List: tech-kern
Date: 07/20/2004 11:55:37
--=-=-=


I would like to commit the following patch which fixes some problems
when trying to use a ufs2 filesystem with more than 31 bits worth of
sectors (1tb).

I'd like some feedback to ensure that I won't break lfs, ext2 or ufs1
filesystems by commiting this change.

Thanks,
Darrin


--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment; filename=my.diff
Content-Description: patch to remove incorrect casts in ufs

Index: ufs/ufs_bmap.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ufs/ufs_bmap.c,v
retrieving revision 1.29
diff -u -u -p -r1.29 ufs_bmap.c
--- ufs/ufs_bmap.c	25 May 2004 14:55:46 -0000	1.29
+++ ufs/ufs_bmap.c	20 Jul 2004 15:45:48 -0000
@@ -312,7 +312,7 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, run
 		*bnp = -1;
 		return (0);
 	}
-	*bnp = blkptrtodb(ump, (int32_t)daddr); /* XXX ondisk32 */
+	*bnp = blkptrtodb(ump, daddr);
 	if (*bnp == 0) {
 		if (ip->i_flags & SF_SNAPSHOT) {
 			*bnp = blkptrtodb(ump, bn * ump->um_seqinc);
Index: ufs/ufs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ufs/ufs_vnops.c,v
retrieving revision 1.116
diff -u -u -p -r1.116 ufs_vnops.c
--- ufs/ufs_vnops.c	20 Jun 2004 18:25:54 -0000	1.116
+++ ufs/ufs_vnops.c	20 Jul 2004 15:45:50 -0000
@@ -1744,10 +1744,10 @@ ufs_strategy(void *v)
 			biodone(bp);
 			return (error);
 		}
-		if ((long)bp->b_blkno == -1) /* no valid data */
+		if (bp->b_blkno == -1) /* no valid data */
 			clrbuf(bp);
 	}
-	if ((long)bp->b_blkno < 0) { /* block is not on disk */
+	if (bp->b_blkno < 0) { /* block is not on disk */
 		biodone(bp);
 		return (0);
 	}

--=-=-=--