SCSI_HBA_PKT_ALLOC(9F) | Kernel Functions for Drivers | SCSI_HBA_PKT_ALLOC(9F) |
scsi_hba_pkt_alloc, scsi_hba_pkt_free - allocate and free a scsi_pkt structure
#include <sys/scsi/scsi.h> struct scsi_pkt *scsi_hba_pkt_alloc(dev_info_t *dip,
struct scsi_address *ap, int cmdlen, int statuslen,
int tgtlen, int hbalen,
int (*callback)(caddr_t arg), caddr_t arg);
void scsi_hba_pkt_free(struct scsi_address *ap, struct scsi_pkt *pkt);
illumos architecture specific (illumos DDI).
dip
ap
cmdlen
statuslen
tgtlen
hbalen
callback
NULL_FUNC
SLEEP_FUNC
arg
pkt
For scsi_hba_pkt_alloc():
The scsi_hba_pkt_alloc() function allocates space for a scsi_pkt structure. HBA drivers must use this interface when allocating a scsi_pkt from their tran_init_pkt(9E) entry point.
If callback is NULL_FUNC, scsi_hba_pkt_alloc() may not sleep when allocating resources, and callers should be prepared to deal with allocation failures.
The scsi_hba_pkt_alloc() function copies the scsi_address(9S) structure pointed to by ap to the pkt_address field in the scsi_pkt(9S).
The scsi_hba_pkt_alloc() function also allocates memory for these scsi_pkt(9S) data areas, and sets these fields to point to the allocated memory:
pkt_ha_private
pkt_private
pkt_scbp
pkt_cdbp
For scsi_hba_pkt_free():
The scsi_hba_pkt_free() function frees the space allocated for the scsi_pkt(9S) structure.
The scsi_hba_pkt_alloc() function returns a pointer to the scsi_pkt structure, or NULL if no space is available.
The scsi_hba_pkt_alloc() function can be called from user, interrupt, or kernel context. Drivers must not allow scsi_hba_pkt_alloc() to sleep if called from an interrupt routine.
The scsi_hba_pkt_free() function can be called from user, interrupt, or kernel context.
tran_init_pkt(9E), scsi_address(9S), scsi_pkt(9S)
Writing Device Drivers
December 11, 2006 | OmniOS |