aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-03-31 02:00:06 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2013-04-09 14:13:19 -0400
commite88b7bb002e8f53a02fcdf8aab9915ce1ec22940 (patch)
treeb12c8a7774eaabf0b3ef71959370116791f8b1f7
parent25daa96f2bf72901c3abe664e5b461f29bbf3282 (diff)
cciss: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/block/cciss_scsi.c96
1 files changed, 45 insertions, 51 deletions
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index da3311129a0c..ecd845cd28d8 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -54,13 +54,11 @@ static CommandList_struct *cmd_special_alloc(ctlr_info_t *h);
54static void cmd_free(ctlr_info_t *h, CommandList_struct *c); 54static void cmd_free(ctlr_info_t *h, CommandList_struct *c);
55static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c); 55static void cmd_special_free(ctlr_info_t *h, CommandList_struct *c);
56 56
57static int cciss_scsi_proc_info( 57static int cciss_scsi_write_info(struct Scsi_Host *sh,
58 struct Scsi_Host *sh,
59 char *buffer, /* data buffer */ 58 char *buffer, /* data buffer */
60 char **start, /* where data in buffer starts */ 59 int length); /* length of data in buffer */
61 off_t offset, /* offset from start of imaginary file */ 60static int cciss_scsi_show_info(struct seq_file *m,
62 int length, /* length of data in buffer */ 61 struct Scsi_Host *sh);
63 int func); /* 0 == read, 1 == write */
64 62
65static int cciss_scsi_queue_command (struct Scsi_Host *h, 63static int cciss_scsi_queue_command (struct Scsi_Host *h,
66 struct scsi_cmnd *cmd); 64 struct scsi_cmnd *cmd);
@@ -82,7 +80,8 @@ static struct scsi_host_template cciss_driver_template = {
82 .module = THIS_MODULE, 80 .module = THIS_MODULE,
83 .name = "cciss", 81 .name = "cciss",
84 .proc_name = "cciss", 82 .proc_name = "cciss",
85 .proc_info = cciss_scsi_proc_info, 83 .write_info = cciss_scsi_write_info,
84 .show_info = cciss_scsi_show_info,
86 .queuecommand = cciss_scsi_queue_command, 85 .queuecommand = cciss_scsi_queue_command,
87 .this_id = 7, 86 .this_id = 7,
88 .cmd_per_lun = 1, 87 .cmd_per_lun = 1,
@@ -1302,59 +1301,54 @@ cciss_scsi_user_command(ctlr_info_t *h, int hostno, char *buffer, int length)
1302 return length; 1301 return length;
1303} 1302}
1304 1303
1305
1306static int 1304static int
1307cciss_scsi_proc_info(struct Scsi_Host *sh, 1305cciss_scsi_write_info(struct Scsi_Host *sh,
1308 char *buffer, /* data buffer */ 1306 char *buffer, /* data buffer */
1309 char **start, /* where data in buffer starts */ 1307 int length) /* length of data in buffer */
1310 off_t offset, /* offset from start of imaginary file */
1311 int length, /* length of data in buffer */
1312 int func) /* 0 == read, 1 == write */
1313{ 1308{
1309 ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0];
1310 if (h == NULL) /* This really shouldn't ever happen. */
1311 return -EINVAL;
1314 1312
1315 int buflen, datalen; 1313 return cciss_scsi_user_command(h, sh->host_no,
1316 ctlr_info_t *h; 1314 buffer, length);
1315}
1316
1317static int
1318cciss_scsi_show_info(struct seq_file *m, struct Scsi_Host *sh)
1319{
1320
1321 ctlr_info_t *h = (ctlr_info_t *) sh->hostdata[0];
1317 int i; 1322 int i;
1318 1323
1319 h = (ctlr_info_t *) sh->hostdata[0];
1320 if (h == NULL) /* This really shouldn't ever happen. */ 1324 if (h == NULL) /* This really shouldn't ever happen. */
1321 return -EINVAL; 1325 return -EINVAL;
1322 1326
1323 if (func == 0) { /* User is reading from /proc/scsi/ciss*?/?* */ 1327 seq_printf(m, "cciss%d: SCSI host: %d\n",
1324 buflen = sprintf(buffer, "cciss%d: SCSI host: %d\n", 1328 h->ctlr, sh->host_no);
1325 h->ctlr, sh->host_no); 1329
1326 1330 /* this information is needed by apps to know which cciss
1327 /* this information is needed by apps to know which cciss 1331 device corresponds to which scsi host number without
1328 device corresponds to which scsi host number without 1332 having to open a scsi target device node. The device
1329 having to open a scsi target device node. The device 1333 information is not a duplicate of /proc/scsi/scsi because
1330 information is not a duplicate of /proc/scsi/scsi because 1334 the two may be out of sync due to scsi hotplug, rather
1331 the two may be out of sync due to scsi hotplug, rather 1335 this info is for an app to be able to use to know how to
1332 this info is for an app to be able to use to know how to 1336 get them back in sync. */
1333 get them back in sync. */ 1337
1334 1338 for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) {
1335 for (i = 0; i < ccissscsi[h->ctlr].ndevices; i++) { 1339 struct cciss_scsi_dev_t *sd =
1336 struct cciss_scsi_dev_t *sd = 1340 &ccissscsi[h->ctlr].dev[i];
1337 &ccissscsi[h->ctlr].dev[i]; 1341 seq_printf(m, "c%db%dt%dl%d %02d "
1338 buflen += sprintf(&buffer[buflen], "c%db%dt%dl%d %02d " 1342 "0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
1339 "0x%02x%02x%02x%02x%02x%02x%02x%02x\n", 1343 sh->host_no, sd->bus, sd->target, sd->lun,
1340 sh->host_no, sd->bus, sd->target, sd->lun, 1344 sd->devtype,
1341 sd->devtype, 1345 sd->scsi3addr[0], sd->scsi3addr[1],
1342 sd->scsi3addr[0], sd->scsi3addr[1], 1346 sd->scsi3addr[2], sd->scsi3addr[3],
1343 sd->scsi3addr[2], sd->scsi3addr[3], 1347 sd->scsi3addr[4], sd->scsi3addr[5],
1344 sd->scsi3addr[4], sd->scsi3addr[5], 1348 sd->scsi3addr[6], sd->scsi3addr[7]);
1345 sd->scsi3addr[6], sd->scsi3addr[7]); 1349 }
1346 } 1350 return 0;
1347 datalen = buflen - offset; 1351}
1348 if (datalen < 0) { /* they're reading past EOF. */
1349 datalen = 0;
1350 *start = buffer+buflen;
1351 } else
1352 *start = buffer + offset;
1353 return(datalen);
1354 } else /* User is writing to /proc/scsi/cciss*?/?* ... */
1355 return cciss_scsi_user_command(h, sh->host_no,
1356 buffer, length);
1357}
1358 1352
1359/* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci 1353/* cciss_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
1360 dma mapping and fills in the scatter gather entries of the 1354 dma mapping and fills in the scatter gather entries of the