提交 25daa96f 编写于 作者: A Al Viro

BusLogic: switch to ->show_info()

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 c8ed555a
...@@ -3201,26 +3201,30 @@ static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_de ...@@ -3201,26 +3201,30 @@ static int BusLogic_BIOSDiskParameters(struct scsi_device *sdev, struct block_de
BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>.
*/ */
static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *shost, char *ProcBuffer, char **StartPointer, off_t Offset, int BytesAvailable, int WriteFlag) static int BusLogic_write_info(struct Scsi_Host *shost, char *ProcBuffer, int BytesAvailable)
{ {
struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata;
struct BusLogic_TargetStatistics *TargetStatistics; struct BusLogic_TargetStatistics *TargetStatistics;
int TargetID, Length;
char *Buffer;
TargetStatistics = HostAdapter->TargetStatistics; TargetStatistics = HostAdapter->TargetStatistics;
if (WriteFlag) { HostAdapter->ExternalHostAdapterResets = 0;
HostAdapter->ExternalHostAdapterResets = 0; HostAdapter->HostAdapterInternalErrors = 0;
HostAdapter->HostAdapterInternalErrors = 0; memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics));
memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); return 0;
return 0; }
}
Buffer = HostAdapter->MessageBuffer; static int BusLogic_show_info(struct seq_file *m, struct Scsi_Host *shost)
Length = HostAdapter->MessageBufferLength; {
Length += sprintf(&Buffer[Length], "\n\ struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata;
struct BusLogic_TargetStatistics *TargetStatistics;
int TargetID;
TargetStatistics = HostAdapter->TargetStatistics;
seq_write(m, HostAdapter->MessageBuffer, HostAdapter->MessageBufferLength);
seq_printf(m, "\n\
Current Driver Queue Depth: %d\n\ Current Driver Queue Depth: %d\n\
Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs);
Length += sprintf(&Buffer[Length], "\n\n\ seq_printf(m, "\n\n\
DATA TRANSFER STATISTICS\n\ DATA TRANSFER STATISTICS\n\
\n\ \n\
Target Tagged Queuing Queue Depth Active Attempted Completed\n\ Target Tagged Queuing Queue Depth Active Attempted Completed\n\
...@@ -3229,66 +3233,62 @@ Target Tagged Queuing Queue Depth Active Attempted Completed\n\ ...@@ -3229,66 +3233,62 @@ Target Tagged Queuing Queue Depth Active Attempted Completed\n\
struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
if (!TargetFlags->TargetExists) if (!TargetFlags->TargetExists)
continue; continue;
Length += sprintf(&Buffer[Length], " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) seq_printf(m, " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID)
? " Permitted" : " Disabled")) ? " Permitted" : " Disabled"))
: "Not Supported")); : "Not Supported"));
Length += sprintf(&Buffer[Length], seq_printf(m,
" %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted);
} }
Length += sprintf(&Buffer[Length], "\n\ seq_printf(m, "\n\
Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\
====== ============= ============== =================== ===================\n"); ====== ============= ============== =================== ===================\n");
for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
if (!TargetFlags->TargetExists) if (!TargetFlags->TargetExists)
continue; continue;
Length += sprintf(&Buffer[Length], " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); seq_printf(m, " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands);
if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0)
Length += sprintf(&Buffer[Length], " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); seq_printf(m, " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units);
else else
Length += sprintf(&Buffer[Length], " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); seq_printf(m, " %9u", TargetStatistics[TargetID].TotalBytesRead.Units);
if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0)
Length += sprintf(&Buffer[Length], " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); seq_printf(m, " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units);
else else
Length += sprintf(&Buffer[Length], " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); seq_printf(m, " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units);
} }
Length += sprintf(&Buffer[Length], "\n\ seq_printf(m, "\n\
Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\
====== ======= ========= ========= ========= ========= =========\n"); ====== ======= ========= ========= ========= ========= =========\n");
for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
if (!TargetFlags->TargetExists) if (!TargetFlags->TargetExists)
continue; continue;
Length += seq_printf(m,
sprintf(&Buffer[Length],
" %2d Read %9u %9u %9u %9u %9u\n", TargetID, " %2d Read %9u %9u %9u %9u %9u\n", TargetID,
TargetStatistics[TargetID].ReadCommandSizeBuckets[0], TargetStatistics[TargetID].ReadCommandSizeBuckets[0],
TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]);
Length += seq_printf(m,
sprintf(&Buffer[Length],
" %2d Write %9u %9u %9u %9u %9u\n", TargetID, " %2d Write %9u %9u %9u %9u %9u\n", TargetID,
TargetStatistics[TargetID].WriteCommandSizeBuckets[0], TargetStatistics[TargetID].WriteCommandSizeBuckets[0],
TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]);
} }
Length += sprintf(&Buffer[Length], "\n\ seq_printf(m, "\n\
Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\
====== ======= ========= ========= ========= ========= =========\n"); ====== ======= ========= ========= ========= ========= =========\n");
for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) {
struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
if (!TargetFlags->TargetExists) if (!TargetFlags->TargetExists)
continue; continue;
Length += seq_printf(m,
sprintf(&Buffer[Length],
" %2d Read %9u %9u %9u %9u %9u\n", TargetID, " %2d Read %9u %9u %9u %9u %9u\n", TargetID,
TargetStatistics[TargetID].ReadCommandSizeBuckets[5], TargetStatistics[TargetID].ReadCommandSizeBuckets[5],
TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]);
Length += seq_printf(m,
sprintf(&Buffer[Length],
" %2d Write %9u %9u %9u %9u %9u\n", TargetID, " %2d Write %9u %9u %9u %9u %9u\n", TargetID,
TargetStatistics[TargetID].WriteCommandSizeBuckets[5], TargetStatistics[TargetID].WriteCommandSizeBuckets[5],
TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]);
} }
Length += sprintf(&Buffer[Length], "\n\n\ seq_printf(m, "\n\n\
ERROR RECOVERY STATISTICS\n\ ERROR RECOVERY STATISTICS\n\
\n\ \n\
Command Aborts Bus Device Resets Host Adapter Resets\n\ Command Aborts Bus Device Resets Host Adapter Resets\n\
...@@ -3299,20 +3299,12 @@ Target Requested Completed Requested Completed Requested Completed\n\ ...@@ -3299,20 +3299,12 @@ Target Requested Completed Requested Completed Requested Completed\n\
struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID];
if (!TargetFlags->TargetExists) if (!TargetFlags->TargetExists)
continue; continue;
Length += sprintf(&Buffer[Length], "\ seq_printf(m, "\
%2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted); %2d %5d %5d %5d %5d %5d %5d %5d %5d %5d\n", TargetID, TargetStatistics[TargetID].CommandAbortsRequested, TargetStatistics[TargetID].CommandAbortsAttempted, TargetStatistics[TargetID].CommandAbortsCompleted, TargetStatistics[TargetID].BusDeviceResetsRequested, TargetStatistics[TargetID].BusDeviceResetsAttempted, TargetStatistics[TargetID].BusDeviceResetsCompleted, TargetStatistics[TargetID].HostAdapterResetsRequested, TargetStatistics[TargetID].HostAdapterResetsAttempted, TargetStatistics[TargetID].HostAdapterResetsCompleted);
} }
Length += sprintf(&Buffer[Length], "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); seq_printf(m, "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets);
Length += sprintf(&Buffer[Length], "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); seq_printf(m, "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors);
if (Length >= BusLogic_MessageBufferSize) return 0;
BusLogic_Error("Message Buffer length %d exceeds size %d\n", HostAdapter, Length, BusLogic_MessageBufferSize);
if ((Length -= Offset) <= 0)
return 0;
if (Length >= BytesAvailable)
Length = BytesAvailable;
memcpy(ProcBuffer, HostAdapter->MessageBuffer + Offset, Length);
*StartPointer = ProcBuffer;
return Length;
} }
...@@ -3566,7 +3558,8 @@ static int __init BusLogic_ParseDriverOptions(char *OptionsString) ...@@ -3566,7 +3558,8 @@ static int __init BusLogic_ParseDriverOptions(char *OptionsString)
static struct scsi_host_template Bus_Logic_template = { static struct scsi_host_template Bus_Logic_template = {
.module = THIS_MODULE, .module = THIS_MODULE,
.proc_name = "BusLogic", .proc_name = "BusLogic",
.proc_info = BusLogic_ProcDirectoryInfo, .write_info = BusLogic_write_info,
.show_info = BusLogic_show_info,
.name = "BusLogic", .name = "BusLogic",
.info = BusLogic_DriverInfo, .info = BusLogic_DriverInfo,
.queuecommand = BusLogic_QueueCommand, .queuecommand = BusLogic_QueueCommand,
......
...@@ -1321,7 +1321,6 @@ static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T Co ...@@ -1321,7 +1321,6 @@ static inline void BusLogic_IncrementSizeBucket(BusLogic_CommandSizeBuckets_T Co
static const char *BusLogic_DriverInfo(struct Scsi_Host *); static const char *BusLogic_DriverInfo(struct Scsi_Host *);
static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *);
static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *);
static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int);
static int BusLogic_SlaveConfigure(struct scsi_device *); static int BusLogic_SlaveConfigure(struct scsi_device *);
static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *);
static irqreturn_t BusLogic_InterruptHandler(int, void *); static irqreturn_t BusLogic_InterruptHandler(int, void *);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册