Lines Matching refs:sbp
216 sg_get_sense_key(const unsigned char * sbp, int sb_len) in sg_get_sense_key() argument
218 if ((NULL == sbp) || (sb_len < 2)) in sg_get_sense_key()
220 switch (sbp[0] & 0x7f) { in sg_get_sense_key()
223 return (sb_len < 3) ? -1 : (sbp[2] & 0xf); in sg_get_sense_key()
226 return sbp[1] & 0xf; in sg_get_sense_key()
299 sg_scsi_sense_desc_find(const unsigned char * sbp, int sb_len, in sg_scsi_sense_desc_find() argument
305 if ((sb_len < 8) || (0 == (add_sb_len = sbp[7]))) in sg_scsi_sense_desc_find()
307 if ((sbp[0] < 0x72) || (sbp[0] > 0x73)) in sg_scsi_sense_desc_find()
310 descp = &sbp[8]; in sg_scsi_sense_desc_find()
327 sg_get_sense_info_fld(const unsigned char * sbp, int sb_len, in sg_get_sense_info_fld() argument
337 switch (sbp[0] & 0x7f) { in sg_get_sense_info_fld()
341 *info_outp = sg_get_unaligned_be32(sbp + 3); in sg_get_sense_info_fld()
342 return !!(sbp[0] & 0x80); in sg_get_sense_info_fld()
345 bp = sg_scsi_sense_desc_find(sbp, sb_len, 0 /* info desc */); in sg_get_sense_info_fld()
364 sg_get_sense_cmd_spec_fld(const unsigned char * sbp, int sb_len, in sg_get_sense_cmd_spec_fld() argument
373 switch (sbp[0] & 0x7f) { in sg_get_sense_cmd_spec_fld()
377 *cmd_spec_outp = sg_get_unaligned_be32(sbp + 8); in sg_get_sense_cmd_spec_fld()
381 bp = sg_scsi_sense_desc_find(sbp, sb_len, in sg_get_sense_cmd_spec_fld()
399 sg_get_sense_filemark_eom_ili(const unsigned char * sbp, int sb_len, in sg_get_sense_filemark_eom_ili() argument
406 switch (sbp[0] & 0x7f) { in sg_get_sense_filemark_eom_ili()
409 if (sbp[2] & 0xe0) { in sg_get_sense_filemark_eom_ili()
411 *filemark_p = !!(sbp[2] & 0x80); in sg_get_sense_filemark_eom_ili()
413 *eom_p = !!(sbp[2] & 0x40); in sg_get_sense_filemark_eom_ili()
415 *ili_p = !!(sbp[2] & 0x20); in sg_get_sense_filemark_eom_ili()
422 bp = sg_scsi_sense_desc_find(sbp, sb_len, 4); in sg_get_sense_filemark_eom_ili()
448 sg_get_sense_progress_fld(const unsigned char * sbp, int sb_len, in sg_get_sense_progress_fld() argument
456 switch (sbp[0] & 0x7f) { in sg_get_sense_progress_fld()
459 sk = (sbp[2] & 0xf); in sg_get_sense_progress_fld()
463 if (sbp[15] & 0x80) { /* SKSV bit set */ in sg_get_sense_progress_fld()
465 *progress_outp = sg_get_unaligned_be16(sbp + 16); in sg_get_sense_progress_fld()
472 sk = (sbp[1] & 0xf); in sg_get_sense_progress_fld()
474 if (sk_pr && ((bp = sg_scsi_sense_desc_find(sbp, sb_len, 2))) && in sg_get_sense_progress_fld()
479 } else if (((bp = sg_scsi_sense_desc_find(sbp, sb_len, 0xa))) && in sg_get_sense_progress_fld()
1283 sg_get_sense_descriptors_str(const char * lip, const unsigned char * sbp, in sg_get_sense_descriptors_str() argument
1302 if ((sb_len < 8) || (0 == (add_sb_len = sbp[7]))) in sg_get_sense_descriptors_str()
1305 sense_key = (sbp[1] & 0xf); in sg_get_sense_descriptors_str()
1307 for (descp = (sbp + 8), k = 0, n = 0; in sg_get_sense_descriptors_str()
1609 sg_get_sense_str(const char * lip, const unsigned char * sbp, int sb_len, in sg_get_sense_str() argument
1633 if ((NULL == sbp) || (sb_len < 1)) { in sg_get_sense_str()
1637 resp_code = 0x7f & sbp[0]; in sg_get_sense_str()
1638 valid = !!(sbp[0] & 0x80); in sg_get_sense_str()
1640 if (sg_scsi_normalize_sense(sbp, sb_len, &ssh)) { in sg_get_sense_str()
1644 len = (sb_len > 7) ? (sbp[7] + 8) : sb_len; in sg_get_sense_str()
1646 sdat_ovfl = (len > 2) ? !!(sbp[2] & 0x10) : false; in sg_get_sense_str()
1651 len = (sb_len > 7) ? (sbp[7] + 8) : sb_len; in sg_get_sense_str()
1653 sdat_ovfl = (len > 2) ? !!(sbp[2] & 0x10) : false; in sg_get_sense_str()
1658 sdat_ovfl = (sb_len > 4) ? !!(sbp[4] & 0x80) : false; in sg_get_sense_str()
1663 sdat_ovfl = (sb_len > 4) ? !!(sbp[4] & 0x80) : false; in sg_get_sense_str()
1682 n += sg_get_sense_descriptors_str(lip, sbp, len, in sg_get_sense_str()
1689 n += sg_get_sense_sat_pt_fixed_str(lip, sbp, len, in sg_get_sense_str()
1699 info = sg_get_unaligned_be32(sbp + 3); in sg_get_sense_str()
1708 if (sbp[2] & 0xe0) { in sg_get_sense_str()
1709 if (sbp[2] & 0x80) in sg_get_sense_str()
1712 if (sbp[2] & 0x40) in sg_get_sense_str()
1715 if (sbp[2] & 0x20) in sg_get_sense_str()
1721 if ((len >= 14) && sbp[14]) in sg_get_sense_str()
1723 "code: %d\n", lip, sbp[14]); in sg_get_sense_str()
1724 if ((len >= 18) && (sbp[15] & 0x80)) { in sg_get_sense_str()
1730 ((sbp[15] & 0x40) ? "Command" : in sg_get_sense_str()
1732 sg_get_unaligned_be16(sbp + 16)); in sg_get_sense_str()
1733 if (sbp[15] & 0x08) in sg_get_sense_str()
1735 sbp[15] & 0x07); in sg_get_sense_str()
1741 progress = sg_get_unaligned_be16(sbp + 16); in sg_get_sense_str()
1751 "0x%02x%02x\n", lip, sbp[16], sbp[17]); in sg_get_sense_str()
1756 "byte %d", ((sbp[15] & 0x20) ? in sg_get_sense_str()
1758 sg_get_unaligned_be16(sbp + 16)); in sg_get_sense_str()
1759 if (sbp[15] & 0x08) in sg_get_sense_str()
1761 sbp[15] & 0x07); in sg_get_sense_str()
1769 !!(sbp[15] & 0x1)); in sg_get_sense_str()
1791 n += hex2str(sbp, sb_len, lip, -1, cblen - n, cbp + n); in sg_get_sense_str()
1801 "code=%d\n", valid, ((sbp[0] >> 4) & 0x7), in sg_get_sense_str()
1802 (sbp[0] & 0xf)); in sg_get_sense_str()
1805 sg_get_unaligned_be24(sbp + 1) & 0x1fffff); in sg_get_sense_str()
1820 n += hex2str(sbp, len, z, -1, cblen - n, cbp + n); in sg_get_sense_str()
1827 sg_print_sense(const char * leadin, const unsigned char * sbp, int sb_len, in sg_print_sense() argument
1837 sg_get_sense_str(leadin, sbp, sb_len, raw_sinfo, pg_sz, cp); in sg_print_sense()
1946 sg_scsi_normalize_sense(const unsigned char * sbp, int sb_len, in sg_scsi_normalize_sense() argument
1952 if ((NULL == sbp) || (sb_len < 1)) in sg_scsi_normalize_sense()
1954 resp_code = 0x7f & sbp[0]; in sg_scsi_normalize_sense()
1961 sshp->sense_key = (0xf & sbp[1]); in sg_scsi_normalize_sense()
1963 sshp->asc = sbp[2]; in sg_scsi_normalize_sense()
1965 sshp->ascq = sbp[3]; in sg_scsi_normalize_sense()
1967 sshp->additional_length = sbp[7]; in sg_scsi_normalize_sense()
1970 sshp->sense_key = (0xf & sbp[2]); in sg_scsi_normalize_sense()
1972 sb_len = (sb_len < (sbp[7] + 8)) ? sb_len : (sbp[7] + 8); in sg_scsi_normalize_sense()
1974 sshp->asc = sbp[12]; in sg_scsi_normalize_sense()
1976 sshp->ascq = sbp[13]; in sg_scsi_normalize_sense()
1986 sg_err_category_sense(const unsigned char * sbp, int sb_len) in sg_err_category_sense() argument
1990 if ((sbp && (sb_len > 2)) && in sg_err_category_sense()
1991 (sg_scsi_normalize_sense(sbp, sb_len, &ssh))) { in sg_err_category_sense()