Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ips: switch to ->show_info()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro aacce706 56b8e8e5

+80 -161
+80 -152
drivers/scsi/ips.c
··· 326 326 static void ips_scmd_buf_read(struct scsi_cmnd * scmd, void *data, 327 327 unsigned int count); 328 328 329 - static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); 330 - static int ips_host_info(ips_ha_t *, char *, off_t, int); 331 - static void copy_mem_info(IPS_INFOSTR *, char *, int); 332 - static int copy_info(IPS_INFOSTR *, char *, ...); 329 + static int ips_write_info(struct Scsi_Host *, char *, int); 330 + static int ips_show_info(struct seq_file *, struct Scsi_Host *); 331 + static int ips_host_info(ips_ha_t *, struct seq_file *); 333 332 static int ips_abort_init(ips_ha_t * ha, int index); 334 333 static int ips_init_phase2(int index); 335 334 ··· 366 367 .eh_abort_handler = ips_eh_abort, 367 368 .eh_host_reset_handler = ips_eh_reset, 368 369 .proc_name = "ips", 369 - .proc_info = ips_proc_info, 370 + .show_info = ips_show_info, 371 + .write_info = ips_write_info, 370 372 .slave_configure = ips_slave_configure, 371 373 .bios_param = ips_biosparam, 372 374 .this_id = -1, ··· 1433 1433 return (bp); 1434 1434 } 1435 1435 1436 - /****************************************************************************/ 1437 - /* */ 1438 - /* Routine Name: ips_proc_info */ 1439 - /* */ 1440 - /* Routine Description: */ 1441 - /* */ 1442 - /* The passthru interface for the driver */ 1443 - /* */ 1444 - /****************************************************************************/ 1445 1436 static int 1446 - ips_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, 1447 - int length, int func) 1437 + ips_write_info(struct Scsi_Host *host, char *buffer, int length) 1448 1438 { 1449 1439 int i; 1450 - int ret; 1451 1440 ips_ha_t *ha = NULL; 1452 - 1453 - METHOD_TRACE("ips_proc_info", 1); 1454 1441 1455 1442 /* Find our host structure */ 1456 1443 for (i = 0; i < ips_next_controller; i++) { ··· 1452 1465 if (!ha) 1453 1466 return (-EINVAL); 1454 1467 1455 - if (func) { 1456 - /* write */ 1457 - return (0); 1458 - } else { 1459 - /* read */ 1460 - if (start) 1461 - *start = buffer; 1468 + return 0; 1469 + } 1462 1470 1463 - ret = ips_host_info(ha, buffer, offset, length); 1471 + static int 1472 + ips_show_info(struct seq_file *m, struct Scsi_Host *host) 1473 + { 1474 + int i; 1475 + ips_ha_t *ha = NULL; 1464 1476 1465 - return (ret); 1477 + /* Find our host structure */ 1478 + for (i = 0; i < ips_next_controller; i++) { 1479 + if (ips_sh[i]) { 1480 + if (ips_sh[i] == host) { 1481 + ha = (ips_ha_t *) ips_sh[i]->hostdata; 1482 + break; 1483 + } 1484 + } 1466 1485 } 1486 + 1487 + if (!ha) 1488 + return (-EINVAL); 1489 + 1490 + return ips_host_info(ha, m); 1467 1491 } 1468 1492 1469 1493 /*--------------------------------------------------------------------------*/ ··· 2033 2035 /* */ 2034 2036 /****************************************************************************/ 2035 2037 static int 2036 - ips_host_info(ips_ha_t * ha, char *ptr, off_t offset, int len) 2038 + ips_host_info(ips_ha_t *ha, struct seq_file *m) 2037 2039 { 2038 - IPS_INFOSTR info; 2039 - 2040 2040 METHOD_TRACE("ips_host_info", 1); 2041 2041 2042 - info.buffer = ptr; 2043 - info.length = len; 2044 - info.offset = offset; 2045 - info.pos = 0; 2046 - info.localpos = 0; 2047 - 2048 - copy_info(&info, "\nIBM ServeRAID General Information:\n\n"); 2042 + seq_printf(m, "\nIBM ServeRAID General Information:\n\n"); 2049 2043 2050 2044 if ((le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) && 2051 2045 (le16_to_cpu(ha->nvram->adapter_type) != 0)) 2052 - copy_info(&info, "\tController Type : %s\n", 2046 + seq_printf(m, "\tController Type : %s\n", 2053 2047 ips_adapter_name[ha->ad_type - 1]); 2054 2048 else 2055 - copy_info(&info, 2049 + seq_printf(m, 2056 2050 "\tController Type : Unknown\n"); 2057 2051 2058 2052 if (ha->io_addr) 2059 - copy_info(&info, 2053 + seq_printf(m, 2060 2054 "\tIO region : 0x%lx (%d bytes)\n", 2061 2055 ha->io_addr, ha->io_len); 2062 2056 2063 2057 if (ha->mem_addr) { 2064 - copy_info(&info, 2058 + seq_printf(m, 2065 2059 "\tMemory region : 0x%lx (%d bytes)\n", 2066 2060 ha->mem_addr, ha->mem_len); 2067 - copy_info(&info, 2061 + seq_printf(m, 2068 2062 "\tShared memory address : 0x%lx\n", 2069 2063 ha->mem_ptr); 2070 2064 } 2071 2065 2072 - copy_info(&info, "\tIRQ number : %d\n", ha->pcidev->irq); 2066 + seq_printf(m, "\tIRQ number : %d\n", ha->pcidev->irq); 2073 2067 2074 2068 /* For the Next 3 lines Check for Binary 0 at the end and don't include it if it's there. */ 2075 2069 /* That keeps everything happy for "text" operations on the proc file. */ 2076 2070 2077 2071 if (le32_to_cpu(ha->nvram->signature) == IPS_NVRAM_P5_SIG) { 2078 2072 if (ha->nvram->bios_low[3] == 0) { 2079 - copy_info(&info, 2080 - "\tBIOS Version : %c%c%c%c%c%c%c\n", 2081 - ha->nvram->bios_high[0], ha->nvram->bios_high[1], 2082 - ha->nvram->bios_high[2], ha->nvram->bios_high[3], 2083 - ha->nvram->bios_low[0], ha->nvram->bios_low[1], 2084 - ha->nvram->bios_low[2]); 2073 + seq_printf(m, 2074 + "\tBIOS Version : %c%c%c%c%c%c%c\n", 2075 + ha->nvram->bios_high[0], ha->nvram->bios_high[1], 2076 + ha->nvram->bios_high[2], ha->nvram->bios_high[3], 2077 + ha->nvram->bios_low[0], ha->nvram->bios_low[1], 2078 + ha->nvram->bios_low[2]); 2085 2079 2086 2080 } else { 2087 - copy_info(&info, 2088 - "\tBIOS Version : %c%c%c%c%c%c%c%c\n", 2089 - ha->nvram->bios_high[0], ha->nvram->bios_high[1], 2090 - ha->nvram->bios_high[2], ha->nvram->bios_high[3], 2091 - ha->nvram->bios_low[0], ha->nvram->bios_low[1], 2092 - ha->nvram->bios_low[2], ha->nvram->bios_low[3]); 2081 + seq_printf(m, 2082 + "\tBIOS Version : %c%c%c%c%c%c%c%c\n", 2083 + ha->nvram->bios_high[0], ha->nvram->bios_high[1], 2084 + ha->nvram->bios_high[2], ha->nvram->bios_high[3], 2085 + ha->nvram->bios_low[0], ha->nvram->bios_low[1], 2086 + ha->nvram->bios_low[2], ha->nvram->bios_low[3]); 2093 2087 } 2094 2088 2095 2089 } 2096 2090 2097 2091 if (ha->enq->CodeBlkVersion[7] == 0) { 2098 - copy_info(&info, 2099 - "\tFirmware Version : %c%c%c%c%c%c%c\n", 2100 - ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], 2101 - ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], 2102 - ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], 2103 - ha->enq->CodeBlkVersion[6]); 2092 + seq_printf(m, 2093 + "\tFirmware Version : %c%c%c%c%c%c%c\n", 2094 + ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], 2095 + ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], 2096 + ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], 2097 + ha->enq->CodeBlkVersion[6]); 2104 2098 } else { 2105 - copy_info(&info, 2106 - "\tFirmware Version : %c%c%c%c%c%c%c%c\n", 2107 - ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], 2108 - ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], 2109 - ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], 2110 - ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); 2099 + seq_printf(m, 2100 + "\tFirmware Version : %c%c%c%c%c%c%c%c\n", 2101 + ha->enq->CodeBlkVersion[0], ha->enq->CodeBlkVersion[1], 2102 + ha->enq->CodeBlkVersion[2], ha->enq->CodeBlkVersion[3], 2103 + ha->enq->CodeBlkVersion[4], ha->enq->CodeBlkVersion[5], 2104 + ha->enq->CodeBlkVersion[6], ha->enq->CodeBlkVersion[7]); 2111 2105 } 2112 2106 2113 2107 if (ha->enq->BootBlkVersion[7] == 0) { 2114 - copy_info(&info, 2115 - "\tBoot Block Version : %c%c%c%c%c%c%c\n", 2116 - ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], 2117 - ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], 2118 - ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], 2119 - ha->enq->BootBlkVersion[6]); 2108 + seq_printf(m, 2109 + "\tBoot Block Version : %c%c%c%c%c%c%c\n", 2110 + ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], 2111 + ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], 2112 + ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], 2113 + ha->enq->BootBlkVersion[6]); 2120 2114 } else { 2121 - copy_info(&info, 2122 - "\tBoot Block Version : %c%c%c%c%c%c%c%c\n", 2123 - ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], 2124 - ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], 2125 - ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], 2126 - ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); 2115 + seq_printf(m, 2116 + "\tBoot Block Version : %c%c%c%c%c%c%c%c\n", 2117 + ha->enq->BootBlkVersion[0], ha->enq->BootBlkVersion[1], 2118 + ha->enq->BootBlkVersion[2], ha->enq->BootBlkVersion[3], 2119 + ha->enq->BootBlkVersion[4], ha->enq->BootBlkVersion[5], 2120 + ha->enq->BootBlkVersion[6], ha->enq->BootBlkVersion[7]); 2127 2121 } 2128 2122 2129 - copy_info(&info, "\tDriver Version : %s%s\n", 2123 + seq_printf(m, "\tDriver Version : %s%s\n", 2130 2124 IPS_VERSION_HIGH, IPS_VERSION_LOW); 2131 2125 2132 - copy_info(&info, "\tDriver Build : %d\n", 2126 + seq_printf(m, "\tDriver Build : %d\n", 2133 2127 IPS_BUILD_IDENT); 2134 2128 2135 - copy_info(&info, "\tMax Physical Devices : %d\n", 2129 + seq_printf(m, "\tMax Physical Devices : %d\n", 2136 2130 ha->enq->ucMaxPhysicalDevices); 2137 - copy_info(&info, "\tMax Active Commands : %d\n", 2131 + seq_printf(m, "\tMax Active Commands : %d\n", 2138 2132 ha->max_cmds); 2139 - copy_info(&info, "\tCurrent Queued Commands : %d\n", 2133 + seq_printf(m, "\tCurrent Queued Commands : %d\n", 2140 2134 ha->scb_waitlist.count); 2141 - copy_info(&info, "\tCurrent Active Commands : %d\n", 2135 + seq_printf(m, "\tCurrent Active Commands : %d\n", 2142 2136 ha->scb_activelist.count - ha->num_ioctl); 2143 - copy_info(&info, "\tCurrent Queued PT Commands : %d\n", 2137 + seq_printf(m, "\tCurrent Queued PT Commands : %d\n", 2144 2138 ha->copp_waitlist.count); 2145 - copy_info(&info, "\tCurrent Active PT Commands : %d\n", 2139 + seq_printf(m, "\tCurrent Active PT Commands : %d\n", 2146 2140 ha->num_ioctl); 2147 2141 2148 - copy_info(&info, "\n"); 2142 + seq_printf(m, "\n"); 2149 2143 2150 - return (info.localpos); 2151 - } 2152 - 2153 - /****************************************************************************/ 2154 - /* */ 2155 - /* Routine Name: copy_mem_info */ 2156 - /* */ 2157 - /* Routine Description: */ 2158 - /* */ 2159 - /* Copy data into an IPS_INFOSTR structure */ 2160 - /* */ 2161 - /****************************************************************************/ 2162 - static void 2163 - copy_mem_info(IPS_INFOSTR * info, char *data, int len) 2164 - { 2165 - METHOD_TRACE("copy_mem_info", 1); 2166 - 2167 - if (info->pos + len < info->offset) { 2168 - info->pos += len; 2169 - return; 2170 - } 2171 - 2172 - if (info->pos < info->offset) { 2173 - data += (info->offset - info->pos); 2174 - len -= (info->offset - info->pos); 2175 - info->pos += (info->offset - info->pos); 2176 - } 2177 - 2178 - if (info->localpos + len > info->length) 2179 - len = info->length - info->localpos; 2180 - 2181 - if (len > 0) { 2182 - memcpy(info->buffer + info->localpos, data, len); 2183 - info->pos += len; 2184 - info->localpos += len; 2185 - } 2186 - } 2187 - 2188 - /****************************************************************************/ 2189 - /* */ 2190 - /* Routine Name: copy_info */ 2191 - /* */ 2192 - /* Routine Description: */ 2193 - /* */ 2194 - /* printf style wrapper for an info structure */ 2195 - /* */ 2196 - /****************************************************************************/ 2197 - static int 2198 - copy_info(IPS_INFOSTR * info, char *fmt, ...) 2199 - { 2200 - va_list args; 2201 - char buf[128]; 2202 - int len; 2203 - 2204 - METHOD_TRACE("copy_info", 1); 2205 - 2206 - va_start(args, fmt); 2207 - len = vsprintf(buf, fmt, args); 2208 - va_end(args); 2209 - 2210 - copy_mem_info(info, buf, len); 2211 - 2212 - return (len); 2144 + return 0; 2213 2145 } 2214 2146 2215 2147 /****************************************************************************/
-9
drivers/scsi/ips.h
··· 416 416 /* 417 417 * Scsi_Host Template 418 418 */ 419 - static int ips_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int); 420 419 static int ips_biosparam(struct scsi_device *sdev, struct block_device *bdev, 421 420 sector_t capacity, int geom[]); 422 421 static int ips_slave_configure(struct scsi_device *SDptr); ··· 957 958 IPS_STD_SG_LIST *std_list; 958 959 IPS_ENH_SG_LIST *enh_list; 959 960 } IPS_SG_LIST; 960 - 961 - typedef struct _IPS_INFOSTR { 962 - char *buffer; 963 - int length; 964 - int offset; 965 - int pos; 966 - int localpos; 967 - } IPS_INFOSTR; 968 961 969 962 typedef struct { 970 963 char *option_name;