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

BusLogic: switch to ->show_info()

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

Al Viro 25daa96f c8ed555a

+38 -46
+38 -45
drivers/scsi/BusLogic.c
··· 3201 3201 BugLogic_ProcDirectoryInfo implements /proc/scsi/BusLogic/<N>. 3202 3202 */ 3203 3203 3204 - static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *shost, char *ProcBuffer, char **StartPointer, off_t Offset, int BytesAvailable, int WriteFlag) 3204 + static int BusLogic_write_info(struct Scsi_Host *shost, char *ProcBuffer, int BytesAvailable) 3205 3205 { 3206 3206 struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; 3207 3207 struct BusLogic_TargetStatistics *TargetStatistics; 3208 - int TargetID, Length; 3209 - char *Buffer; 3210 3208 3211 3209 TargetStatistics = HostAdapter->TargetStatistics; 3212 - if (WriteFlag) { 3213 - HostAdapter->ExternalHostAdapterResets = 0; 3214 - HostAdapter->HostAdapterInternalErrors = 0; 3215 - memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); 3216 - return 0; 3217 - } 3218 - Buffer = HostAdapter->MessageBuffer; 3219 - Length = HostAdapter->MessageBufferLength; 3220 - Length += sprintf(&Buffer[Length], "\n\ 3210 + HostAdapter->ExternalHostAdapterResets = 0; 3211 + HostAdapter->HostAdapterInternalErrors = 0; 3212 + memset(TargetStatistics, 0, BusLogic_MaxTargetDevices * sizeof(struct BusLogic_TargetStatistics)); 3213 + return 0; 3214 + } 3215 + 3216 + static int BusLogic_show_info(struct seq_file *m, struct Scsi_Host *shost) 3217 + { 3218 + struct BusLogic_HostAdapter *HostAdapter = (struct BusLogic_HostAdapter *) shost->hostdata; 3219 + struct BusLogic_TargetStatistics *TargetStatistics; 3220 + int TargetID; 3221 + 3222 + TargetStatistics = HostAdapter->TargetStatistics; 3223 + seq_write(m, HostAdapter->MessageBuffer, HostAdapter->MessageBufferLength); 3224 + seq_printf(m, "\n\ 3221 3225 Current Driver Queue Depth: %d\n\ 3222 3226 Currently Allocated CCBs: %d\n", HostAdapter->DriverQueueDepth, HostAdapter->AllocatedCCBs); 3223 - Length += sprintf(&Buffer[Length], "\n\n\ 3227 + seq_printf(m, "\n\n\ 3224 3228 DATA TRANSFER STATISTICS\n\ 3225 3229 \n\ 3226 3230 Target Tagged Queuing Queue Depth Active Attempted Completed\n\ ··· 3233 3229 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3234 3230 if (!TargetFlags->TargetExists) 3235 3231 continue; 3236 - Length += sprintf(&Buffer[Length], " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) 3232 + seq_printf(m, " %2d %s", TargetID, (TargetFlags->TaggedQueuingSupported ? (TargetFlags->TaggedQueuingActive ? " Active" : (HostAdapter->TaggedQueuingPermitted & (1 << TargetID) 3237 3233 ? " Permitted" : " Disabled")) 3238 3234 : "Not Supported")); 3239 - Length += sprintf(&Buffer[Length], 3235 + seq_printf(m, 3240 3236 " %3d %3u %9u %9u\n", HostAdapter->QueueDepth[TargetID], HostAdapter->ActiveCommands[TargetID], TargetStatistics[TargetID].CommandsAttempted, TargetStatistics[TargetID].CommandsCompleted); 3241 3237 } 3242 - Length += sprintf(&Buffer[Length], "\n\ 3238 + seq_printf(m, "\n\ 3243 3239 Target Read Commands Write Commands Total Bytes Read Total Bytes Written\n\ 3244 3240 ====== ============= ============== =================== ===================\n"); 3245 3241 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3246 3242 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3247 3243 if (!TargetFlags->TargetExists) 3248 3244 continue; 3249 - Length += sprintf(&Buffer[Length], " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); 3245 + seq_printf(m, " %2d %9u %9u", TargetID, TargetStatistics[TargetID].ReadCommands, TargetStatistics[TargetID].WriteCommands); 3250 3246 if (TargetStatistics[TargetID].TotalBytesRead.Billions > 0) 3251 - Length += sprintf(&Buffer[Length], " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); 3247 + seq_printf(m, " %9u%09u", TargetStatistics[TargetID].TotalBytesRead.Billions, TargetStatistics[TargetID].TotalBytesRead.Units); 3252 3248 else 3253 - Length += sprintf(&Buffer[Length], " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); 3249 + seq_printf(m, " %9u", TargetStatistics[TargetID].TotalBytesRead.Units); 3254 3250 if (TargetStatistics[TargetID].TotalBytesWritten.Billions > 0) 3255 - Length += sprintf(&Buffer[Length], " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); 3251 + seq_printf(m, " %9u%09u\n", TargetStatistics[TargetID].TotalBytesWritten.Billions, TargetStatistics[TargetID].TotalBytesWritten.Units); 3256 3252 else 3257 - Length += sprintf(&Buffer[Length], " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); 3253 + seq_printf(m, " %9u\n", TargetStatistics[TargetID].TotalBytesWritten.Units); 3258 3254 } 3259 - Length += sprintf(&Buffer[Length], "\n\ 3255 + seq_printf(m, "\n\ 3260 3256 Target Command 0-1KB 1-2KB 2-4KB 4-8KB 8-16KB\n\ 3261 3257 ====== ======= ========= ========= ========= ========= =========\n"); 3262 3258 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3263 3259 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3264 3260 if (!TargetFlags->TargetExists) 3265 3261 continue; 3266 - Length += 3267 - sprintf(&Buffer[Length], 3262 + seq_printf(m, 3268 3263 " %2d Read %9u %9u %9u %9u %9u\n", TargetID, 3269 3264 TargetStatistics[TargetID].ReadCommandSizeBuckets[0], 3270 3265 TargetStatistics[TargetID].ReadCommandSizeBuckets[1], TargetStatistics[TargetID].ReadCommandSizeBuckets[2], TargetStatistics[TargetID].ReadCommandSizeBuckets[3], TargetStatistics[TargetID].ReadCommandSizeBuckets[4]); 3271 - Length += 3272 - sprintf(&Buffer[Length], 3266 + seq_printf(m, 3273 3267 " %2d Write %9u %9u %9u %9u %9u\n", TargetID, 3274 3268 TargetStatistics[TargetID].WriteCommandSizeBuckets[0], 3275 3269 TargetStatistics[TargetID].WriteCommandSizeBuckets[1], TargetStatistics[TargetID].WriteCommandSizeBuckets[2], TargetStatistics[TargetID].WriteCommandSizeBuckets[3], TargetStatistics[TargetID].WriteCommandSizeBuckets[4]); 3276 3270 } 3277 - Length += sprintf(&Buffer[Length], "\n\ 3271 + seq_printf(m, "\n\ 3278 3272 Target Command 16-32KB 32-64KB 64-128KB 128-256KB 256KB+\n\ 3279 3273 ====== ======= ========= ========= ========= ========= =========\n"); 3280 3274 for (TargetID = 0; TargetID < HostAdapter->MaxTargetDevices; TargetID++) { 3281 3275 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3282 3276 if (!TargetFlags->TargetExists) 3283 3277 continue; 3284 - Length += 3285 - sprintf(&Buffer[Length], 3278 + seq_printf(m, 3286 3279 " %2d Read %9u %9u %9u %9u %9u\n", TargetID, 3287 3280 TargetStatistics[TargetID].ReadCommandSizeBuckets[5], 3288 3281 TargetStatistics[TargetID].ReadCommandSizeBuckets[6], TargetStatistics[TargetID].ReadCommandSizeBuckets[7], TargetStatistics[TargetID].ReadCommandSizeBuckets[8], TargetStatistics[TargetID].ReadCommandSizeBuckets[9]); 3289 - Length += 3290 - sprintf(&Buffer[Length], 3282 + seq_printf(m, 3291 3283 " %2d Write %9u %9u %9u %9u %9u\n", TargetID, 3292 3284 TargetStatistics[TargetID].WriteCommandSizeBuckets[5], 3293 3285 TargetStatistics[TargetID].WriteCommandSizeBuckets[6], TargetStatistics[TargetID].WriteCommandSizeBuckets[7], TargetStatistics[TargetID].WriteCommandSizeBuckets[8], TargetStatistics[TargetID].WriteCommandSizeBuckets[9]); 3294 3286 } 3295 - Length += sprintf(&Buffer[Length], "\n\n\ 3287 + seq_printf(m, "\n\n\ 3296 3288 ERROR RECOVERY STATISTICS\n\ 3297 3289 \n\ 3298 3290 Command Aborts Bus Device Resets Host Adapter Resets\n\ ··· 3299 3299 struct BusLogic_TargetFlags *TargetFlags = &HostAdapter->TargetFlags[TargetID]; 3300 3300 if (!TargetFlags->TargetExists) 3301 3301 continue; 3302 - Length += sprintf(&Buffer[Length], "\ 3302 + seq_printf(m, "\ 3303 3303 %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); 3304 3304 } 3305 - Length += sprintf(&Buffer[Length], "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); 3306 - Length += sprintf(&Buffer[Length], "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); 3307 - if (Length >= BusLogic_MessageBufferSize) 3308 - BusLogic_Error("Message Buffer length %d exceeds size %d\n", HostAdapter, Length, BusLogic_MessageBufferSize); 3309 - if ((Length -= Offset) <= 0) 3310 - return 0; 3311 - if (Length >= BytesAvailable) 3312 - Length = BytesAvailable; 3313 - memcpy(ProcBuffer, HostAdapter->MessageBuffer + Offset, Length); 3314 - *StartPointer = ProcBuffer; 3315 - return Length; 3305 + seq_printf(m, "\nExternal Host Adapter Resets: %d\n", HostAdapter->ExternalHostAdapterResets); 3306 + seq_printf(m, "Host Adapter Internal Errors: %d\n", HostAdapter->HostAdapterInternalErrors); 3307 + return 0; 3316 3308 } 3317 3309 3318 3310 ··· 3558 3566 static struct scsi_host_template Bus_Logic_template = { 3559 3567 .module = THIS_MODULE, 3560 3568 .proc_name = "BusLogic", 3561 - .proc_info = BusLogic_ProcDirectoryInfo, 3569 + .write_info = BusLogic_write_info, 3570 + .show_info = BusLogic_show_info, 3562 3571 .name = "BusLogic", 3563 3572 .info = BusLogic_DriverInfo, 3564 3573 .queuecommand = BusLogic_QueueCommand,
-1
drivers/scsi/BusLogic.h
··· 1321 1321 static const char *BusLogic_DriverInfo(struct Scsi_Host *); 1322 1322 static int BusLogic_QueueCommand(struct Scsi_Host *h, struct scsi_cmnd *); 1323 1323 static int BusLogic_BIOSDiskParameters(struct scsi_device *, struct block_device *, sector_t, int *); 1324 - static int BusLogic_ProcDirectoryInfo(struct Scsi_Host *, char *, char **, off_t, int, int); 1325 1324 static int BusLogic_SlaveConfigure(struct scsi_device *); 1326 1325 static void BusLogic_QueueCompletedCCB(struct BusLogic_CCB *); 1327 1326 static irqreturn_t BusLogic_InterruptHandler(int, void *);