Allocate SENSE buffer only once.

This commit is contained in:
2025-08-22 19:57:09 +01:00
parent 8e2fdd91a6
commit e4f55d3b3c
73 changed files with 1892 additions and 2565 deletions

View File

@@ -319,8 +319,8 @@ public sealed class ErrorLog
}
DecodedSense? decodedSense = Sense.Decode(senseBuffer);
string prettySense = Sense.PrettifySense(senseBuffer);
var hexSense = string.Join(' ', senseBuffer.Select(b => $"{b:X2}"));
string prettySense = Sense.PrettifySense(senseBuffer.ToArray());
string hexSense = string.Join(' ', senseBuffer.Select(b => $"{b:X2}"));
if(decodedSense.HasValue)
{
@@ -369,6 +369,9 @@ public sealed class ErrorLog
_logSw.Flush();
}
public void WriteLine(ulong block, bool osError, int errno, ReadOnlySpan<byte> senseBuffer) =>
WriteLine(block, osError, errno, senseBuffer.ToArray());
/// <summary>Register an SCSI error after trying to read</summary>
/// <param name="block">Starting block</param>
/// <param name="osError"><c>true</c> if operating system returned an error status instead of the device</param>
@@ -385,8 +388,8 @@ public sealed class ErrorLog
}
DecodedSense? decodedSense = Sense.Decode(senseBuffer);
string prettySense = Sense.PrettifySense(senseBuffer);
var hexSense = string.Join(' ', senseBuffer.Select(b => $"{b:X2}"));
string prettySense = Sense.PrettifySense(senseBuffer.ToArray());
string hexSense = string.Join(' ', senseBuffer.Select(b => $"{b:X2}"));
if(decodedSense.HasValue)
{
@@ -488,4 +491,9 @@ public sealed class ErrorLog
throw new NotImplementedException();
}
public void WriteLine(string command, bool osError, int errno, ReadOnlySpan<byte> senseBuffer)
{
WriteLine(command, osError, errno, senseBuffer.ToArray());
}
}