kernels/linux-2.4.0/mm/mmap_avl.c
/* check a tree's consistency and balancing */
check a tree's consistency and balancing
check a tree ' s consistency and balancing
static void avl_checkheights (struct vm_area_struct * tree)
{
	int h, hl, hr;
	if (tree == vm_avl_empty)
		return;
	avl_checkheights(tree->vm_avl_left);
	avl_checkheights(tree->vm_avl_right);
	h = tree->vm_avl_height;
	hl = heightof(tree->vm_avl_left);
	hr = heightof(tree->vm_avl_right);
	if ((h == hl+1) && (hr <= hl) && (hl <= hr+1))
		return;
	if ((h == hr+1) && (hl <= hr) && (hr <= hl+1))
		return;
	printk("%s: avl_checkheights: heights inconsistent\n",avl_check_point);
}
static void avl_checkheights ( struct vm_area_struct * tree ) { int h , hl , hr ; if ( tree == vm_avl_empty ) return ; avl_checkheights ( tree -> vm_avl_left ) ; avl_checkheights ( tree -> vm_avl_right ) ; h = tree -> vm_avl_height ; hl = heightof ( tree -> vm_avl_left ) ; hr = heightof ( tree -> vm_avl_right ) ; if ( ( h == hl + 1 ) && ( hr <= hl ) && ( hl <= hr + 1 ) ) return ; if ( ( h == hr + 1 ) && ( hl <= hr ) && ( hr <= hl + 1 ) ) return ; printk ( " \n " , avl_check_point ) ; }
check a tree's consistency and balancing
check a tree ' s consistency and balancing