| 1 | void main(int i) { |
| 2 | } |
| 3 | |
| 4 | |
| 5 | static int usb_storage_proc_info (char *buffer, char **start, off_t offset, |
| 6 | int length, int hostno, int inout) |
| 7 | { |
| 8 | struct us_data *us; |
| 9 | char *pos = buffer; |
| 10 | struct Scsi_Host *hostptr; |
| 11 | unsigned long f; |
| 12 | |
| 13 | /* if someone is sending us data, just throw it away */ |
| 14 | if (inout) |
| 15 | return length; |
| 16 | |
| 17 | /* find our data from the given hostno */ |
| 18 | hostptr = scsi_host_hn_get(hostno); |
| 19 | if (!hostptr) { /* if we couldn't find it, we return an error */ |
| 20 | return -ESRCH; |
| 21 | } |
| 22 | us = (struct us_data*)hostptr->hostdata[0]; |
| 23 | |
| 24 | /* if we couldn't find it, we return an error */ |
| 25 | if (!us) { |
| 26 | scsi_host_put(hostptr); |
| 27 | return -ESRCH; |
| 28 | } |
| 29 | |
| 30 | /* print the controller name */ |
| 31 | SPRINTF(" Host scsi%d: usb-storage\n", hostno); |
| 32 | |
| 33 | SPRINTF(" Transport: %s\n", us->transport_name); |
| 34 | |
| 35 | /* show the device flags */ |
| 36 | if (pos < buffer + length) { |
| 37 | pos += sprintf(pos, " Quirks:"); |
| 38 | f = us->flags; |
| 39 | |
| 40 | #define DO_FLAG(a) if (f & US_FL_##a) pos += sprintf(pos, " " #a) |
| 41 | DO_FLAG(SINGLE_LUN); |
| 42 | DO_FLAG(MODE_XLATE); |
| 43 | DO_FLAG(START_STOP); |
| 44 | DO_FLAG(IGNORE_SER); |
| 45 | DO_FLAG(SCM_MULT_TARG); |
| 46 | DO_FLAG(FIX_INQUIRY); |
| 47 | DO_FLAG(FIX_CAPACITY); |
| 48 | #undef DO_FLAG |
| 49 | |
| 50 | *(pos++) = '\n'; |
| 51 | } |
| 52 | |
| 53 | /* release the reference count on this host */ |
| 54 | scsi_host_put(hostptr); |
| 55 | |
| 56 | /* |
| 57 | * Calculate start of next buffer, and return value. |
| 58 | */ |
| 59 | *start = buffer + offset; |
| 60 | |
| 61 | if ((pos - buffer) < offset) |
| 62 | return (0); |
| 63 | else if ((pos - buffer - offset) < length) |
| 64 | return (pos - buffer - offset); |
| 65 | else |
| 66 | return (length); |
| 67 | } |
| 68 | |
| 69 | |
| 70 | |
| 71 | static int usb_storage_info (int i, struct Scsi_Host *myhostptr) { |
| 72 | |
| 73 | char *buffer; |
| 74 | int hostno = 40; |
| 75 | usb_storage_proc_info(buffer, 0, 0, 100, 40, -1); |
| 76 | } |
| 77 | |
| 78 | |
| 79 | struct SHT usb_stor_host_template = { |
| 80 | /* basic userland interface stuff */ |
| 81 | .name = "usb-storage", |
| 82 | .proc_name = "usb-storage", |
| 83 | .proc_info = usb_storage_proc_info, |
| 84 | .proc_dir = NULL, |
| 85 | .info = usb_storage_info, |
| 86 | .ioctl = NULL, |
| 87 | |
| 88 | /* old-style detect and release */ |
| 89 | .detect = NULL, |
| 90 | .release = NULL, |
| 91 | |
| 92 | /* command interface -- queued only */ |
| 93 | .command = NULL, |
| 94 | .queuecommand = usb_storage_queuecommand, |
| 95 | |
| 96 | /* error and abort handlers */ |
| 97 | .eh_abort_handler = usb_storage_command_abort, |
| 98 | .eh_device_reset_handler = usb_storage_device_reset, |
| 99 | .eh_bus_reset_handler = usb_storage_bus_reset, |
| 100 | .eh_host_reset_handler = NULL, |
| 101 | .eh_strategy_handler = NULL, |
| 102 | |
| 103 | /* queue commands only, only one command per LUN */ |
| 104 | .can_queue = 1, |
| 105 | .cmd_per_lun = 1, |
| 106 | |
| 107 | /* unknown initiator id */ |
| 108 | .this_id = -1, |
| 109 | |
| 110 | /* no limit on commands */ |
| 111 | .max_sectors = 0, |
| 112 | |
| 113 | /* pre- and post- device scan functions */ |
| 114 | .slave_alloc = NULL, |
| 115 | .slave_configure = NULL, |
| 116 | .slave_destroy = NULL, |
| 117 | |
| 118 | /* lots of sg segments can be handled */ |
| 119 | .sg_tablesize = SG_ALL, |
| 120 | |
| 121 | /* use 32-bit address space for DMA */ |
| 122 | .unchecked_isa_dma = FALSE, |
| 123 | .highmem_io = FALSE, |
| 124 | |
| 125 | /* merge commands... this seems to help performance, but |
| 126 | * periodically someone should test to see which setting is more |
| 127 | * optimal. |
| 128 | */ |
| 129 | .use_clustering = TRUE, |
| 130 | |
| 131 | /* emulated HBA */ |
| 132 | .emulated = TRUE, |
| 133 | |
| 134 | /* sorry, no BIOS to help us */ |
| 135 | .bios_param = NULL, |
| 136 | |
| 137 | /* module management */ |
| 138 | .module = THIS_MODULE |
| 139 | }; |