FreeBSD/sbin/camcontrol/fwdownload.c
/*
 * Find entry in vendors list that belongs to
 * the vendor of given cam device.
 */
Find entry in vendors list that belongs to
the vendor of given cam device.
Find entry in vendors list that belongs to the vendor of given cam device .
static struct fw_vendor *
fw_get_vendor(struct cam_device *cam_dev, struct ata_params *ident_buf)
{
	char vendor[42];
	struct fw_vendor *vp;
	if (cam_dev == NULL)
		return (NULL);
	if (ident_buf != NULL) {
		cam_strvis((u_char *)vendor, ident_buf->model,
		    sizeof(ident_buf->model), sizeof(vendor));
		for (vp = vendors_list; vp->pattern != NULL; vp++) {
			if (vp->type == VENDOR_ATA)
				return (vp);
		}
	} else {
		cam_strvis((u_char *)vendor, (u_char *)cam_dev->inq_data.vendor,
		    sizeof(cam_dev->inq_data.vendor), sizeof(vendor));
	}
	for (vp = vendors_list; vp->pattern != NULL; vp++) {
		if (!cam_strmatch((const u_char *)vendor,
		    (const u_char *)vp->pattern, strlen(vendor))) {
			if ((vp->dev_type == T_ANY)
			 || (vp->dev_type == SID_TYPE(&cam_dev->inq_data)))
				break;
		}
	}
	return (vp);
}
static struct fw_vendor * fw_get_vendor ( struct cam_device * cam_dev , struct ata_params * ident_buf ) { char vendor [ 42 ] ; struct fw_vendor * vp ; if ( cam_dev == NULL ) return ( NULL ) ; if ( ident_buf != NULL ) { cam_strvis ( ( u_char * ) vendor , ident_buf -> model , sizeof ( ident_buf -> model ) , sizeof ( vendor ) ) ; for ( vp = vendors_list ; vp -> pattern != NULL ; vp ++ ) { if ( vp -> type == VENDOR_ATA ) return ( vp ) ; } } else { cam_strvis ( ( u_char * ) vendor , ( u_char * ) cam_dev -> inq_data . vendor , sizeof ( cam_dev -> inq_data . vendor ) , sizeof ( vendor ) ) ; } for ( vp = vendors_list ; vp -> pattern != NULL ; vp ++ ) { if ( ! cam_strmatch ( ( const u_char * ) vendor , ( const u_char * ) vp -> pattern , strlen ( vendor ) ) ) { if ( ( vp -> dev_type == T_ANY ) || ( vp -> dev_type == SID_TYPE ( & cam_dev -> inq_data ) ) ) break ; } } return ( vp ) ; }
Find entry in vendors list that belongs to
 the vendor of given cam device.
Find entry in vendors list that belongs to the vendor of given cam device .