FreeBSD/sys/dev/firewire/sbp_targ.c
/*
 * tag_id/init_id encoding
 *
 * tag_id and init_id has only 32bit for each.
 * scsi_target can handle very limited number(up to 15) of init_id.
 * we have to encode 48bit orb and 64bit EUI64 into these
 * variables.
 *
 * tag_id represents lower 32bit of ORB address.
 * init_id represents login_id.
 *
 */


tag_id represents lower 32bit of ORB address.
tag_id represents lower 32bit of ORB address .
static struct orb_info *
sbp_targ_get_orb_info(struct sbp_targ_lstate *lstate,
    u_int tag_id, u_int init_id)
{
	struct sbp_targ_login *login;
	struct orb_info *orbi;
	login = lstate->sc->logins[init_id];
	if (login == NULL) {
		printf("%s: no such login\n", __func__);
		return (NULL);
	}
	STAILQ_FOREACH(orbi, &login->orbs, link)
		if (orbi->orb_lo == tag_id)
			goto found;
	printf("%s: orb not found tag_id=0x%08x init_id=%d\n",
			 __func__, tag_id, init_id);
	return (NULL);
found:
	return (orbi);
}
static struct orb_info * sbp_targ_get_orb_info ( struct sbp_targ_lstate * lstate , u_int tag_id , u_int init_id ) { struct sbp_targ_login * login ; struct orb_info * orbi ; login = lstate -> sc -> logins [ init_id ] ; if ( login == NULL ) { printf ( " \n " , __func__ ) ; return ( NULL ) ; } STAILQ_FOREACH ( orbi , & login -> orbs , link ) if ( orbi -> orb_lo == tag_id ) goto found ; printf ( " \n " , __func__ , tag_id , init_id ) ; return ( NULL ) ; found : return ( orbi ) ; }
tag_id/init_id encoding
 tag_id and init_id has only 32bit for each.
tag_id / init_id encoding tag_id and init_id has only 32bit for each .