- Fixup filenames in a few more places where they are used.
- Some whitespace fixes.
This commit is contained in:
parent
52f047eeac
commit
c48fb4da4c
@ -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(*prnt)(const char *fmt, ...),
|
||||
}
|
||||
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 char *fmt, ...))
|
||||
}
|
||||
#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 *lock, int flags, const char *file,
|
||||
"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 *lock, int flags, const char *file,
|
||||
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 @@ witness_unlock(struct lock_object *lock, int flags, const char *file, int line)
|
||||
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 *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
|
||||
|
Loading…
Reference in New Issue
Block a user