FreeBSD/sys/cam/cam_xpt.c
/*
 * Return -1 for failure, 0 for exact match, 1 for match with wildcards
 * in path1, 2 for match with wildcards in path2.
 */
1 for failure, 0 for exact match, 1 for match with wildcards
in path1, 2 for match with wildcards in path2.
1 for failure 0 for exact match 1 for match with wildcards in path1 2 for match with wildcards in path2 .
int
xpt_path_comp(struct cam_path *path1, struct cam_path *path2)
{
	int retval = 0;
	if (path1->bus != path2->bus) {
		if (path1->bus->path_id == CAM_BUS_WILDCARD)
			retval = 1;
		else if (path2->bus->path_id == CAM_BUS_WILDCARD)
			retval = 2;
		else
			return (-1);
	}
	if (path1->target != path2->target) {
		if (path1->target->target_id == CAM_TARGET_WILDCARD) {
			if (retval == 0)
				retval = 1;
		} else if (path2->target->target_id == CAM_TARGET_WILDCARD)
			retval = 2;
		else
			return (-1);
	}
	if (path1->device != path2->device) {
		if (path1->device->lun_id == CAM_LUN_WILDCARD) {
			if (retval == 0)
				retval = 1;
		} else if (path2->device->lun_id == CAM_LUN_WILDCARD)
			retval = 2;
		else
			return (-1);
	}
	return (retval);
}
int xpt_path_comp ( struct cam_path * path1 , struct cam_path * path2 ) { int retval = 0 ; if ( path1 -> bus != path2 -> bus ) { if ( path1 -> bus -> path_id == CAM_BUS_WILDCARD ) retval = 1 ; else if ( path2 -> bus -> path_id == CAM_BUS_WILDCARD ) retval = 2 ; else return ( -1 ) ; } if ( path1 -> target != path2 -> target ) { if ( path1 -> target -> target_id == CAM_TARGET_WILDCARD ) { if ( retval == 0 ) retval = 1 ; } else if ( path2 -> target -> target_id == CAM_TARGET_WILDCARD ) retval = 2 ; else return ( -1 ) ; } if ( path1 -> device != path2 -> device ) { if ( path1 -> device -> lun_id == CAM_LUN_WILDCARD ) { if ( retval == 0 ) retval = 1 ; } else if ( path2 -> device -> lun_id == CAM_LUN_WILDCARD ) retval = 2 ; else return ( -1 ) ; } return ( retval ) ; }
Return -1 for failure, 0 for exact match, 1 for match with wildcards
 in path1, 2 for match with wildcards in path2.
Return - 1 for failure 0 for exact match 1 for match with wildcards in path1 2 for match with wildcards in path2 .