Lines Matching refs:n
68 int n; in pr2ws() local
71 n = vfprintf(sg_warnings_strm ? sg_warnings_strm : stderr, fmt, args); in pr2ws()
73 return n; in pr2ws()
94 int n; in scnpr() local
99 n = vsnprintf(cp, cp_max_len, fmt, args); in scnpr()
101 return (n < cp_max_len) ? n : (cp_max_len - 1); in scnpr()
525 int proto_id, num, k, n, normal_len, tpid_format; in sg_decode_transportid_str() local
538 for (k = 0, n = 0; bplen > 0; ++k, bp += bump, bplen -= bump) { in sg_decode_transportid_str()
542 n += scnpr(b + n, blen - n, "%sTransport Id short or not " in sg_decode_transportid_str()
545 n += scnpr(b + n, blen - n, "%sTransport Id of initiator:\n", in sg_decode_transportid_str()
553 n += scnpr(b + n, blen - n, "%s FCP-2 World Wide Name:\n", lip); in sg_decode_transportid_str()
555 n += scnpr(b + n, blen - n, "%s [Unexpected TPID format: " in sg_decode_transportid_str()
557 n += hex2str(bp + 8, 8, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
561 n += scnpr(b + n, blen - n, "%s Parallel SCSI initiator SCSI " in sg_decode_transportid_str()
564 n += scnpr(b + n, blen - n, "%s [Unexpected TPID format: " in sg_decode_transportid_str()
566 n += scnpr(b + n, blen - n, "%s relative port number (of " in sg_decode_transportid_str()
572 n += scnpr(b + n, blen - n, "%s SSA (transport id not " in sg_decode_transportid_str()
574 n += scnpr(b + n, blen - n, "%s TPID format: %d\n", lip, in sg_decode_transportid_str()
576 n += hex2str(bp, normal_len, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
580 n += scnpr(b + n, blen - n, "%s IEEE 1394 EUI-64 name:\n", lip); in sg_decode_transportid_str()
582 n += scnpr(b + n, blen - n, "%s [Unexpected TPID format: " in sg_decode_transportid_str()
584 n += hex2str(&bp[8], 8, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
588 n += scnpr(b + n, blen - n, "%s RDMA initiator port " in sg_decode_transportid_str()
591 n += scnpr(b + n, blen - n, "%s [Unexpected TPID format: " in sg_decode_transportid_str()
593 n += hex2str(bp + 8, 16, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
597 n += scnpr(b + n, blen - n, "%s iSCSI ", lip); in sg_decode_transportid_str()
600 n += scnpr(b + n, blen - n, "name: %.*s\n", num, &bp[4]); in sg_decode_transportid_str()
602 n += scnpr(b + n, blen - n, "world wide unique port id: " in sg_decode_transportid_str()
605 n += scnpr(b + n, blen - n, " [Unexpected TPID format: " in sg_decode_transportid_str()
607 n += hex2str(bp, num + 4, lip, 0, blen - n, b + n); in sg_decode_transportid_str()
614 n += scnpr(b + n, blen - n, "%s SAS address: 0x%" PRIx64 "\n", in sg_decode_transportid_str()
617 n += scnpr(b + n, blen - n, "%s [Unexpected TPID format: " in sg_decode_transportid_str()
622 n += scnpr(b + n, blen - n, "%s ADT:\n", lip); in sg_decode_transportid_str()
623 n += scnpr(b + n, blen - n, "%s TPID format: %d\n", lip, in sg_decode_transportid_str()
625 n += hex2str(bp, normal_len, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
629 n += scnpr(b + n, blen - n, "%s ATAPI:\n", lip); in sg_decode_transportid_str()
630 n += scnpr(b + n, blen - n, "%s TPID format: %d\n", lip, in sg_decode_transportid_str()
632 n += hex2str(bp, normal_len, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
636 n += scnpr(b + n, blen - n, "%s UAS:\n", lip); in sg_decode_transportid_str()
637 n += scnpr(b + n, blen - n, "%s TPID format: %d\n", lip, in sg_decode_transportid_str()
639 n += hex2str(bp, normal_len, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
643 n += scnpr(b + n, blen - n, "%s SOP ", lip); in sg_decode_transportid_str()
646 n += scnpr(b + n, blen - n, "Routing ID: 0x%x\n", num); in sg_decode_transportid_str()
648 n += scnpr(b + n, blen - n, " [Unexpected TPID format: " in sg_decode_transportid_str()
650 n += hex2str(bp, normal_len, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
655 n += scnpr(b + n, blen - n, "%s PCIE:\n", lip); in sg_decode_transportid_str()
656 n += scnpr(b + n, blen - n, "%s TPID format: %d\n", lip, in sg_decode_transportid_str()
658 n += hex2str(bp, normal_len, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
662 n += scnpr(b + n, blen - n, "%s No specified protocol\n", lip); in sg_decode_transportid_str()
668 n += scnpr(b + n, blen - n, "%s unknown protocol id=0x%x " in sg_decode_transportid_str()
670 n += hex2str(bp, normal_len, lip, 1, blen - n, b + n); in sg_decode_transportid_str()
748 int vsi, k, n, dlen; in sg_get_designation_descriptor_str() local
755 n = 0; in sg_get_designation_descriptor_str()
759 n += scnpr(b + n, blen - n, "%sdesignator desc too short: got " in sg_get_designation_descriptor_str()
761 return n; in sg_get_designation_descriptor_str()
765 n += scnpr(b + n, blen - n, "%sdesignator too long: says it is %d " in sg_get_designation_descriptor_str()
767 return n; in sg_get_designation_descriptor_str()
776 n += scnpr(b + n, blen - n, "%s %s:\n", lip, cp); in sg_get_designation_descriptor_str()
777 n += scnpr(b + n, blen - n, "%s designator type: ", lip); in sg_get_designation_descriptor_str()
780 n += scnpr(b + n, blen - n, "%s", cp); in sg_get_designation_descriptor_str()
781 n += scnpr(b + n, blen - n, ", code set: "); in sg_get_designation_descriptor_str()
784 n += scnpr(b + n, blen - n, "%s", cp); in sg_get_designation_descriptor_str()
785 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
787 n += scnpr(b + n, blen - n, "%s transport: %s\n", lip, in sg_get_designation_descriptor_str()
800 n += scnpr(b + n, blen - n, "%s vendor specific: %.*s\n", in sg_get_designation_descriptor_str()
803 n += scnpr(b + n, blen - n, "%s vendor specific:\n", lip); in sg_get_designation_descriptor_str()
804 n += hex2str(ip, dlen, lip, 0, blen - n, b + n); in sg_get_designation_descriptor_str()
808 n += scnpr(b + n, blen - n, "%s vendor id: %.8s\n", lip, ip); in sg_get_designation_descriptor_str()
811 n += scnpr(b + n, blen - n, "%s vendor specific: " in sg_get_designation_descriptor_str()
814 n += scnpr(b + n, blen - n, "%s vendor specific: 0x", in sg_get_designation_descriptor_str()
817 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
818 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
825 n += scnpr(b + n, blen - n, "%s << expect 8, 12 and 16 " in sg_get_designation_descriptor_str()
827 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
830 n += scnpr(b + n, blen - n, "%s 0x", lip); in sg_get_designation_descriptor_str()
832 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
833 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
836 n += scnpr(b + n, blen - n, "%s EUI-64 based %d byte " in sg_get_designation_descriptor_str()
839 n += scnpr(b + n, blen - n, "%s << expected binary code_set " in sg_get_designation_descriptor_str()
841 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
848 n += scnpr(b + n, blen - n, "%s Identifier extension: 0x%" in sg_get_designation_descriptor_str()
851 n += scnpr(b + n, blen - n, "%s << can only decode 8, 12 " in sg_get_designation_descriptor_str()
853 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
857 n += scnpr(b + n, blen - n, "%s IEEE Company_id: 0x%x\n", lip, in sg_get_designation_descriptor_str()
865 n += scnpr(b + n, blen - n, "%s Vendor Specific Extension " in sg_get_designation_descriptor_str()
869 n += scnpr(b + n, blen - n, "%s Directory ID: 0x%x\n", lip, in sg_get_designation_descriptor_str()
875 n += scnpr(b + n, blen - n, "%s << unexpected code set %d " in sg_get_designation_descriptor_str()
877 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
884 n += scnpr(b + n, blen - n, "%s << unexpected NAA 2 " in sg_get_designation_descriptor_str()
886 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
893 n += scnpr(b + n, blen - n, "%s NAA 2, vendor specific " in sg_get_designation_descriptor_str()
895 n += scnpr(b + n, blen - n, "%s IEEE Company_id: 0x%x\n", in sg_get_designation_descriptor_str()
897 n += scnpr(b + n, blen - n, "%s vendor specific " in sg_get_designation_descriptor_str()
899 n += scnpr(b + n, blen - n, "%s [0x", lip); in sg_get_designation_descriptor_str()
901 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
902 n += scnpr(b + n, blen - n, "]\n"); in sg_get_designation_descriptor_str()
904 n += scnpr(b + n, blen - n, "%s 0x", lip); in sg_get_designation_descriptor_str()
906 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
907 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
911 n += scnpr(b + n, blen - n, "%s << unexpected NAA 3 " in sg_get_designation_descriptor_str()
913 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
917 n += scnpr(b + n, blen - n, "%s NAA 3, Locally " in sg_get_designation_descriptor_str()
919 n += scnpr(b + n, blen - n, "%s 0x", lip); in sg_get_designation_descriptor_str()
921 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
922 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
926 n += scnpr(b + n, blen - n, "%s << unexpected NAA 5 " in sg_get_designation_descriptor_str()
928 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
939 n += scnpr(b + n, blen - n, "%s NAA 5, IEEE " in sg_get_designation_descriptor_str()
941 n += scnpr(b + n, blen - n, "%s Vendor Specific " in sg_get_designation_descriptor_str()
943 n += scnpr(b + n, blen - n, "%s [0x", lip); in sg_get_designation_descriptor_str()
945 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
946 n += scnpr(b + n, blen - n, "]\n"); in sg_get_designation_descriptor_str()
948 n += scnpr(b + n, blen - n, "%s 0x", lip); in sg_get_designation_descriptor_str()
950 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
951 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
956 n += scnpr(b + n, blen - n, "%s << unexpected NAA 6 " in sg_get_designation_descriptor_str()
958 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
969 n += scnpr(b + n, blen - n, "%s NAA 6, IEEE " in sg_get_designation_descriptor_str()
971 n += scnpr(b + n, blen - n, "%s Vendor Specific " in sg_get_designation_descriptor_str()
974 n += scnpr(b + n, blen - n, "%s Vendor Specific " in sg_get_designation_descriptor_str()
977 n += scnpr(b + n, blen - n, "%s [0x", lip); in sg_get_designation_descriptor_str()
979 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
980 n += scnpr(b + n, blen - n, "]\n"); in sg_get_designation_descriptor_str()
982 n += scnpr(b + n, blen - n, "%s 0x", lip); in sg_get_designation_descriptor_str()
984 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[m]); in sg_get_designation_descriptor_str()
985 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
989 n += scnpr(b + n, blen - n, "%s << unexpected NAA [0x%x] " in sg_get_designation_descriptor_str()
991 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
997 n += scnpr(b + n, blen - n, "%s << expected binary " in sg_get_designation_descriptor_str()
1000 n += hex2str(ip, dlen, "", 1, blen - n, b + n); in sg_get_designation_descriptor_str()
1004 n += scnpr(b + n, blen - n, "%s Relative target port: 0x%x\n", in sg_get_designation_descriptor_str()
1009 n += scnpr(b + n, blen - n, "%s << expected binary " in sg_get_designation_descriptor_str()
1012 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
1016 n += scnpr(b + n, blen - n, "%s Target port group: 0x%x\n", lip, in sg_get_designation_descriptor_str()
1021 n += scnpr(b + n, blen - n, "%s << expected binary " in sg_get_designation_descriptor_str()
1024 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
1028 n += scnpr(b + n, blen - n, "%s Logical unit group: 0x%x\n", lip, in sg_get_designation_descriptor_str()
1033 n += scnpr(b + n, blen - n, "%s << expected binary " in sg_get_designation_descriptor_str()
1035 n += hex2str(ip, dlen, "", 1, blen - n, b + n); in sg_get_designation_descriptor_str()
1038 n += scnpr(b + n, blen - n, "%s MD5 logical unit identifier:\n", in sg_get_designation_descriptor_str()
1040 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
1046 n += scnpr(b + n, blen - n, "%s << expected UTF-8, " in sg_get_designation_descriptor_str()
1049 n += scnpr(b + n, blen - n, "%s << expected UTF-8 " in sg_get_designation_descriptor_str()
1051 n += hex2str(ip, dlen, lip, 0, blen - n, b + n); in sg_get_designation_descriptor_str()
1055 n += scnpr(b + n, blen - n, "%s SCSI name string:\n", lip); in sg_get_designation_descriptor_str()
1060 n += scnpr(b + n, blen - n, "%s %.*s\n", lip, dlen, in sg_get_designation_descriptor_str()
1067 n += scnpr(b + n, blen - n, " %s >>>> Protocol specific " in sg_get_designation_descriptor_str()
1072 n += scnpr(b + n, blen - n, "%s USB device address: 0x%x\n", in sg_get_designation_descriptor_str()
1074 n += scnpr(b + n, blen - n, "%s USB interface number: " in sg_get_designation_descriptor_str()
1077 n += scnpr(b + n, blen - n, "%s PCIe routing ID, bus " in sg_get_designation_descriptor_str()
1079 n += scnpr(b + n, blen - n, "%s function number: 0x%x\n", in sg_get_designation_descriptor_str()
1081 n += scnpr(b + n, blen - n, "%s [or device number: " in sg_get_designation_descriptor_str()
1085 n += scnpr(b + n, blen - n, "%s >>>> unexpected protocol " in sg_get_designation_descriptor_str()
1092 n += scnpr(b + n, blen - n, "%s << expected binary " in sg_get_designation_descriptor_str()
1094 n += hex2str(ip, dlen, lip, 0, blen - n, b + n); in sg_get_designation_descriptor_str()
1098 n += scnpr(b + n, blen - n, "%s << expected locally " in sg_get_designation_descriptor_str()
1100 n += hex2str(ip, dlen, lip, 0, blen - n, b + n); in sg_get_designation_descriptor_str()
1103 n += scnpr(b + n, blen - n, "%s Locally assigned UUID: ", lip); in sg_get_designation_descriptor_str()
1106 n += scnpr(b + n, blen - n, "-"); in sg_get_designation_descriptor_str()
1107 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[2 + m]); in sg_get_designation_descriptor_str()
1109 n += scnpr(b + n, blen - n, "\n"); in sg_get_designation_descriptor_str()
1111 n += scnpr(b + n, blen - n, "%s [0x", lip); in sg_get_designation_descriptor_str()
1113 n += scnpr(b + n, blen - n, "%02x", (unsigned int)ip[2 + m]); in sg_get_designation_descriptor_str()
1114 n += scnpr(b + n, blen - n, "]\n"); in sg_get_designation_descriptor_str()
1118 n += scnpr(b + n, blen - n, "%s reserved designator=0x%x\n", lip, in sg_get_designation_descriptor_str()
1120 n += hex2str(ip, dlen, lip, 1, blen - n, b + n); in sg_get_designation_descriptor_str()
1123 return n; in sg_get_designation_descriptor_str()
1130 int progress, pr, rem, n; in decode_sks() local
1132 n = 0; in decode_sks()
1138 n += scnpr(b + n, blen - n, "Field pointer: "); in decode_sks()
1142 n += scnpr(b + n, blen - n, "Field pointer:\n"); in decode_sks()
1143 n += scnpr(b + n, blen - n, "%s Error in %s: byte %d", lip, in decode_sks()
1148 n += scnpr(b + n, blen - n, " bit %d\n", descp[4] & 0x07); in decode_sks()
1150 n += scnpr(b + n, blen - n, "\n"); in decode_sks()
1155 n += scnpr(b + n, blen - n, "Actual retry count: "); in decode_sks()
1158 n += scnpr(b + n, blen - n,"%u\n", sg_get_unaligned_be16(descp + 5)); in decode_sks()
1162 n += scnpr(b + n, blen - n, "Progress indication: "); in decode_sks()
1168 n += scnpr(b + n, blen - n, "%d.%02d%%\n", pr, rem); in decode_sks()
1171 n += scnpr(b + n, blen - n, "Segment pointer:\n"); in decode_sks()
1174 n += scnpr(b + n, blen - n, "%s Relative to start of %s, byte " in decode_sks()
1179 n += scnpr(b + n, blen - n, " bit %d\n", descp[4] & 0x07); in decode_sks()
1181 n += scnpr(b + n, blen - n, "\n"); in decode_sks()
1184 n += scnpr(b + n, blen - n, "Unit attention condition queue:\n"); in decode_sks()
1185 n += scnpr(b + n, blen - n, "%s overflow flag is %d\n", lip, in decode_sks()
1189 n += scnpr(b + n, blen - n, "Sense_key: 0x%x unexpected\n", in decode_sks()
1194 return n; in decode_sks()
1197 n += scnpr(b + n, blen - n, "%s\n", " >> descriptor too short"); in decode_sks()
1199 return n; in decode_sks()
1234 int n = 0; in uds_referral_descriptor_str() local
1243 n += scnpr(b + n, blen - n, "%s Not all referrals: %d\n", lip, in uds_referral_descriptor_str()
1249 n += scnpr(b + n, blen - n, "%s Descriptor %d\n", lip, f); in uds_referral_descriptor_str()
1251 n += scnpr(b + n, blen - n, "%s truncated descriptor, " in uds_referral_descriptor_str()
1253 return n; in uds_referral_descriptor_str()
1256 n += scnpr(b + n, blen - n, "%s first uds LBA: 0x%" PRIx64 "\n", in uds_referral_descriptor_str()
1259 n += scnpr(b + n, blen - n, "%s last uds LBA: 0x%" PRIx64 "\n", in uds_referral_descriptor_str()
1264 n += scnpr(b + n, blen - n, "%s tpg: %d state: %s\n", in uds_referral_descriptor_str()
1268 return n; in uds_referral_descriptor_str()
1287 int n, progress, pr, rem; in sg_get_sense_descriptors_str() local
1307 for (descp = (sbp + 8), k = 0, n = 0; in sg_get_sense_descriptors_str()
1308 (k < add_sb_len) && (n < blen); in sg_get_sense_descriptors_str()
1314 n += scnpr(b + n, blen - n, "%s Descriptor type: ", lip); in sg_get_sense_descriptors_str()
1318 n += scnpr(b + n, blen - n, "Information: "); in sg_get_sense_descriptors_str()
1320 n += scnpr(b + n, blen - n, "0x"); in sg_get_sense_descriptors_str()
1322 n += scnpr(b + n, blen - n, "%02x", descp[4 + j]); in sg_get_sense_descriptors_str()
1323 n += scnpr(b + n, blen - n, "\n"); in sg_get_sense_descriptors_str()
1325 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1330 n += scnpr(b + n, blen - n, "Command specific: "); in sg_get_sense_descriptors_str()
1332 n += scnpr(b + n, blen - n, "0x"); in sg_get_sense_descriptors_str()
1334 n += scnpr(b + n, blen - n, "%02x", descp[4 + j]); in sg_get_sense_descriptors_str()
1335 n += scnpr(b + n, blen - n, "\n"); in sg_get_sense_descriptors_str()
1337 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1342 n += scnpr(b + n, blen - n, "Sense key specific: "); in sg_get_sense_descriptors_str()
1343 n += decode_sks(lip, descp, add_d_len, sense_key, &processed, in sg_get_sense_descriptors_str()
1344 blen - n, b + n); in sg_get_sense_descriptors_str()
1347 n += scnpr(b + n, blen - n, "Field replaceable unit code: "); in sg_get_sense_descriptors_str()
1349 n += scnpr(b + n, blen - n, "0x%x\n", descp[3]); in sg_get_sense_descriptors_str()
1351 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1356 n += scnpr(b + n, blen - n, "Stream commands: "); in sg_get_sense_descriptors_str()
1359 n += scnpr(b + n, blen - n, "FILEMARK"); in sg_get_sense_descriptors_str()
1361 n += scnpr(b + n, blen - n, "End Of Medium (EOM)"); in sg_get_sense_descriptors_str()
1363 n += scnpr(b + n, blen - n, "Incorrect Length Indicator " in sg_get_sense_descriptors_str()
1365 n += scnpr(b + n, blen - n, "\n"); in sg_get_sense_descriptors_str()
1367 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1372 n += scnpr(b + n, blen - n, "Block commands: "); in sg_get_sense_descriptors_str()
1374 n += scnpr(b + n, blen - n, "Incorrect Length Indicator " in sg_get_sense_descriptors_str()
1377 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1382 n += scnpr(b + n, blen - n, "OSD object identification\n"); in sg_get_sense_descriptors_str()
1386 n += scnpr(b + n, blen - n, "OSD response integrity check " in sg_get_sense_descriptors_str()
1391 n += scnpr(b + n, blen - n, "OSD attribute identification\n"); in sg_get_sense_descriptors_str()
1395 n += scnpr(b + n, blen - n, "ATA Status Return: "); in sg_get_sense_descriptors_str()
1401 n += scnpr(b + n, blen - n, "extend=%d error=0x%x \n%s" in sg_get_sense_descriptors_str()
1405 n += scnpr(b + n, blen - n, in sg_get_sense_descriptors_str()
1410 n += scnpr(b + n, blen - n, "lba=0x%02x%02x%02x ", in sg_get_sense_descriptors_str()
1412 n += scnpr(b + n, blen - n, "device=0x%x status=0x%x\n", in sg_get_sense_descriptors_str()
1415 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1421 n += scnpr(b + n, blen - n, "Another progress indication: "); in sg_get_sense_descriptors_str()
1423 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1430 n += scnpr(b + n, blen - n, "%d.02%d%%\n", pr, rem); in sg_get_sense_descriptors_str()
1431 n += scnpr(b + n, blen - n, "%s [sense_key=0x%x " in sg_get_sense_descriptors_str()
1436 n += scnpr(b + n, blen - n, "User data segment referral: "); in sg_get_sense_descriptors_str()
1438 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1442 n += scnpr(b + n, blen - n, "\n"); in sg_get_sense_descriptors_str()
1443 n += uds_referral_descriptor_str(b + n, blen - n, descp, in sg_get_sense_descriptors_str()
1447 n += scnpr(b + n, blen - n, "Forwarded sense data\n"); in sg_get_sense_descriptors_str()
1449 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1453 n += scnpr(b + n, blen - n, "%s FSDT: %s\n", lip, in sg_get_sense_descriptors_str()
1456 n += scnpr(b + n, blen - n, "%s Sense data source: ", lip); in sg_get_sense_descriptors_str()
1459 n += scnpr(b + n, blen - n, "%s source device\n", eccp); in sg_get_sense_descriptors_str()
1468 n += scnpr(b + n, blen - n, "%s %s %d\n", eccp, ddp, j - 1); in sg_get_sense_descriptors_str()
1471 n += scnpr(b + n, blen - n, "unknown [%d]\n", j); in sg_get_sense_descriptors_str()
1478 n += scnpr(b + n, blen - n, "%s Forwarded status: %s\n", in sg_get_sense_descriptors_str()
1482 n += scnpr(b + n, blen - n, "%s vvvvvvvvvvvvvvvv\n", lip); in sg_get_sense_descriptors_str()
1485 n += scnpr(b + n, blen - n, "%s", c); in sg_get_sense_descriptors_str()
1486 n += scnpr(b + n, blen - n, "%s ^^^^^^^^^^^^^^^^\n", lip); in sg_get_sense_descriptors_str()
1492 n += scnpr(b + n, blen - n, "Direct-access block device\n"); in sg_get_sense_descriptors_str()
1494 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1499 n += scnpr(b + n, blen - n, "%s ILI (incorrect length " in sg_get_sense_descriptors_str()
1502 n += scnpr(b + n, blen - n, "%s Sense key specific: ", in sg_get_sense_descriptors_str()
1504 n += decode_sks(lip, descp, add_d_len, sense_key, &processed, in sg_get_sense_descriptors_str()
1505 blen - n, b + n); in sg_get_sense_descriptors_str()
1507 n += scnpr(b + n, blen - n, "%s Field replaceable unit code: " in sg_get_sense_descriptors_str()
1510 n += scnpr(b + n, blen - n, "%s Information: 0x", lip); in sg_get_sense_descriptors_str()
1512 n += scnpr(b + n, blen - n, "%02x", descp[8 + j]); in sg_get_sense_descriptors_str()
1513 n += scnpr(b + n, blen - n, "\n"); in sg_get_sense_descriptors_str()
1515 n += scnpr(b + n, blen - n, "%s Command specific: 0x", lip); in sg_get_sense_descriptors_str()
1517 n += scnpr(b + n, blen - n, "%02x", descp[16 + j]); in sg_get_sense_descriptors_str()
1518 n += scnpr(b + n, blen - n, "\n"); in sg_get_sense_descriptors_str()
1521 n += scnpr(b + n, blen - n, "Device designation\n"); in sg_get_sense_descriptors_str()
1525 n += scnpr(b + n, blen - n, "%s Usage reason: %s\n", lip, in sg_get_sense_descriptors_str()
1528 n += scnpr(b + n, blen - n, "%s Usage reason: " in sg_get_sense_descriptors_str()
1530 n += sg_get_designation_descriptor_str(z, descp + 4, descp[1] - 2, in sg_get_sense_descriptors_str()
1531 true, false, blen - n, in sg_get_sense_descriptors_str()
1532 b + n); in sg_get_sense_descriptors_str()
1535 n += scnpr(b + n, blen - n, "Microcode activation "); in sg_get_sense_descriptors_str()
1537 n += scnpr(b + n, blen - n, "%s\n", dtsp); in sg_get_sense_descriptors_str()
1542 n += scnpr(b + n, blen - n, "time: "); in sg_get_sense_descriptors_str()
1544 n += scnpr(b + n, blen - n, "unknown\n"); in sg_get_sense_descriptors_str()
1546 n += scnpr(b + n, blen - n, "%d seconds\n", progress); in sg_get_sense_descriptors_str()
1550 n += scnpr(b + n, blen - n, "Vendor specific [0x%x]\n", in sg_get_sense_descriptors_str()
1553 n += scnpr(b + n, blen - n, "Unknown [0x%x]\n", descp[0]); in sg_get_sense_descriptors_str()
1559 n += scnpr(b + n, blen - n, "%s ", lip); in sg_get_sense_descriptors_str()
1562 n += scnpr(b + n, blen - n, "\n%s ", lip); in sg_get_sense_descriptors_str()
1563 n += scnpr(b + n, blen - n, "%02x ", descp[j + 2]); in sg_get_sense_descriptors_str()
1565 n += scnpr(b + n, blen - n, "\n"); in sg_get_sense_descriptors_str()
1569 n += scnpr(b + n, blen - n, "%s short descriptor\n", lip); in sg_get_sense_descriptors_str()
1571 return n; in sg_get_sense_descriptors_str()
1582 int n = 0; in sg_get_sense_sat_pt_fixed_str() local
1586 return n; in sg_get_sense_sat_pt_fixed_str()
1590 n += scnpr(b + n, blen - n, "%s >> expected Sense key: Recovered " in sg_get_sense_sat_pt_fixed_str()
1597 n += scnpr(b + n, blen - n, "%s error=0x%x, status=0x%x, device=0x%x, " in sg_get_sense_sat_pt_fixed_str()
1600 n += scnpr(b + n, blen - n, "%s extend=%d, log_index=0x%x, " in sg_get_sense_sat_pt_fixed_str()
1604 return n; in sg_get_sense_sat_pt_fixed_str()
1615 int len, progress, n, r, pr, rem, blen; in sg_get_sense_str() local
1630 n = 0; in sg_get_sense_str()
1634 n += scnpr(cbp, cblen, "%s >>> sense buffer empty\n", lip); in sg_get_sense_str()
1635 return n; in sg_get_sense_str()
1674 n += scnpr(cbp + n, cblen - n, "%s%s; Sense key: %s\n", lip, ebp, in sg_get_sense_str()
1677 n += scnpr(cbp + n, cblen - n, "%s<<<Sense data overflow>>>\n", in sg_get_sense_str()
1680 n += scnpr(cbp + n, cblen - n, "%s%s\n", lip, in sg_get_sense_str()
1682 n += sg_get_sense_descriptors_str(lip, sbp, len, in sg_get_sense_str()
1683 cblen - n, cbp + n); in sg_get_sense_str()
1687 n += scnpr(cbp + n, cblen - n, "%s%s\n", lip, in sg_get_sense_str()
1689 n += sg_get_sense_sat_pt_fixed_str(lip, sbp, len, in sg_get_sense_str()
1690 cblen - n, cbp + n); in sg_get_sense_str()
1693 n += scnpr(cbp + n, cblen - n, "%s%s\n", lip, in sg_get_sense_str()
1778 n += scnpr(cbp + n, cblen - n, "%s", b); in sg_get_sense_str()
1780 n += scnpr(cbp + n, cblen - n, "%s fixed descriptor length " in sg_get_sense_str()
1784 n += scnpr(cbp + n, cblen - n, "%ssense buffer too short (4 " in sg_get_sense_str()
1789 n += scnpr(cbp + n, cblen - n, "%sVendor specific sense buffer, " in sg_get_sense_str()
1791 n += hex2str(sbp, sb_len, lip, -1, cblen - n, cbp + n); in sg_get_sense_str()
1792 return n; /* no need to check raw, just output in hex */ in sg_get_sense_str()
1806 n += scnpr(cbp + n, cblen - n, "%s\n", b); in sg_get_sense_str()
1815 n += scnpr(cbp + n, cblen - n, "%s Raw sense data (in hex):\n", in sg_get_sense_str()
1817 if (n >= (cblen - 1)) in sg_get_sense_str()
1818 return n; in sg_get_sense_str()
1820 n += hex2str(sbp, len, z, -1, cblen - n, cbp + n); in sg_get_sense_str()
1822 return n; in sg_get_sense_str()
2240 int n; in sg_get_category_sense_str() local
2254 n = scnpr(buff, buff_len, "Not ready"); in sg_get_category_sense_str()
2255 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2256 scnpr(buff + n, buff_len - n, " sense key"); in sg_get_category_sense_str()
2259 n = scnpr(buff, buff_len, "Medium or hardware error"); in sg_get_category_sense_str()
2260 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2261 scnpr(buff + n, buff_len - n, " sense key (plus blank check)"); in sg_get_category_sense_str()
2264 n = scnpr(buff, buff_len, "Illegal request"); in sg_get_category_sense_str()
2265 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2266 scnpr(buff + n, buff_len - n, " sense key, apart from Invalid " in sg_get_category_sense_str()
2270 n = scnpr(buff, buff_len, "Unit attention"); in sg_get_category_sense_str()
2271 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2272 scnpr(buff + n, buff_len - n, " sense key"); in sg_get_category_sense_str()
2275 n = scnpr(buff, buff_len, "Data protect"); in sg_get_category_sense_str()
2276 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2277 scnpr(buff + n, buff_len - n, " sense key, write protected " in sg_get_category_sense_str()
2281 n = scnpr(buff, buff_len, "Illegal request, invalid opcode"); in sg_get_category_sense_str()
2282 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2283 scnpr(buff + n, buff_len - n, " sense key"); in sg_get_category_sense_str()
2286 n = scnpr(buff, buff_len, "Copy aborted"); in sg_get_category_sense_str()
2287 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2288 scnpr(buff + n, buff_len - n, " sense key"); in sg_get_category_sense_str()
2291 n = scnpr(buff, buff_len, "Aborted command"); in sg_get_category_sense_str()
2292 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2293 scnpr(buff + n, buff_len - n, " sense key, other than " in sg_get_category_sense_str()
2297 n = scnpr(buff, buff_len, "Miscompare"); in sg_get_category_sense_str()
2298 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2299 scnpr(buff + n, buff_len - n, " sense key"); in sg_get_category_sense_str()
2311 n = scnpr(buff, buff_len, "No sense key"); in sg_get_category_sense_str()
2312 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2313 scnpr(buff + n, buff_len - n, " probably additional sense " in sg_get_category_sense_str()
2317 n = scnpr(buff, buff_len, "Recovered error"); in sg_get_category_sense_str()
2318 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2319 scnpr(buff + n, buff_len - n, " sense key"); in sg_get_category_sense_str()
2322 n = scnpr(buff, buff_len, "Reservation conflict"); in sg_get_category_sense_str()
2323 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2324 scnpr(buff + n, buff_len - n, " SCSI status"); in sg_get_category_sense_str()
2327 n = scnpr(buff, buff_len, "Condition met"); in sg_get_category_sense_str()
2328 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2329 scnpr(buff + n, buff_len - n, " SCSI status"); in sg_get_category_sense_str()
2332 n = scnpr(buff, buff_len, "Busy"); in sg_get_category_sense_str()
2333 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2334 scnpr(buff + n, buff_len - n, " SCSI status"); in sg_get_category_sense_str()
2337 n = scnpr(buff, buff_len, "Task set full"); in sg_get_category_sense_str()
2338 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2339 scnpr(buff + n, buff_len - n, " SCSI status"); in sg_get_category_sense_str()
2342 n = scnpr(buff, buff_len, "ACA active"); in sg_get_category_sense_str()
2343 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2344 scnpr(buff + n, buff_len - n, " SCSI status"); in sg_get_category_sense_str()
2347 n = scnpr(buff, buff_len, "Task aborted"); in sg_get_category_sense_str()
2348 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2349 scnpr(buff + n, buff_len - n, " SCSI status"); in sg_get_category_sense_str()
2355 n = scnpr(buff, buff_len, "Aborted command, protection"); in sg_get_category_sense_str()
2356 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2357 scnpr(buff + n, buff_len - n, " information (PI) problem"); in sg_get_category_sense_str()
2360 n = scnpr(buff, buff_len, "Aborted command with info, protection"); in sg_get_category_sense_str()
2361 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2362 scnpr(buff + n, buff_len - n, " information (PI) problem"); in sg_get_category_sense_str()
2365 n = scnpr(buff, buff_len, "Malformed response"); in sg_get_category_sense_str()
2366 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2367 scnpr(buff + n, buff_len - n, " to SCSI command"); in sg_get_category_sense_str()
2370 n = scnpr(buff, buff_len, "Some other sense data problem"); in sg_get_category_sense_str()
2371 if (verbose && (n < (buff_len - 1))) in sg_get_category_sense_str()
2372 scnpr(buff + n, buff_len - n, ", try '-v' option for more " in sg_get_category_sense_str()
2376 n = scnpr(buff, buff_len, "Some other error/warning has occurred"); in sg_get_category_sense_str()
2377 if ((0 == verbose) && (n < (buff_len - 1))) in sg_get_category_sense_str()
2378 scnpr(buff + n, buff_len - n, ", possible transport of driver " in sg_get_category_sense_str()
2386 n = scnpr(buff, buff_len, "OS error: %s [%d]", safe_strerror(k), in sg_get_category_sense_str()
2389 n = scnpr(buff, buff_len, "Sense category: %d", sense_cat); in sg_get_category_sense_str()
2390 if ((0 == verbose) && (n < (buff_len - 1))) in sg_get_category_sense_str()
2391 scnpr(buff + n, buff_len - n, ", try '-v' option for more " in sg_get_category_sense_str()
2424 int n = 0; in sg_get_sfs_str() local
2448 n += scnpr(buff, buff_len, "SPC %s", vnp->name); in sg_get_sfs_str()
2450 n += scnpr(buff, buff_len, "%s", vnp->name); in sg_get_sfs_str()
2452 n += scnpr(buff, buff_len, "%s", sg_sfs_spc_reserved); in sg_get_sfs_str()
2456 n += scnpr(buff, buff_len, "SBC %s", vnp->name); in sg_get_sfs_str()
2458 n += scnpr(buff, buff_len, "%s", vnp->name); in sg_get_sfs_str()
2460 n += scnpr(buff, buff_len, "%s", sg_sfs_sbc_reserved); in sg_get_sfs_str()
2464 n += scnpr(buff, buff_len, "SSC %s", vnp->name); in sg_get_sfs_str()
2466 n += scnpr(buff, buff_len, "%s", vnp->name); in sg_get_sfs_str()
2468 n += scnpr(buff, buff_len, "%s", sg_sfs_ssc_reserved); in sg_get_sfs_str()
2472 n += scnpr(buff, buff_len, "ZBC %s", vnp->name); in sg_get_sfs_str()
2474 n += scnpr(buff, buff_len, "%s", vnp->name); in sg_get_sfs_str()
2476 n += scnpr(buff, buff_len, "%s", sg_sfs_zbc_reserved); in sg_get_sfs_str()
2480 n += scnpr(buff, buff_len, "[unrecognized PDT] %s", in sg_get_sfs_str()
2483 n += scnpr(buff, buff_len, "%s", vnp->name); in sg_get_sfs_str()
2485 n += scnpr(buff, buff_len, "%s", sg_sfs_reserved); in sg_get_sfs_str()
2489 pr2serr("%s: length of returned string (n) %d\n", __func__, n); in sg_get_sfs_str()
2797 int bpstart, bpos, k, n, prior_ascii_len; in dStrHexStr() local
2824 n = 0; in dStrHexStr()
2841 n += scnpr(b + n, b_len - n, "%-*s %s\n", prior_ascii_len, in dStrHexStr()
2845 n += scnpr(b + n, b_len - n, "%s\n", buff); in dStrHexStr()
2846 if (n >= (b_len - 1)) in dStrHexStr()
2847 return n; in dStrHexStr()
2858 n += scnpr(b + n, b_len - n, "%-*s %s\n", prior_ascii_len, in dStrHexStr()
2861 n += scnpr(b + n, b_len - n, "%s\n", buff); in dStrHexStr()
2863 return n; in dStrHexStr()
3037 int res, num, n, len; in sg_get_num() local
3049 n = strspn(buf, " \t"); in sg_get_num()
3050 if (n > 0) { in sg_get_num()
3051 if (n == len) in sg_get_num()
3053 buf += n; in sg_get_num()
3054 len -= n; in sg_get_num()
3060 n = (int)sizeof(lb) - 1; in sg_get_num()
3061 len = (len < n) ? len : n; in sg_get_num()
3120 n = sg_get_num(cp + 1); in sg_get_num()
3121 if (-1 != n) in sg_get_num()
3122 return num * n; in sg_get_num()
3172 int res, len, n; in sg_get_llnum() local
3185 n = strspn(buf, " \t"); in sg_get_llnum()
3186 if (n > 0) { in sg_get_llnum()
3187 if (n == len) in sg_get_llnum()
3189 buf += n; in sg_get_llnum()
3190 len -= n; in sg_get_llnum()
3196 n = (int)sizeof(lb) - 1; in sg_get_llnum()
3197 len = (len < n) ? len : n; in sg_get_llnum()
3346 int n; in pr2serr() local
3349 n = vfprintf(stderr, fmt, args); in pr2serr()
3351 return n; in pr2serr()