Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/ufs/ufs #if DIAGNOSTIC panic ---> KASSERT



details:   https://anonhg.NetBSD.org/src/rev/e988f5ec06f5
branches:  trunk
changeset: 822382:e988f5ec06f5
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 18 05:33:06 2017 +0000

description:
#if DIAGNOSTIC panic ---> KASSERT

diffstat:

 sys/ufs/ufs/ufs_bmap.c  |  19 +++++++------------
 sys/ufs/ufs/ufs_vnops.c |  18 ++++++++----------
 2 files changed, 15 insertions(+), 22 deletions(-)

diffs (93 lines):

diff -r 832db6a94aa7 -r e988f5ec06f5 sys/ufs/ufs/ufs_bmap.c
--- a/sys/ufs/ufs/ufs_bmap.c    Sat Mar 18 05:20:04 2017 +0000
+++ b/sys/ufs/ufs/ufs_bmap.c    Sat Mar 18 05:33:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_bmap.c,v 1.51 2017/03/01 10:42:45 hannken Exp $    */
+/*     $NetBSD: ufs_bmap.c,v 1.52 2017/03/18 05:33:06 riastradh Exp $  */
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.51 2017/03/01 10:42:45 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.52 2017/03/18 05:33:06 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -127,10 +127,8 @@
        ip = VTOI(vp);
        mp = vp->v_mount;
        ump = ip->i_ump;
-#ifdef DIAGNOSTIC
-       if ((ap != NULL && nump == NULL) || (ap == NULL && nump != NULL))
-               panic("ufs_bmaparray: invalid arguments");
-#endif
+       KASSERTMSG(((ap == NULL) == (nump == NULL)),
+           "ufs_bmaparray: invalid arguments: ap = %p, nump = %p", ap, nump);
 
        if (runp) {
                /*
@@ -249,12 +247,9 @@
                }
                if (bp->b_oflags & (BO_DONE | BO_DELWRI)) {
                        trace(TR_BREADHIT, pack(vp, size), metalbn);
-               }
-#ifdef DIAGNOSTIC
-               else if (!daddr)
-                       panic("ufs_bmaparray: indirect block not in cache");
-#endif
-               else {
+               } else {
+                       KASSERTMSG((daddr != 0),
+                           "ufs_bmaparray: indirect block not in cache");
                        trace(TR_BREADMISS, pack(vp, size), metalbn);
                        bp->b_blkno = blkptrtodb(ump, daddr);
                        bp->b_flags |= B_READ;
diff -r 832db6a94aa7 -r e988f5ec06f5 sys/ufs/ufs/ufs_vnops.c
--- a/sys/ufs/ufs/ufs_vnops.c   Sat Mar 18 05:20:04 2017 +0000
+++ b/sys/ufs/ufs/ufs_vnops.c   Sat Mar 18 05:33:06 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_vnops.c,v 1.235 2017/03/01 10:42:45 hannken Exp $  */
+/*     $NetBSD: ufs_vnops.c,v 1.236 2017/03/18 05:39:06 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.235 2017/03/01 10:42:45 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.236 2017/03/18 05:39:06 riastradh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -865,10 +865,9 @@
                error = UFS_WAPBL_BEGIN(dvp->v_mount);
                if (error)
                        break;
-#ifdef DIAGNOSTIC
-               if (ump->um_maxsymlinklen <= 0)
-                       panic("ufs_whiteout: old format filesystem");
-#endif
+
+               KASSERTMSG((ump->um_maxsymlinklen > 0),
+                   "ufs_whiteout: old format filesystem");
 
                newdir = pool_cache_get(ufs_direct_cache, PR_WAITOK);
                newdir->d_ino = UFS_WINO;
@@ -886,10 +885,9 @@
                error = UFS_WAPBL_BEGIN(dvp->v_mount);
                if (error)
                        break;
-#ifdef DIAGNOSTIC
-               if (ump->um_maxsymlinklen <= 0)
-                       panic("ufs_whiteout: old format filesystem");
-#endif
+
+               KASSERTMSG((ump->um_maxsymlinklen > 0),
+                   "ufs_whiteout: old format filesystem");
 
                cnp->cn_flags &= ~DOWHITEOUT;
                error = ufs_dirremove(dvp, ulr, NULL, cnp->cn_flags, 0);



Home | Main Index | Thread Index | Old Index