FreeBSD/sys/dev/firewire/firewire.c
/*
 * To obtain XFER structure by transaction label.
 */
To obtain XFER structure by transaction label.
To obtain XFER structure by transaction label .
static struct fw_xfer *
fw_tl2xfer(struct firewire_comm *fc, int node, int tlabel, int tcode)
{
	struct fw_xfer *xfer;
	int s = splfw();
	int req;
	mtx_lock(&fc->tlabel_lock);
	STAILQ_FOREACH(xfer, &fc->tlabels[tlabel], tlabel)
		if (xfer->send.hdr.mode.hdr.dst == node) {
			mtx_unlock(&fc->tlabel_lock);
			splx(s);
			KASSERT(xfer->tl == tlabel,
				("xfer->tl 0x%x != 0x%x", xfer->tl, tlabel));
			req = xfer->send.hdr.mode.hdr.tcode;
			if (xfer->fc->tcode[req].valid_res != tcode) {
				printf("%s: invalid response tcode "
				    "(0x%x for 0x%x)\n", __FUNCTION__,
				    tcode, req);
				return (NULL);
			}
			if (firewire_debug > 2)
				printf("fw_tl2xfer: found tl=%d\n", tlabel);
			return (xfer);
		}
	mtx_unlock(&fc->tlabel_lock);
	if (firewire_debug > 1)
		printf("fw_tl2xfer: not found tl=%d\n", tlabel);
	splx(s);
	return (NULL);
}
static struct fw_xfer * fw_tl2xfer ( struct firewire_comm * fc , int node , int tlabel , int tcode ) { struct fw_xfer * xfer ; int s = splfw ( ) ; int req ; mtx_lock ( & fc -> tlabel_lock ) ; STAILQ_FOREACH ( xfer , & fc -> tlabels [ tlabel ] , tlabel ) if ( xfer -> send . hdr . mode . hdr . dst == node ) { mtx_unlock ( & fc -> tlabel_lock ) ; splx ( s ) ; KASSERT ( xfer -> tl == tlabel , ( " " , xfer -> tl , tlabel ) ) ; req = xfer -> send . hdr . mode . hdr . tcode ; if ( xfer -> fc -> tcode [ req ] . valid_res != tcode ) { printf ( " " " \n " , __FUNCTION__ , tcode , req ) ; return ( NULL ) ; } if ( firewire_debug > 2 ) printf ( " \n " , tlabel ) ; return ( xfer ) ; } mtx_unlock ( & fc -> tlabel_lock ) ; if ( firewire_debug > 1 ) printf ( " \n " , tlabel ) ; splx ( s ) ; return ( NULL ) ; }
To obtain XFER structure by transaction label.
To obtain XFER structure by transaction label .
/* extra sanity check */