Author: jhb
Date: Wed Oct 26 15:17:42 2011
New Revision: 226793
URL: http://svn.freebsd.org/changeset/base/226793

Log:
  - Fixup filenames in a few more places where they are used.
  - Some whitespace fixes.

Modified:
  head/sys/kern/subr_witness.c

Modified: head/sys/kern/subr_witness.c
==============================================================================
--- head/sys/kern/subr_witness.c        Wed Oct 26 15:01:04 2011        
(r226792)
+++ head/sys/kern/subr_witness.c        Wed Oct 26 15:17:42 2011        
(r226793)
@@ -719,6 +719,18 @@ static int witness_cold = 1;
  */
 static int witness_spin_warn = 0;
 
+/* Trim useless garbage from filenames. */
+static const char *
+fixup_filename(const char *file)
+{
+
+       if (file == NULL)
+               return (NULL);
+       while (strncmp(file, "../", 3) == 0)
+               file += 3;
+       return (file);
+}
+
 /*
  * The WITNESS-enabled diagnostic code.  Note that the witness code does
  * assume that the early boot is single-threaded at least until after this
@@ -924,7 +936,7 @@ witness_ddb_display_descendants(int(*prn
        }
        w->w_displayed = 1;
        if (w->w_file != NULL && w->w_line != 0)
-               prnt(" -- last acquired @ %s:%d\n", w->w_file,
+               prnt(" -- last acquired @ %s:%d\n", fixup_filename(w->w_file),
                    w->w_line);
        else
                prnt(" -- never acquired\n");
@@ -990,18 +1002,6 @@ witness_ddb_display(int(*prnt)(const cha
 }
 #endif /* DDB */
 
-/* Trim useless garbage from filenames. */
-static const char *
-fixup_filename(const char *file)
-{
-
-       if (file == NULL)
-               return (NULL);
-       while (strncmp(file, "../", 3) == 0)
-               file += 3;
-       return (file);
-}
-
 int
 witness_defineorder(struct lock_object *lock1, struct lock_object *lock2)
 {
@@ -1167,12 +1167,12 @@ witness_checkorder(struct lock_object *l
                            "acquiring duplicate lock of same type: \"%s\"\n", 
                            w->w_name);
                        printf(" 1st %s @ %s:%d\n", plock->li_lock->lo_name,
-                              fixup_filename(plock->li_file), plock->li_line);
+                           fixup_filename(plock->li_file), plock->li_line);
                        printf(" 2nd %s @ %s:%d\n", lock->lo_name,
                            fixup_filename(file), line);
                        witness_debugger(1);
-                   } else
-                           mtx_unlock_spin(&w_mtx);
+               } else
+                       mtx_unlock_spin(&w_mtx);
                return;
        }
        mtx_assert(&w_mtx, MA_OWNED);
@@ -1483,7 +1483,8 @@ witness_downgrade(struct lock_object *lo
                if ((instance->li_flags & LI_RECURSEMASK) != 0)
                        panic("downgrade of recursed lock (%s) %s r=%d @ %s:%d",
                            class->lc_name, lock->lo_name,
-                           instance->li_flags & LI_RECURSEMASK, file, line);
+                           instance->li_flags & LI_RECURSEMASK,
+                           fixup_filename(file), line);
        }
        instance->li_flags &= ~LI_EXCLUSIVE;
 }
@@ -1533,8 +1534,7 @@ found:
        if ((instance->li_flags & LI_EXCLUSIVE) != 0 && witness_watch > 0 &&
            (flags & LOP_EXCLUSIVE) == 0) {
                printf("shared unlock of (%s) %s @ %s:%d\n", class->lc_name,
-                   lock->lo_name,
-                   fixup_filename(file), line);
+                   lock->lo_name, fixup_filename(file), line);
                printf("while exclusively locked from %s:%d\n",
                    fixup_filename(instance->li_file), instance->li_line);
                panic("excl->ushare");
@@ -2090,8 +2090,7 @@ witness_list_lock(struct lock_instance *
                prnt(" (%s)", lock->lo_witness->w_name);
        prnt(" r = %d (%p) locked @ %s:%d\n",
            instance->li_flags & LI_RECURSEMASK, lock,
-           fixup_filename(instance->li_file),
-           instance->li_line);
+           fixup_filename(instance->li_file), instance->li_line);
 }
 
 #ifdef DDB
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to