SCSI Pass-Through Programmer's Guide

/* sizeof either uses "(type)" or "expression" */
/* in this case we don't have a type for inquiry so use the expression */
/* inq->vendor_id to get the size of the subfield of the structure */
printf ("Vendor: ");
for (i=0; i < (sizeof inq->vendor_id) ;i++) {
printf ("%c", inq->vendor_id[i]);
} /* print vendor_id as chars */
printf ("\n");
printf ("Product : ");
for (i=0; i < (sizeof inq->product_id) ;i++) {
printf ("%c", inq->product_id[i]);
} /* print product_id as chars */
printf ("\n");
printf ("Rev: ");
for (i=0; i < (sizeof inq->rev_num) ;i++) {
printf ("%c", inq->rev_num[i]);
} /* print rev_num as chars */
printf ("\n");
} /* if inquiry command, format returned data */
} /* else good status diplay results */
} /* check_diag_command */
main(argc, argv)
int argc;
char *argv[];
{
char file_name[100] = "";
char path_name[100] = "";
char *path_ptr = path_name;
io_token_t token;
hw_path_t query_hw_path;
hw_path_t device_hw_path;
hw_path_t *query_ptr = &query_hw_path;
hw_path_t *device_ptr = &device_hw_path;
int query_minor_num;
int fd;
int r;
unsigned timeout;
if (argc < 2) {
fprintf(stderr, "Usage: %s <device path>\
n
", argv[0]);
exit(1);
}
timeout = 10000;
/* start of MPE changes */
/* original code simply called open with argv[1] */
strcpy (path_name, argv[1]);
/* */
/* In this case we're trying to get to the TM_DIAG */
/* To do this there is a magic incantation: */
/* On the mknod you pass in a slighly altered */
/* version of the MPE/iX "Port Number" for the */
/* device. */
/* So, start with an MPE/iX Path, validate it and */
/* then us io_search to get the "minor_num" for */
- 19 -