diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2013-03-31 00:52:08 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-09 14:13:16 -0400 |
commit | 3e0552eebdf621504eaec7786613ef94a63463a0 (patch) | |
tree | 52c1fbe8b55488d462ab98356327de9b9f86e9c0 /drivers/scsi/gdth_proc.c | |
parent | 408bb25ba50c6abaf516d844fd62556ec89a0af2 (diff) |
gdth: switch to ->show_info()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/scsi/gdth_proc.c')
-rw-r--r-- | drivers/scsi/gdth_proc.c | 211 |
1 files changed, 48 insertions, 163 deletions
diff --git a/drivers/scsi/gdth_proc.c b/drivers/scsi/gdth_proc.c index 652754319a4b..9fb632684863 100644 --- a/drivers/scsi/gdth_proc.c +++ b/drivers/scsi/gdth_proc.c | |||
@@ -5,23 +5,9 @@ | |||
5 | #include <linux/completion.h> | 5 | #include <linux/completion.h> |
6 | #include <linux/slab.h> | 6 | #include <linux/slab.h> |
7 | 7 | ||
8 | int gdth_proc_info(struct Scsi_Host *host, char *buffer,char **start,off_t offset,int length, | 8 | int gdth_set_info(struct Scsi_Host *host, char *buffer, int length) |
9 | int inout) | ||
10 | { | 9 | { |
11 | gdth_ha_str *ha = shost_priv(host); | 10 | gdth_ha_str *ha = shost_priv(host); |
12 | |||
13 | TRACE2(("gdth_proc_info() length %d offs %d inout %d\n", | ||
14 | length,(int)offset,inout)); | ||
15 | |||
16 | if (inout) | ||
17 | return(gdth_set_info(buffer,length,host,ha)); | ||
18 | else | ||
19 | return(gdth_get_info(buffer,start,offset,length,host,ha)); | ||
20 | } | ||
21 | |||
22 | static int gdth_set_info(char *buffer,int length,struct Scsi_Host *host, | ||
23 | gdth_ha_str *ha) | ||
24 | { | ||
25 | int ret_val = -EINVAL; | 11 | int ret_val = -EINVAL; |
26 | 12 | ||
27 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); | 13 | TRACE2(("gdth_set_info() ha %d\n",ha->hanum,)); |
@@ -149,12 +135,10 @@ static int gdth_set_asc_info(struct Scsi_Host *host, char *buffer, | |||
149 | return(-EINVAL); | 135 | return(-EINVAL); |
150 | } | 136 | } |
151 | 137 | ||
152 | static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | 138 | int gdth_show_info(struct seq_file *m, struct Scsi_Host *host) |
153 | struct Scsi_Host *host, gdth_ha_str *ha) | ||
154 | { | 139 | { |
155 | int size = 0,len = 0; | 140 | gdth_ha_str *ha = shost_priv(host); |
156 | int hlen; | 141 | int hlen; |
157 | off_t begin = 0,pos = 0; | ||
158 | int id, i, j, k, sec, flag; | 142 | int id, i, j, k, sec, flag; |
159 | int no_mdrv = 0, drv_no, is_mirr; | 143 | int no_mdrv = 0, drv_no, is_mirr; |
160 | u32 cnt; | 144 | u32 cnt; |
@@ -189,8 +173,7 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
189 | /* request is i.e. "cat /proc/scsi/gdth/0" */ | 173 | /* request is i.e. "cat /proc/scsi/gdth/0" */ |
190 | /* format: %-15s\t%-10s\t%-15s\t%s */ | 174 | /* format: %-15s\t%-10s\t%-15s\t%s */ |
191 | /* driver parameters */ | 175 | /* driver parameters */ |
192 | size = sprintf(buffer+len,"Driver Parameters:\n"); | 176 | seq_printf(m, "Driver Parameters:\n"); |
193 | len += size; pos = begin + len; | ||
194 | if (reserve_list[0] == 0xff) | 177 | if (reserve_list[0] == 0xff) |
195 | strcpy(hrec, "--"); | 178 | strcpy(hrec, "--"); |
196 | else { | 179 | else { |
@@ -201,69 +184,50 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
201 | hlen += snprintf(hrec + hlen , 161 - hlen, ",%d", reserve_list[i]); | 184 | hlen += snprintf(hrec + hlen , 161 - hlen, ",%d", reserve_list[i]); |
202 | } | 185 | } |
203 | } | 186 | } |
204 | size = sprintf(buffer+len, | 187 | seq_printf(m, |
205 | " reserve_mode: \t%d \treserve_list: \t%s\n", | 188 | " reserve_mode: \t%d \treserve_list: \t%s\n", |
206 | reserve_mode, hrec); | 189 | reserve_mode, hrec); |
207 | len += size; pos = begin + len; | 190 | seq_printf(m, |
208 | size = sprintf(buffer+len, | ||
209 | " max_ids: \t%-3d \thdr_channel: \t%d\n", | 191 | " max_ids: \t%-3d \thdr_channel: \t%d\n", |
210 | max_ids, hdr_channel); | 192 | max_ids, hdr_channel); |
211 | len += size; pos = begin + len; | ||
212 | 193 | ||
213 | /* controller information */ | 194 | /* controller information */ |
214 | size = sprintf(buffer+len,"\nDisk Array Controller Information:\n"); | 195 | seq_printf(m,"\nDisk Array Controller Information:\n"); |
215 | len += size; pos = begin + len; | 196 | seq_printf(m, |
216 | strcpy(hrec, ha->binfo.type_string); | ||
217 | size = sprintf(buffer+len, | ||
218 | " Number: \t%d \tName: \t%s\n", | 197 | " Number: \t%d \tName: \t%s\n", |
219 | ha->hanum, hrec); | 198 | ha->hanum, ha->binfo.type_string); |
220 | len += size; pos = begin + len; | ||
221 | 199 | ||
200 | seq_printf(m, | ||
201 | " Driver Ver.: \t%-10s\tFirmware Ver.: \t", | ||
202 | GDTH_VERSION_STR); | ||
222 | if (ha->more_proc) | 203 | if (ha->more_proc) |
223 | sprintf(hrec, "%d.%02d.%02d-%c%03X", | 204 | seq_printf(m, "%d.%02d.%02d-%c%03X\n", |
224 | (u8)(ha->binfo.upd_fw_ver>>24), | 205 | (u8)(ha->binfo.upd_fw_ver>>24), |
225 | (u8)(ha->binfo.upd_fw_ver>>16), | 206 | (u8)(ha->binfo.upd_fw_ver>>16), |
226 | (u8)(ha->binfo.upd_fw_ver), | 207 | (u8)(ha->binfo.upd_fw_ver), |
227 | ha->bfeat.raid ? 'R':'N', | 208 | ha->bfeat.raid ? 'R':'N', |
228 | ha->binfo.upd_revision); | 209 | ha->binfo.upd_revision); |
229 | else | 210 | else |
230 | sprintf(hrec, "%d.%02d", (u8)(ha->cpar.version>>8), | 211 | seq_printf(m, "%d.%02d\n", (u8)(ha->cpar.version>>8), |
231 | (u8)(ha->cpar.version)); | 212 | (u8)(ha->cpar.version)); |
232 | |||
233 | size = sprintf(buffer+len, | ||
234 | " Driver Ver.: \t%-10s\tFirmware Ver.: \t%s\n", | ||
235 | GDTH_VERSION_STR, hrec); | ||
236 | len += size; pos = begin + len; | ||
237 | 213 | ||
238 | if (ha->more_proc) { | 214 | if (ha->more_proc) |
239 | /* more information: 1. about controller */ | 215 | /* more information: 1. about controller */ |
240 | size = sprintf(buffer+len, | 216 | seq_printf(m, |
241 | " Serial No.: \t0x%8X\tCache RAM size:\t%d KB\n", | 217 | " Serial No.: \t0x%8X\tCache RAM size:\t%d KB\n", |
242 | ha->binfo.ser_no, ha->binfo.memsize / 1024); | 218 | ha->binfo.ser_no, ha->binfo.memsize / 1024); |
243 | len += size; pos = begin + len; | ||
244 | } | ||
245 | 219 | ||
246 | #ifdef GDTH_DMA_STATISTICS | 220 | #ifdef GDTH_DMA_STATISTICS |
247 | /* controller statistics */ | 221 | /* controller statistics */ |
248 | size = sprintf(buffer+len,"\nController Statistics:\n"); | 222 | seq_printf(m,"\nController Statistics:\n"); |
249 | len += size; pos = begin + len; | 223 | seq_printf(m, |
250 | size = sprintf(buffer+len, | ||
251 | " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n", | 224 | " 32-bit DMA buffer:\t%lu\t64-bit DMA buffer:\t%lu\n", |
252 | ha->dma32_cnt, ha->dma64_cnt); | 225 | ha->dma32_cnt, ha->dma64_cnt); |
253 | len += size; pos = begin + len; | ||
254 | #endif | 226 | #endif |
255 | 227 | ||
256 | if (pos < offset) { | ||
257 | len = 0; | ||
258 | begin = pos; | ||
259 | } | ||
260 | if (pos > offset + length) | ||
261 | goto stop_output; | ||
262 | |||
263 | if (ha->more_proc) { | 228 | if (ha->more_proc) { |
264 | /* more information: 2. about physical devices */ | 229 | /* more information: 2. about physical devices */ |
265 | size = sprintf(buffer+len,"\nPhysical Devices:"); | 230 | seq_printf(m, "\nPhysical Devices:"); |
266 | len += size; pos = begin + len; | ||
267 | flag = FALSE; | 231 | flag = FALSE; |
268 | 232 | ||
269 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 233 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -309,21 +273,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
309 | strncpy(hrec+8,pdi->product,16); | 273 | strncpy(hrec+8,pdi->product,16); |
310 | strncpy(hrec+24,pdi->revision,4); | 274 | strncpy(hrec+24,pdi->revision,4); |
311 | hrec[28] = 0; | 275 | hrec[28] = 0; |
312 | size = sprintf(buffer+len, | 276 | seq_printf(m, |
313 | "\n Chn/ID/LUN: \t%c/%02d/%d \tName: \t%s\n", | 277 | "\n Chn/ID/LUN: \t%c/%02d/%d \tName: \t%s\n", |
314 | 'A'+i,pdi->target_id,pdi->lun,hrec); | 278 | 'A'+i,pdi->target_id,pdi->lun,hrec); |
315 | len += size; pos = begin + len; | ||
316 | flag = TRUE; | 279 | flag = TRUE; |
317 | pdi->no_ldrive &= 0xffff; | 280 | pdi->no_ldrive &= 0xffff; |
318 | if (pdi->no_ldrive == 0xffff) | 281 | if (pdi->no_ldrive == 0xffff) |
319 | strcpy(hrec,"--"); | 282 | strcpy(hrec,"--"); |
320 | else | 283 | else |
321 | sprintf(hrec,"%d",pdi->no_ldrive); | 284 | sprintf(hrec,"%d",pdi->no_ldrive); |
322 | size = sprintf(buffer+len, | 285 | seq_printf(m, |
323 | " Capacity [MB]:\t%-6d \tTo Log. Drive: \t%s\n", | 286 | " Capacity [MB]:\t%-6d \tTo Log. Drive: \t%s\n", |
324 | pdi->blkcnt/(1024*1024/pdi->blksize), | 287 | pdi->blkcnt/(1024*1024/pdi->blksize), |
325 | hrec); | 288 | hrec); |
326 | len += size; pos = begin + len; | ||
327 | } else { | 289 | } else { |
328 | pdi->devtype = 0xff; | 290 | pdi->devtype = 0xff; |
329 | } | 291 | } |
@@ -333,11 +295,10 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
333 | for (k = 0; k < pds->count; ++k) { | 295 | for (k = 0; k < pds->count; ++k) { |
334 | if (pds->list[k].tid == pdi->target_id && | 296 | if (pds->list[k].tid == pdi->target_id && |
335 | pds->list[k].lun == pdi->lun) { | 297 | pds->list[k].lun == pdi->lun) { |
336 | size = sprintf(buffer+len, | 298 | seq_printf(m, |
337 | " Retries: \t%-6d \tReassigns: \t%d\n", | 299 | " Retries: \t%-6d \tReassigns: \t%d\n", |
338 | pds->list[k].retries, | 300 | pds->list[k].retries, |
339 | pds->list[k].reassigns); | 301 | pds->list[k].reassigns); |
340 | len += size; pos = begin + len; | ||
341 | break; | 302 | break; |
342 | } | 303 | } |
343 | } | 304 | } |
@@ -355,32 +316,20 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
355 | pdef->sddc_type = 0x08; | 316 | pdef->sddc_type = 0x08; |
356 | 317 | ||
357 | if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) { | 318 | if (gdth_execute(host, gdtcmd, cmnd, 30, NULL) == S_OK) { |
358 | size = sprintf(buffer+len, | 319 | seq_printf(m, |
359 | " Grown Defects:\t%d\n", | 320 | " Grown Defects:\t%d\n", |
360 | pdef->sddc_cnt); | 321 | pdef->sddc_cnt); |
361 | len += size; pos = begin + len; | ||
362 | } | 322 | } |
363 | } | 323 | } |
364 | if (pos < offset) { | ||
365 | len = 0; | ||
366 | begin = pos; | ||
367 | } | ||
368 | if (pos > offset + length) { | ||
369 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
370 | goto stop_output; | ||
371 | } | ||
372 | } | 324 | } |
373 | } | 325 | } |
374 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 326 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
375 | 327 | ||
376 | if (!flag) { | 328 | if (!flag) |
377 | size = sprintf(buffer+len, "\n --\n"); | 329 | seq_printf(m, "\n --\n"); |
378 | len += size; pos = begin + len; | ||
379 | } | ||
380 | 330 | ||
381 | /* 3. about logical drives */ | 331 | /* 3. about logical drives */ |
382 | size = sprintf(buffer+len,"\nLogical Drives:"); | 332 | seq_printf(m,"\nLogical Drives:"); |
383 | len += size; pos = begin + len; | ||
384 | flag = FALSE; | 333 | flag = FALSE; |
385 | 334 | ||
386 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 335 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -418,10 +367,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
418 | } | 367 | } |
419 | 368 | ||
420 | if (drv_no == i) { | 369 | if (drv_no == i) { |
421 | size = sprintf(buffer+len, | 370 | seq_printf(m, |
422 | "\n Number: \t%-2d \tStatus: \t%s\n", | 371 | "\n Number: \t%-2d \tStatus: \t%s\n", |
423 | drv_no, hrec); | 372 | drv_no, hrec); |
424 | len += size; pos = begin + len; | ||
425 | flag = TRUE; | 373 | flag = TRUE; |
426 | no_mdrv = pcdi->cd_ldcnt; | 374 | no_mdrv = pcdi->cd_ldcnt; |
427 | if (no_mdrv > 1 || pcdi->ld_slave != -1) { | 375 | if (no_mdrv > 1 || pcdi->ld_slave != -1) { |
@@ -436,61 +384,37 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
436 | } else { | 384 | } else { |
437 | strcpy(hrec, "???"); | 385 | strcpy(hrec, "???"); |
438 | } | 386 | } |
439 | size = sprintf(buffer+len, | 387 | seq_printf(m, |
440 | " Capacity [MB]:\t%-6d \tType: \t%s\n", | 388 | " Capacity [MB]:\t%-6d \tType: \t%s\n", |
441 | pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize), | 389 | pcdi->ld_blkcnt/(1024*1024/pcdi->ld_blksize), |
442 | hrec); | 390 | hrec); |
443 | len += size; pos = begin + len; | ||
444 | } else { | 391 | } else { |
445 | size = sprintf(buffer+len, | 392 | seq_printf(m, |
446 | " Slave Number: \t%-2d \tStatus: \t%s\n", | 393 | " Slave Number: \t%-2d \tStatus: \t%s\n", |
447 | drv_no & 0x7fff, hrec); | 394 | drv_no & 0x7fff, hrec); |
448 | len += size; pos = begin + len; | ||
449 | } | 395 | } |
450 | drv_no = pcdi->ld_slave; | 396 | drv_no = pcdi->ld_slave; |
451 | if (pos < offset) { | ||
452 | len = 0; | ||
453 | begin = pos; | ||
454 | } | ||
455 | if (pos > offset + length) { | ||
456 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
457 | goto stop_output; | ||
458 | } | ||
459 | } while (drv_no != -1); | 397 | } while (drv_no != -1); |
460 | 398 | ||
461 | if (is_mirr) { | 399 | if (is_mirr) |
462 | size = sprintf(buffer+len, | 400 | seq_printf(m, |
463 | " Missing Drv.: \t%-2d \tInvalid Drv.: \t%d\n", | 401 | " Missing Drv.: \t%-2d \tInvalid Drv.: \t%d\n", |
464 | no_mdrv - j - k, k); | 402 | no_mdrv - j - k, k); |
465 | len += size; pos = begin + len; | 403 | |
466 | } | ||
467 | |||
468 | if (!ha->hdr[i].is_arraydrv) | 404 | if (!ha->hdr[i].is_arraydrv) |
469 | strcpy(hrec, "--"); | 405 | strcpy(hrec, "--"); |
470 | else | 406 | else |
471 | sprintf(hrec, "%d", ha->hdr[i].master_no); | 407 | sprintf(hrec, "%d", ha->hdr[i].master_no); |
472 | size = sprintf(buffer+len, | 408 | seq_printf(m, |
473 | " To Array Drv.:\t%s\n", hrec); | 409 | " To Array Drv.:\t%s\n", hrec); |
474 | len += size; pos = begin + len; | ||
475 | if (pos < offset) { | ||
476 | len = 0; | ||
477 | begin = pos; | ||
478 | } | ||
479 | if (pos > offset + length) { | ||
480 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
481 | goto stop_output; | ||
482 | } | ||
483 | } | 410 | } |
484 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 411 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
485 | 412 | ||
486 | if (!flag) { | 413 | if (!flag) |
487 | size = sprintf(buffer+len, "\n --\n"); | 414 | seq_printf(m, "\n --\n"); |
488 | len += size; pos = begin + len; | ||
489 | } | ||
490 | 415 | ||
491 | /* 4. about array drives */ | 416 | /* 4. about array drives */ |
492 | size = sprintf(buffer+len,"\nArray Drives:"); | 417 | seq_printf(m,"\nArray Drives:"); |
493 | len += size; pos = begin + len; | ||
494 | flag = FALSE; | 418 | flag = FALSE; |
495 | 419 | ||
496 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); | 420 | buf = gdth_ioctl_alloc(ha, GDTH_SCRATCH, FALSE, &paddr); |
@@ -525,10 +449,9 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
525 | strcat(hrec, "/expand"); | 449 | strcat(hrec, "/expand"); |
526 | else if (pai->ai_ext_state & 0x1) | 450 | else if (pai->ai_ext_state & 0x1) |
527 | strcat(hrec, "/patch"); | 451 | strcat(hrec, "/patch"); |
528 | size = sprintf(buffer+len, | 452 | seq_printf(m, |
529 | "\n Number: \t%-2d \tStatus: \t%s\n", | 453 | "\n Number: \t%-2d \tStatus: \t%s\n", |
530 | i,hrec); | 454 | i,hrec); |
531 | len += size; pos = begin + len; | ||
532 | flag = TRUE; | 455 | flag = TRUE; |
533 | 456 | ||
534 | if (pai->ai_type == 0) | 457 | if (pai->ai_type == 0) |
@@ -539,31 +462,19 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
539 | strcpy(hrec, "RAID-5"); | 462 | strcpy(hrec, "RAID-5"); |
540 | else | 463 | else |
541 | strcpy(hrec, "RAID-10"); | 464 | strcpy(hrec, "RAID-10"); |
542 | size = sprintf(buffer+len, | 465 | seq_printf(m, |
543 | " Capacity [MB]:\t%-6d \tType: \t%s\n", | 466 | " Capacity [MB]:\t%-6d \tType: \t%s\n", |
544 | pai->ai_size/(1024*1024/pai->ai_secsize), | 467 | pai->ai_size/(1024*1024/pai->ai_secsize), |
545 | hrec); | 468 | hrec); |
546 | len += size; pos = begin + len; | ||
547 | if (pos < offset) { | ||
548 | len = 0; | ||
549 | begin = pos; | ||
550 | } | ||
551 | if (pos > offset + length) { | ||
552 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | ||
553 | goto stop_output; | ||
554 | } | ||
555 | } | 469 | } |
556 | } | 470 | } |
557 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); | 471 | gdth_ioctl_free(ha, GDTH_SCRATCH, buf, paddr); |
558 | 472 | ||
559 | if (!flag) { | 473 | if (!flag) |
560 | size = sprintf(buffer+len, "\n --\n"); | 474 | seq_printf(m, "\n --\n"); |
561 | len += size; pos = begin + len; | ||
562 | } | ||
563 | 475 | ||
564 | /* 5. about host drives */ | 476 | /* 5. about host drives */ |
565 | size = sprintf(buffer+len,"\nHost Drives:"); | 477 | seq_printf(m,"\nHost Drives:"); |
566 | len += size; pos = begin + len; | ||
567 | flag = FALSE; | 478 | flag = FALSE; |
568 | 479 | ||
569 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); | 480 | buf = gdth_ioctl_alloc(ha, sizeof(gdth_hget_str), FALSE, &paddr); |
@@ -605,33 +516,22 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
605 | if (!(ha->hdr[i].present)) | 516 | if (!(ha->hdr[i].present)) |
606 | continue; | 517 | continue; |
607 | 518 | ||
608 | size = sprintf(buffer+len, | 519 | seq_printf(m, |
609 | "\n Number: \t%-2d \tArr/Log. Drive:\t%d\n", | 520 | "\n Number: \t%-2d \tArr/Log. Drive:\t%d\n", |
610 | i, ha->hdr[i].ldr_no); | 521 | i, ha->hdr[i].ldr_no); |
611 | len += size; pos = begin + len; | ||
612 | flag = TRUE; | 522 | flag = TRUE; |
613 | 523 | ||
614 | size = sprintf(buffer+len, | 524 | seq_printf(m, |
615 | " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n", | 525 | " Capacity [MB]:\t%-6d \tStart Sector: \t%d\n", |
616 | (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); | 526 | (u32)(ha->hdr[i].size/2048), ha->hdr[i].start_sec); |
617 | len += size; pos = begin + len; | ||
618 | if (pos < offset) { | ||
619 | len = 0; | ||
620 | begin = pos; | ||
621 | } | ||
622 | if (pos > offset + length) | ||
623 | goto stop_output; | ||
624 | } | 527 | } |
625 | 528 | ||
626 | if (!flag) { | 529 | if (!flag) |
627 | size = sprintf(buffer+len, "\n --\n"); | 530 | seq_printf(m, "\n --\n"); |
628 | len += size; pos = begin + len; | ||
629 | } | ||
630 | } | 531 | } |
631 | 532 | ||
632 | /* controller events */ | 533 | /* controller events */ |
633 | size = sprintf(buffer+len,"\nController Events:\n"); | 534 | seq_printf(m,"\nController Events:\n"); |
634 | len += size; pos = begin + len; | ||
635 | 535 | ||
636 | for (id = -1;;) { | 536 | for (id = -1;;) { |
637 | id = gdth_read_event(ha, id, estr); | 537 | id = gdth_read_event(ha, id, estr); |
@@ -643,29 +543,14 @@ static int gdth_get_info(char *buffer,char **start,off_t offset,int length, | |||
643 | do_gettimeofday(&tv); | 543 | do_gettimeofday(&tv); |
644 | sec = (int)(tv.tv_sec - estr->first_stamp); | 544 | sec = (int)(tv.tv_sec - estr->first_stamp); |
645 | if (sec < 0) sec = 0; | 545 | if (sec < 0) sec = 0; |
646 | size = sprintf(buffer+len," date- %02d:%02d:%02d\t%s\n", | 546 | seq_printf(m," date- %02d:%02d:%02d\t%s\n", |
647 | sec/3600, sec%3600/60, sec%60, hrec); | 547 | sec/3600, sec%3600/60, sec%60, hrec); |
648 | len += size; pos = begin + len; | ||
649 | if (pos < offset) { | ||
650 | len = 0; | ||
651 | begin = pos; | ||
652 | } | ||
653 | if (pos > offset + length) | ||
654 | goto stop_output; | ||
655 | } | 548 | } |
656 | if (id == -1) | 549 | if (id == -1) |
657 | break; | 550 | break; |
658 | } | 551 | } |
659 | |||
660 | stop_output: | 552 | stop_output: |
661 | *start = buffer +(offset-begin); | 553 | rc = 0; |
662 | len -= (offset-begin); | ||
663 | if (len > length) | ||
664 | len = length; | ||
665 | TRACE2(("get_info() len %d pos %d begin %d offset %d length %d size %d\n", | ||
666 | len,(int)pos,(int)begin,(int)offset,length,size)); | ||
667 | rc = len; | ||
668 | |||
669 | free_fail: | 554 | free_fail: |
670 | kfree(gdtcmd); | 555 | kfree(gdtcmd); |
671 | kfree(estr); | 556 | kfree(estr); |