Bugzilla – Attachment 217654 Details for
Bug 390934
OpenSuse 11.0 Beta 3 doesn't boot
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Forgot Password
test-ready.c
test-ready.c (text/plain), 1.40 KB, created by
Tejun Heo
on 2008-05-23 00:35:15 UTC
(
hide
)
Description:
test-ready.c
Filename:
MIME Type:
Creator:
Tejun Heo
Created:
2008-05-23 00:35:15 UTC
Size:
1.40 KB
patch
obsolete
>#include <stdio.h> >#include <scsi/sg.h> >#include <scsi/scsi.h> >#include <sys/ioctl.h> >#include <unistd.h> >#include <stdlib.h> >#include <string.h> >#include <sys/types.h> >#include <sys/stat.h> >#include <fcntl.h> > >static void print_hex(const unsigned char *p, int len) >{ > int i; > > for (i = 0; i < len; i++) { > if (i % 16 == 0) > printf("%04x: ", i); > printf("%02x", p[i]); > if (i % 4 == 3) { > if (i % 16 == 15) > printf("\n"); > else > printf(" "); > } else > printf(" "); > } > if (len % 16) > printf("\n"); >} > >int main(int argc, char **argv) >{ > struct sg_io_hdr transport = { }; > unsigned char cmd[] = { 0, 0, 0, 0, 0, 0 }; > unsigned char sense_data[32] = { }; > int fd, rc; > > if (argc < 2) { > fprintf(stderr, "Usage: wait-ready DEVICE\n"); > return 1; > } > > fd = open(argv[1], O_RDONLY|O_NONBLOCK); > if (fd < 0) { > perror("open"); > return 1; > } > > transport.interface_id = 'S'; > transport.cmdp = cmd; > transport.cmd_len = sizeof(cmd); > transport.sbp = sense_data; > transport.mx_sb_len = sizeof(sense_data); > transport.dxfer_direction = SG_DXFER_NONE; > > rc = ioctl(fd, SG_IO, &transport); > if (rc) { > perror("ioctl(SG_IO)"); > return 1; > } > > if ((transport.masked_status & CHECK_CONDITION) && transport.sb_len_wr) { > /*printf("* check sense data:\n"); > /print_hex(sense_data, sizeof(sense_data));*/ > printf("SK=0x%02x ASC=0x%02x ASCQ=0x%02x\n", > sense_data[2], sense_data[12], sense_data[13]); > } > > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
Attachments on
bug 390934
:
216157
|
217333
|
217334
|
217335
|
217513
|
217552
|
217594
|
217608
| 217654