"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/sg_lib.c" between
sg3_utils-1.47r908.tgz and sg3_utils-1.47r915.tar.xz

About: sg3_utils contains utilities that send SCSI commands to devices. Beta version.

sg_lib.c  (sg3_utils-1.47r908.tgz):sg_lib.c  (sg3_utils-1.47r915.tar.xz)
skipping to change at line 245 skipping to change at line 245
sg_get_command_str(cdbp, sz, true, sizeof(buff), buff); sg_get_command_str(cdbp, sz, true, sizeof(buff), buff);
pr2ws("%s\n", buff); pr2ws("%s\n", buff);
} }
void void
sg_print_command(const uint8_t * cdbp) sg_print_command(const uint8_t * cdbp)
{ {
sg_print_command_len(cdbp, 0); sg_print_command_len(cdbp, 0);
} }
/* SCSI Status values */
static const struct sg_lib_simple_value_name_t sstatus_str_arr[] = {
{0x0, "Good"},
{0x2, "Check Condition"},
{0x4, "Condition Met"},
{0x8, "Busy"},
{0x10, "Intermediate (obsolete)"},
{0x14, "Intermediate-Condition Met (obsolete)"},
{0x18, "Reservation Conflict"},
{0x22, "Command terminated (obsolete)"},
{0x28, "Task Set Full"},
{0x30, "ACA Active"},
{0x40, "Task Aborted"},
{0xffff, NULL},
};
bool bool
sg_scsi_status_is_good(int sstatus) sg_scsi_status_is_good(int sstatus)
{ {
sstatus &= 0xfe; sstatus &= 0xfe;
switch (sstatus) { switch (sstatus) {
case SAM_STAT_GOOD: case SAM_STAT_GOOD:
case SAM_STAT_CONDITION_MET: case SAM_STAT_CONDITION_MET:
return true; return true;
default: default:
return false; return false;
skipping to change at line 299 skipping to change at line 283
{ {
const struct sg_lib_simple_value_name_t * sstatus_p; const struct sg_lib_simple_value_name_t * sstatus_p;
if ((NULL == buff) || (buff_len < 1)) if ((NULL == buff) || (buff_len < 1))
return; return;
else if (1 == buff_len) { else if (1 == buff_len) {
buff[0] = '\0'; buff[0] = '\0';
return; return;
} }
scsi_status &= 0x7e; /* sanitize as much as possible */ scsi_status &= 0x7e; /* sanitize as much as possible */
for (sstatus_p = sstatus_str_arr; sstatus_p->name; ++sstatus_p) { for (sstatus_p = sg_lib_sstatus_str_arr; sstatus_p->name; ++sstatus_p) {
if (scsi_status == sstatus_p->value) if (scsi_status == sstatus_p->value)
break; break;
} }
if (sstatus_p->name) if (sstatus_p->name)
sg_scnpr(buff, buff_len, "%s", sstatus_p->name); sg_scnpr(buff, buff_len, "%s", sstatus_p->name);
else else
sg_scnpr(buff, buff_len, "Unknown status [0x%x]", scsi_status); sg_scnpr(buff, buff_len, "Unknown status [0x%x]", scsi_status);
} }
void void
 End of changes. 2 change blocks. 
17 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)