FreeBSD/sys/kern/subr_witness.c
/*
 * Generic code for the isitmy*() functions. The rmask parameter is the
 * expected relationship of w1 to w2.
 */
Generic code for the isitmy*() functions. The rmask parameter is the
expected relationship of w1 to w2.
Generic code for the isitmy * () functions . The rmask parameter is the expected relationship of w1 to w2 .
static int
_isitmyx(struct witness *w1, struct witness *w2, int rmask, const char *fname)
{
	unsigned char r1, r2;
	int i1, i2;
	i1 = w1->w_index;
	i2 = w2->w_index;
	WITNESS_INDEX_ASSERT(i1);
	WITNESS_INDEX_ASSERT(i2);
	r1 = w_rmatrix[i1][i2] & WITNESS_RELATED_MASK;
	r2 = w_rmatrix[i2][i1] & WITNESS_RELATED_MASK;
	if (!((WITNESS_ATOD(r1) == r2 && WITNESS_DTOA(r2) == r1) ||
	    (WITNESS_DTOA(r1) == r2 && WITNESS_ATOD(r2) == r1))) {
		if (!mtx_owned(&w_mtx))
			return (0);
		printf("%s: rmatrix mismatch between %s (index %d) and %s "
		    "(index %d): w_rmatrix[%d][%d] == %hhx but "
		    "w_rmatrix[%d][%d] == %hhx\n",
		    fname, w1->w_name, i1, w2->w_name, i2, i1, i2, r1,
		    i2, i1, r2);
		kdb_backtrace();
		printf("Witness disabled.\n");
		witness_watch = -1;
	}
	return (r1 & rmask);
}
static int _isitmyx ( struct witness * w1 , struct witness * w2 , int rmask , const char * fname ) { unsigned char r1 , r2 ; int i1 , i2 ; i1 = w1 -> w_index ; i2 = w2 -> w_index ; WITNESS_INDEX_ASSERT ( i1 ) ; WITNESS_INDEX_ASSERT ( i2 ) ; r1 = w_rmatrix [ i1 ] [ i2 ] & WITNESS_RELATED_MASK ; r2 = w_rmatrix [ i2 ] [ i1 ] & WITNESS_RELATED_MASK ; if ( ! ( ( WITNESS_ATOD ( r1 ) == r2 && WITNESS_DTOA ( r2 ) == r1 ) || ( WITNESS_DTOA ( r1 ) == r2 && WITNESS_ATOD ( r2 ) == r1 ) ) ) { if ( ! mtx_owned ( & w_mtx ) ) return ( 0 ) ; printf ( " " " " " \n " , fname , w1 -> w_name , i1 , w2 -> w_name , i2 , i1 , i2 , r1 , i2 , i1 , r2 ) ; kdb_backtrace ( ) ; printf ( " \n " ) ; witness_watch = -1 ; } return ( r1 & rmask ) ; }
Generic code for the isitmy*() functions.
Generic code for the isitmy * () functions .
/* The flags on one better be the inverse of the flags on the other */ /* Don't squawk if we're potentially racing with an update. */