mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Fixed MOST name inconsistencies.
This commit is contained in:
@@ -56,7 +56,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI error returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
internal static int SendScsiCommand64(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer,
|
||||
uint timeout, ccb_flags direction, out double duration, out bool sense)
|
||||
uint timeout, CcbFlags direction, out double duration, out bool sense)
|
||||
{
|
||||
senseBuffer = null;
|
||||
duration = 0;
|
||||
@@ -73,8 +73,8 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
return Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
ccb_scsiio64 csio = (ccb_scsiio64)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio64));
|
||||
csio.ccb_h.func_code = xpt_opcode.XPT_SCSI_IO;
|
||||
CcbScsiio64 csio = (CcbScsiio64)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio64));
|
||||
csio.ccb_h.func_code = XptOpcode.XptScsiIo;
|
||||
csio.ccb_h.flags = direction;
|
||||
csio.ccb_h.xflags = 0;
|
||||
csio.ccb_h.retry_count = 1;
|
||||
@@ -93,9 +93,9 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
cdbPtr = Marshal.AllocHGlobal(cdb.Length);
|
||||
byte[] cdbPtrBytes = BitConverter.GetBytes(cdbPtr.ToInt64());
|
||||
Array.Copy(cdbPtrBytes, 0, csio.cdb_bytes, 0, IntPtr.Size);
|
||||
csio.ccb_h.flags |= ccb_flags.CAM_CDB_POINTER;
|
||||
csio.ccb_h.flags |= CcbFlags.CamCdbPointer;
|
||||
}
|
||||
csio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
|
||||
csio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
|
||||
|
||||
Marshal.Copy(buffer, 0, csio.data_ptr, buffer.Length);
|
||||
Marshal.StructureToPtr(csio, ccbPtr, false);
|
||||
@@ -106,28 +106,28 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
if(error < 0) error = Marshal.GetLastWin32Error();
|
||||
|
||||
csio = (ccb_scsiio64)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio64));
|
||||
csio = (CcbScsiio64)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio64));
|
||||
|
||||
if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
|
||||
(csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
|
||||
if((csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
|
||||
(csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", csio.ccb_h.status, error);
|
||||
sense = true;
|
||||
}
|
||||
|
||||
if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR)
|
||||
if((csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError)
|
||||
{
|
||||
sense = true;
|
||||
senseBuffer = new byte[1];
|
||||
senseBuffer[0] = csio.scsi_status;
|
||||
}
|
||||
|
||||
if((csio.ccb_h.status & cam_status.CAM_AUTOSNS_VALID) != 0)
|
||||
if((csio.ccb_h.status & CamStatus.CamAutosnsValid) != 0)
|
||||
{
|
||||
if(csio.sense_len - csio.sense_resid > 0)
|
||||
{
|
||||
sense = (csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR;
|
||||
sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError;
|
||||
senseBuffer = new byte[csio.sense_len - csio.sense_resid];
|
||||
senseBuffer[0] = csio.sense_data.error_code;
|
||||
Array.Copy(csio.sense_data.sense_buf, 0, senseBuffer, 1, senseBuffer.Length - 1);
|
||||
@@ -138,12 +138,12 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
cdb = new byte[csio.cdb_len];
|
||||
|
||||
Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length);
|
||||
if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER))
|
||||
if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer))
|
||||
Marshal.Copy(new IntPtr(BitConverter.ToInt64(csio.cdb_bytes, 0)), cdb, 0, cdb.Length);
|
||||
else Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length);
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
|
||||
if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.FreeHGlobal(cdbPtr);
|
||||
if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer)) Marshal.FreeHGlobal(cdbPtr);
|
||||
Marshal.FreeHGlobal(csio.data_ptr);
|
||||
cam_freeccb(ccbPtr);
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <param name="duration">Time it took to execute the command in milliseconds</param>
|
||||
/// <param name="sense"><c>True</c> if SCSI error returned non-OK status and <paramref name="senseBuffer"/> contains SCSI sense</param>
|
||||
internal static int SendScsiCommand(IntPtr dev, byte[] cdb, ref byte[] buffer, out byte[] senseBuffer,
|
||||
uint timeout, ccb_flags direction, out double duration, out bool sense)
|
||||
uint timeout, CcbFlags direction, out double duration, out bool sense)
|
||||
{
|
||||
senseBuffer = null;
|
||||
duration = 0;
|
||||
@@ -180,8 +180,8 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
return Marshal.GetLastWin32Error();
|
||||
}
|
||||
|
||||
ccb_scsiio csio = (ccb_scsiio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio));
|
||||
csio.ccb_h.func_code = xpt_opcode.XPT_SCSI_IO;
|
||||
CcbScsiio csio = (CcbScsiio)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio));
|
||||
csio.ccb_h.func_code = XptOpcode.XptScsiIo;
|
||||
csio.ccb_h.flags = direction;
|
||||
csio.ccb_h.xflags = 0;
|
||||
csio.ccb_h.retry_count = 1;
|
||||
@@ -200,9 +200,9 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
cdbPtr = Marshal.AllocHGlobal(cdb.Length);
|
||||
byte[] cdbPtrBytes = BitConverter.GetBytes(cdbPtr.ToInt32());
|
||||
Array.Copy(cdbPtrBytes, 0, csio.cdb_bytes, 0, IntPtr.Size);
|
||||
csio.ccb_h.flags |= ccb_flags.CAM_CDB_POINTER;
|
||||
csio.ccb_h.flags |= CcbFlags.CamCdbPointer;
|
||||
}
|
||||
csio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
|
||||
csio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
|
||||
|
||||
Marshal.Copy(buffer, 0, csio.data_ptr, buffer.Length);
|
||||
Marshal.StructureToPtr(csio, ccbPtr, false);
|
||||
@@ -213,28 +213,28 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
if(error < 0) error = Marshal.GetLastWin32Error();
|
||||
|
||||
csio = (ccb_scsiio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_scsiio));
|
||||
csio = (CcbScsiio)Marshal.PtrToStructure(ccbPtr, typeof(CcbScsiio));
|
||||
|
||||
if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
|
||||
(csio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
|
||||
if((csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
|
||||
(csio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", csio.ccb_h.status, error);
|
||||
sense = true;
|
||||
}
|
||||
|
||||
if((csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR)
|
||||
if((csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError)
|
||||
{
|
||||
sense = true;
|
||||
senseBuffer = new byte[1];
|
||||
senseBuffer[0] = csio.scsi_status;
|
||||
}
|
||||
|
||||
if((csio.ccb_h.status & cam_status.CAM_AUTOSNS_VALID) != 0)
|
||||
if((csio.ccb_h.status & CamStatus.CamAutosnsValid) != 0)
|
||||
{
|
||||
if(csio.sense_len - csio.sense_resid > 0)
|
||||
{
|
||||
sense = (csio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_SCSI_STATUS_ERROR;
|
||||
sense = (csio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamScsiStatusError;
|
||||
senseBuffer = new byte[csio.sense_len - csio.sense_resid];
|
||||
senseBuffer[0] = csio.sense_data.error_code;
|
||||
Array.Copy(csio.sense_data.sense_buf, 0, senseBuffer, 1, senseBuffer.Length - 1);
|
||||
@@ -245,19 +245,19 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
cdb = new byte[csio.cdb_len];
|
||||
|
||||
Marshal.Copy(csio.data_ptr, buffer, 0, buffer.Length);
|
||||
if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER))
|
||||
if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer))
|
||||
Marshal.Copy(new IntPtr(BitConverter.ToInt32(csio.cdb_bytes, 0)), cdb, 0, cdb.Length);
|
||||
else Array.Copy(csio.cdb_bytes, 0, cdb, 0, cdb.Length);
|
||||
duration = (end - start).TotalMilliseconds;
|
||||
|
||||
if(csio.ccb_h.flags.HasFlag(ccb_flags.CAM_CDB_POINTER)) Marshal.FreeHGlobal(cdbPtr);
|
||||
if(csio.ccb_h.flags.HasFlag(CcbFlags.CamCdbPointer)) Marshal.FreeHGlobal(cdbPtr);
|
||||
Marshal.FreeHGlobal(csio.data_ptr);
|
||||
cam_freeccb(ccbPtr);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static ccb_flags AtaProtocolToCamFlags(AtaProtocol protocol)
|
||||
static CcbFlags AtaProtocolToCamFlags(AtaProtocol protocol)
|
||||
{
|
||||
switch(protocol)
|
||||
{
|
||||
@@ -266,12 +266,12 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
case AtaProtocol.HardReset:
|
||||
case AtaProtocol.NonData:
|
||||
case AtaProtocol.SoftReset:
|
||||
case AtaProtocol.ReturnResponse: return ccb_flags.CAM_DIR_NONE;
|
||||
case AtaProtocol.ReturnResponse: return CcbFlags.CamDirNone;
|
||||
case AtaProtocol.PioIn:
|
||||
case AtaProtocol.UDmaIn: return ccb_flags.CAM_DIR_IN;
|
||||
case AtaProtocol.UDmaIn: return CcbFlags.CamDirIn;
|
||||
case AtaProtocol.PioOut:
|
||||
case AtaProtocol.UDmaOut: return ccb_flags.CAM_DIR_OUT;
|
||||
default: return ccb_flags.CAM_DIR_NONE;
|
||||
case AtaProtocol.UDmaOut: return CcbFlags.CamDirOut;
|
||||
default: return CcbFlags.CamDirNone;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,8 +287,8 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
IntPtr ccbPtr = cam_getccb(dev);
|
||||
|
||||
ccb_ataio ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
|
||||
ataio.ccb_h.func_code = xpt_opcode.XPT_ATA_IO;
|
||||
CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
|
||||
ataio.ccb_h.func_code = XptOpcode.XptAtaIo;
|
||||
ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol);
|
||||
ataio.ccb_h.xflags = 0;
|
||||
ataio.ccb_h.retry_count = 1;
|
||||
@@ -296,7 +296,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
ataio.ccb_h.timeout = timeout;
|
||||
ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length);
|
||||
ataio.dxfer_len = (uint)buffer.Length;
|
||||
ataio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
|
||||
ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
|
||||
ataio.cmd.flags = CamAtaIoFlags.NeedResult;
|
||||
switch(protocol)
|
||||
{
|
||||
@@ -304,10 +304,10 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
case AtaProtocol.DmaQueued:
|
||||
case AtaProtocol.UDmaIn:
|
||||
case AtaProtocol.UDmaOut:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.DMA;
|
||||
ataio.cmd.flags |= CamAtaIoFlags.Dma;
|
||||
break;
|
||||
case AtaProtocol.FPDma:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.FPDMA;
|
||||
case AtaProtocol.FpDma:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.Fpdma;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -328,17 +328,17 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
if(error < 0) error = Marshal.GetLastWin32Error();
|
||||
|
||||
ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
|
||||
ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
|
||||
|
||||
if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
|
||||
(ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
|
||||
if((ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
|
||||
(ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", ataio.ccb_h.status, error);
|
||||
sense = true;
|
||||
}
|
||||
|
||||
if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_ATA_STATUS_ERROR) sense = true;
|
||||
if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true;
|
||||
|
||||
errorRegisters.cylinderHigh = ataio.res.lba_high;
|
||||
errorRegisters.cylinderLow = ataio.res.lba_mid;
|
||||
@@ -373,8 +373,8 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
IntPtr ccbPtr = cam_getccb(dev);
|
||||
|
||||
ccb_ataio ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
|
||||
ataio.ccb_h.func_code = xpt_opcode.XPT_ATA_IO;
|
||||
CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
|
||||
ataio.ccb_h.func_code = XptOpcode.XptAtaIo;
|
||||
ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol);
|
||||
ataio.ccb_h.xflags = 0;
|
||||
ataio.ccb_h.retry_count = 1;
|
||||
@@ -382,7 +382,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
ataio.ccb_h.timeout = timeout;
|
||||
ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length);
|
||||
ataio.dxfer_len = (uint)buffer.Length;
|
||||
ataio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
|
||||
ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
|
||||
ataio.cmd.flags = CamAtaIoFlags.NeedResult;
|
||||
switch(protocol)
|
||||
{
|
||||
@@ -390,10 +390,10 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
case AtaProtocol.DmaQueued:
|
||||
case AtaProtocol.UDmaIn:
|
||||
case AtaProtocol.UDmaOut:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.DMA;
|
||||
ataio.cmd.flags |= CamAtaIoFlags.Dma;
|
||||
break;
|
||||
case AtaProtocol.FPDma:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.FPDMA;
|
||||
case AtaProtocol.FpDma:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.Fpdma;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -414,17 +414,17 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
if(error < 0) error = Marshal.GetLastWin32Error();
|
||||
|
||||
ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
|
||||
ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
|
||||
|
||||
if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
|
||||
(ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
|
||||
if((ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
|
||||
(ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", ataio.ccb_h.status, error);
|
||||
sense = true;
|
||||
}
|
||||
|
||||
if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_ATA_STATUS_ERROR) sense = true;
|
||||
if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true;
|
||||
|
||||
errorRegisters.lbaHigh = ataio.res.lba_high;
|
||||
errorRegisters.lbaMid = ataio.res.lba_mid;
|
||||
@@ -463,8 +463,8 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
IntPtr ccbPtr = cam_getccb(dev);
|
||||
|
||||
ccb_ataio ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
|
||||
ataio.ccb_h.func_code = xpt_opcode.XPT_ATA_IO;
|
||||
CcbAtaio ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
|
||||
ataio.ccb_h.func_code = XptOpcode.XptAtaIo;
|
||||
ataio.ccb_h.flags = AtaProtocolToCamFlags(protocol);
|
||||
ataio.ccb_h.xflags = 0;
|
||||
ataio.ccb_h.retry_count = 1;
|
||||
@@ -472,7 +472,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
ataio.ccb_h.timeout = timeout;
|
||||
ataio.data_ptr = Marshal.AllocHGlobal(buffer.Length);
|
||||
ataio.dxfer_len = (uint)buffer.Length;
|
||||
ataio.ccb_h.flags |= ccb_flags.CAM_DEV_QFRZDIS;
|
||||
ataio.ccb_h.flags |= CcbFlags.CamDevQfrzdis;
|
||||
ataio.cmd.flags = CamAtaIoFlags.NeedResult | CamAtaIoFlags.ExtendedCommand;
|
||||
switch(protocol)
|
||||
{
|
||||
@@ -480,10 +480,10 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
case AtaProtocol.DmaQueued:
|
||||
case AtaProtocol.UDmaIn:
|
||||
case AtaProtocol.UDmaOut:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.DMA;
|
||||
ataio.cmd.flags |= CamAtaIoFlags.Dma;
|
||||
break;
|
||||
case AtaProtocol.FPDma:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.FPDMA;
|
||||
case AtaProtocol.FpDma:
|
||||
ataio.cmd.flags |= CamAtaIoFlags.Fpdma;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -509,17 +509,17 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
if(error < 0) error = Marshal.GetLastWin32Error();
|
||||
|
||||
ataio = (ccb_ataio)Marshal.PtrToStructure(ccbPtr, typeof(ccb_ataio));
|
||||
ataio = (CcbAtaio)Marshal.PtrToStructure(ccbPtr, typeof(CcbAtaio));
|
||||
|
||||
if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_REQ_CMP &&
|
||||
(ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) != cam_status.CAM_SCSI_STATUS_ERROR)
|
||||
if((ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamReqCmp &&
|
||||
(ataio.ccb_h.status & CamStatus.CamStatusMask) != CamStatus.CamScsiStatusError)
|
||||
{
|
||||
error = Marshal.GetLastWin32Error();
|
||||
DicConsole.DebugWriteLine("FreeBSD devices", "CAM status {0} error {1}", ataio.ccb_h.status, error);
|
||||
sense = true;
|
||||
}
|
||||
|
||||
if((ataio.ccb_h.status & cam_status.CAM_STATUS_MASK) == cam_status.CAM_ATA_STATUS_ERROR) sense = true;
|
||||
if((ataio.ccb_h.status & CamStatus.CamStatusMask) == CamStatus.CamAtaStatusError) sense = true;
|
||||
|
||||
errorRegisters.sectorCount = (ushort)((ataio.res.sector_count_exp << 8) + ataio.res.sector_count);
|
||||
errorRegisters.lbaLow = (ushort)((ataio.res.lba_low_exp << 8) + ataio.res.lba_low);
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// O_NOCTTY
|
||||
///</summary>
|
||||
NoControlTTY = 0x00008000,
|
||||
NoControlTty = 0x00008000,
|
||||
/// <summary>
|
||||
/// O_DIRECT
|
||||
///</summary>
|
||||
@@ -109,7 +109,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// O_TTY_INIT
|
||||
///</summary>
|
||||
InitializeTTY = 0x00080000,
|
||||
InitializeTty = 0x00080000,
|
||||
/// <summary>
|
||||
/// O_CLOEXEC
|
||||
///</summary>
|
||||
@@ -126,7 +126,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// FPDMA command
|
||||
///</summary>
|
||||
FPDMA = 0x02,
|
||||
Fpdma = 0x02,
|
||||
/// <summary>
|
||||
/// Control, not a command
|
||||
///</summary>
|
||||
@@ -138,595 +138,595 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// DMA command
|
||||
///</summary>
|
||||
DMA = 0x10
|
||||
Dma = 0x10
|
||||
}
|
||||
|
||||
/// <summary>XPT Opcodes for xpt_action</summary>
|
||||
[Flags]
|
||||
enum xpt_opcode
|
||||
enum XptOpcode
|
||||
{
|
||||
// Function code flags are bits greater than 0xff
|
||||
|
||||
/// <summary>Non-immediate function code</summary>
|
||||
XPT_FC_QUEUED = 0x100,
|
||||
XPT_FC_USER_CCB = 0x200,
|
||||
XptFcQueued = 0x100,
|
||||
XptFcUserCcb = 0x200,
|
||||
/// <summary>Only for the transport layer device</summary>
|
||||
XPT_FC_XPT_ONLY = 0x400,
|
||||
XptFcXptOnly = 0x400,
|
||||
/// <summary>Passes through the device queues</summary>
|
||||
XPT_FC_DEV_QUEUED = 0x800 | XPT_FC_QUEUED,
|
||||
XptFcDevQueued = 0x800 | XptFcQueued,
|
||||
|
||||
// Common function commands: 0x00->0x0F
|
||||
|
||||
/// <summary>Execute Nothing</summary>
|
||||
XPT_NOOP = 0x00,
|
||||
XptNoop = 0x00,
|
||||
/// <summary>Execute the requested I/O operation</summary>
|
||||
XPT_SCSI_IO = 0x01 | XPT_FC_DEV_QUEUED,
|
||||
XptScsiIo = 0x01 | XptFcDevQueued,
|
||||
/// <summary>Get type information for specified device</summary>
|
||||
XPT_GDEV_TYPE = 0x02,
|
||||
XptGdevType = 0x02,
|
||||
/// <summary>Get a list of peripheral devices</summary>
|
||||
XPT_GDEVLIST = 0x03,
|
||||
XptGdevlist = 0x03,
|
||||
/// <summary>Path routing inquiry</summary>
|
||||
XPT_PATH_INQ = 0x04,
|
||||
XptPathInq = 0x04,
|
||||
/// <summary>Release a frozen device queue</summary>
|
||||
XPT_REL_SIMQ = 0x05,
|
||||
XptRelSimq = 0x05,
|
||||
/// <summary>Set Asynchronous Callback Parameters</summary>
|
||||
XPT_SASYNC_CB = 0x06,
|
||||
XptSasyncCb = 0x06,
|
||||
/// <summary>Set device type information</summary>
|
||||
XPT_SDEV_TYPE = 0x07,
|
||||
XptSdevType = 0x07,
|
||||
/// <summary>(Re)Scan the SCSI Bus</summary>
|
||||
XPT_SCAN_BUS = 0x08 | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
|
||||
XptScanBus = 0x08 | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
|
||||
/// <summary>Get EDT entries matching the given pattern</summary>
|
||||
XPT_DEV_MATCH = 0x09 | XPT_FC_XPT_ONLY,
|
||||
XptDevMatch = 0x09 | XptFcXptOnly,
|
||||
/// <summary>Turn on debugging for a bus, target or lun</summary>
|
||||
XPT_DEBUG = 0x0a,
|
||||
XptDebug = 0x0a,
|
||||
/// <summary>Path statistics (error counts, etc.)</summary>
|
||||
XPT_PATH_STATS = 0x0b,
|
||||
XptPathStats = 0x0b,
|
||||
/// <summary>Device statistics (error counts, etc.)</summary>
|
||||
XPT_GDEV_STATS = 0x0c,
|
||||
XptGdevStats = 0x0c,
|
||||
/// <summary>Get/Set Device advanced information</summary>
|
||||
XPT_DEV_ADVINFO = 0x0e,
|
||||
XptDevAdvinfo = 0x0e,
|
||||
/// <summary>Asynchronous event</summary>
|
||||
XPT_ASYNC = 0x0f | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
|
||||
XptAsync = 0x0f | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
|
||||
|
||||
/// <summary>SCSI Control Functions: 0x10->0x1F</summary>
|
||||
/// <summary>Abort the specified CCB</summary>
|
||||
XPT_ABORT = 0x10,
|
||||
XptAbort = 0x10,
|
||||
/// <summary>Reset the specified SCSI bus</summary>
|
||||
XPT_RESET_BUS = 0x11 | XPT_FC_XPT_ONLY,
|
||||
XptResetBus = 0x11 | XptFcXptOnly,
|
||||
/// <summary>Bus Device Reset the specified SCSI device</summary>
|
||||
XPT_RESET_DEV = 0x12 | XPT_FC_DEV_QUEUED,
|
||||
XptResetDev = 0x12 | XptFcDevQueued,
|
||||
/// <summary>Terminate the I/O process</summary>
|
||||
XPT_TERM_IO = 0x13,
|
||||
XptTermIo = 0x13,
|
||||
/// <summary>Scan Logical Unit</summary>
|
||||
XPT_SCAN_LUN = 0x14 | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
|
||||
XptScanLun = 0x14 | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
|
||||
/// <summary>Get default/user transfer settings for the target</summary>
|
||||
XPT_GET_TRAN_SETTINGS = 0x15,
|
||||
XptGetTranSettings = 0x15,
|
||||
/// <summary>Set transfer rate/width negotiation settings</summary>
|
||||
XPT_SET_TRAN_SETTINGS = 0x16,
|
||||
XptSetTranSettings = 0x16,
|
||||
/// <summary>Calculate the geometry parameters for a device give the sector size and volume size.</summary>
|
||||
XPT_CALC_GEOMETRY = 0x17,
|
||||
XptCalcGeometry = 0x17,
|
||||
/// <summary>Execute the requested ATA I/O operation</summary>
|
||||
XPT_ATA_IO = 0x18 | XPT_FC_DEV_QUEUED,
|
||||
XptAtaIo = 0x18 | XptFcDevQueued,
|
||||
|
||||
/// <summary>Compat only</summary>
|
||||
XPT_GET_SIM_KNOB_OLD = 0x18,
|
||||
XptGetSimKnobOld = 0x18,
|
||||
|
||||
/// <summary>Set SIM specific knob values.</summary>
|
||||
XPT_SET_SIM_KNOB = 0x19,
|
||||
XptSetSimKnob = 0x19,
|
||||
/// <summary>Get SIM specific knob values.</summary>
|
||||
XPT_GET_SIM_KNOB = 0x1a,
|
||||
XptGetSimKnob = 0x1a,
|
||||
/// <summary>Serial Management Protocol</summary>
|
||||
XPT_SMP_IO = 0x1b | XPT_FC_DEV_QUEUED,
|
||||
XptSmpIo = 0x1b | XptFcDevQueued,
|
||||
/// <summary>Scan Target</summary>
|
||||
XPT_SCAN_TGT = 0x1E | XPT_FC_QUEUED | XPT_FC_USER_CCB | XPT_FC_XPT_ONLY,
|
||||
XptScanTgt = 0x1E | XptFcQueued | XptFcUserCcb | XptFcXptOnly,
|
||||
|
||||
// HBA engine commands 0x20->0x2F
|
||||
|
||||
/// <summary>HBA engine feature inquiry</summary>
|
||||
XPT_ENG_INQ = 0x20 | XPT_FC_XPT_ONLY,
|
||||
XptEngInq = 0x20 | XptFcXptOnly,
|
||||
/// <summary>HBA execute engine request</summary>
|
||||
XPT_ENG_EXEC = 0x21 | XPT_FC_DEV_QUEUED,
|
||||
XptEngExec = 0x21 | XptFcDevQueued,
|
||||
|
||||
// Target mode commands: 0x30->0x3F
|
||||
|
||||
/// <summary>Enable LUN as a target</summary>
|
||||
XPT_EN_LUN = 0x30,
|
||||
XptEnLun = 0x30,
|
||||
/// <summary>Execute target I/O request</summary>
|
||||
XPT_TARGET_IO = 0x31 | XPT_FC_DEV_QUEUED,
|
||||
XptTargetIo = 0x31 | XptFcDevQueued,
|
||||
/// <summary>Accept Host Target Mode CDB</summary>
|
||||
XPT_ACCEPT_TARGET_IO = 0x32 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
|
||||
XptAcceptTargetIo = 0x32 | XptFcQueued | XptFcUserCcb,
|
||||
/// <summary>Continue Host Target I/O Connection</summary>
|
||||
XPT_CONT_TARGET_IO = 0x33 | XPT_FC_DEV_QUEUED,
|
||||
XptContTargetIo = 0x33 | XptFcDevQueued,
|
||||
/// <summary>Notify Host Target driver of event (obsolete)</summary>
|
||||
XPT_IMMED_NOTIFY = 0x34 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
|
||||
XptImmedNotify = 0x34 | XptFcQueued | XptFcUserCcb,
|
||||
/// <summary>Acknowledgement of event (obsolete)</summary>
|
||||
XPT_NOTIFY_ACK = 0x35,
|
||||
XptNotifyAck = 0x35,
|
||||
/// <summary>Notify Host Target driver of event</summary>
|
||||
XPT_IMMEDIATE_NOTIFY = 0x36 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
|
||||
XptImmediateNotify = 0x36 | XptFcQueued | XptFcUserCcb,
|
||||
/// <summary>Acknowledgement of event</summary>
|
||||
XPT_NOTIFY_ACKNOWLEDGE = 0x37 | XPT_FC_QUEUED | XPT_FC_USER_CCB,
|
||||
XptNotifyAcknowledge = 0x37 | XptFcQueued | XptFcUserCcb,
|
||||
|
||||
/// <summary>Vendor Unique codes: 0x80->0x8F</summary>
|
||||
XPT_VUNIQUE = 0x80
|
||||
XptVunique = 0x80
|
||||
}
|
||||
|
||||
enum ccb_dev_match_status
|
||||
enum CcbDevMatchStatus
|
||||
{
|
||||
CAM_DEV_MATCH_LAST,
|
||||
CAM_DEV_MATCH_MORE,
|
||||
CAM_DEV_MATCH_LIST_CHANGED,
|
||||
CAM_DEV_MATCH_SIZE_ERROR,
|
||||
CAM_DEV_MATCH_ERROR
|
||||
CamDevMatchLast,
|
||||
CamDevMatchMore,
|
||||
CamDevMatchListChanged,
|
||||
CamDevMatchSizeError,
|
||||
CamDevMatchError
|
||||
}
|
||||
|
||||
enum dev_match_type
|
||||
enum DevMatchType
|
||||
{
|
||||
DEV_MATCH_PERIPH = 0,
|
||||
DEV_MATCH_DEVICE,
|
||||
DEV_MATCH_BUS
|
||||
DevMatchPeriph = 0,
|
||||
DevMatchDevice,
|
||||
DevMatchBus
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum periph_pattern_flags
|
||||
enum PeriphPatternFlags
|
||||
{
|
||||
PERIPH_MATCH_NONE = 0x000,
|
||||
PERIPH_MATCH_PATH = 0x001,
|
||||
PERIPH_MATCH_TARGET = 0x002,
|
||||
PERIPH_MATCH_LUN = 0x004,
|
||||
PERIPH_MATCH_NAME = 0x008,
|
||||
PERIPH_MATCH_UNIT = 0x010,
|
||||
PeriphMatchNone = 0x000,
|
||||
PeriphMatchPath = 0x001,
|
||||
PeriphMatchTarget = 0x002,
|
||||
PeriphMatchLun = 0x004,
|
||||
PeriphMatchName = 0x008,
|
||||
PeriphMatchUnit = 0x010,
|
||||
// PERIPH_MATCH_ANY = 0x01f
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum dev_pattern_flags
|
||||
enum DevPatternFlags
|
||||
{
|
||||
DEV_MATCH_NONE = 0x000,
|
||||
DEV_MATCH_PATH = 0x001,
|
||||
DEV_MATCH_TARGET = 0x002,
|
||||
DEV_MATCH_LUN = 0x004,
|
||||
DEV_MATCH_INQUIRY = 0x008,
|
||||
DEV_MATCH_DEVID = 0x010,
|
||||
DevMatchNone = 0x000,
|
||||
DevMatchPath = 0x001,
|
||||
DevMatchTarget = 0x002,
|
||||
DevMatchLun = 0x004,
|
||||
DevMatchInquiry = 0x008,
|
||||
DevMatchDevid = 0x010,
|
||||
// DEV_MATCH_ANY = 0x00f
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum bus_pattern_flags
|
||||
enum BusPatternFlags
|
||||
{
|
||||
BUS_MATCH_NONE = 0x000,
|
||||
BUS_MATCH_PATH = 0x001,
|
||||
BUS_MATCH_NAME = 0x002,
|
||||
BUS_MATCH_UNIT = 0x004,
|
||||
BUS_MATCH_BUS_ID = 0x008,
|
||||
BusMatchNone = 0x000,
|
||||
BusMatchPath = 0x001,
|
||||
BusMatchName = 0x002,
|
||||
BusMatchUnit = 0x004,
|
||||
BusMatchBusId = 0x008,
|
||||
// BUS_MATCH_ANY = 0x00f
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum dev_result_flags
|
||||
enum DevResultFlags
|
||||
{
|
||||
DEV_RESULT_NOFLAG = 0x00,
|
||||
DEV_RESULT_UNCONFIGURED = 0x01
|
||||
DevResultNoflag = 0x00,
|
||||
DevResultUnconfigured = 0x01
|
||||
}
|
||||
|
||||
enum cam_proto
|
||||
enum CamProto
|
||||
{
|
||||
PROTO_UNKNOWN,
|
||||
PROTO_UNSPECIFIED,
|
||||
ProtoUnknown,
|
||||
ProtoUnspecified,
|
||||
|
||||
/// <summary>
|
||||
/// Small Computer System Interface
|
||||
/// </summary>
|
||||
PROTO_SCSI,
|
||||
ProtoScsi,
|
||||
|
||||
/// <summary>
|
||||
/// AT Attachment
|
||||
/// </summary>
|
||||
PROTO_ATA,
|
||||
ProtoAta,
|
||||
|
||||
/// <summary>
|
||||
/// AT Attachment Packetized Interface
|
||||
/// </summary>
|
||||
PROTO_ATAPI,
|
||||
ProtoAtapi,
|
||||
|
||||
/// <summary>
|
||||
/// SATA Port Multiplier
|
||||
/// </summary>
|
||||
PROTO_SATAPM,
|
||||
ProtoSatapm,
|
||||
|
||||
/// <summary>
|
||||
/// SATA Enclosure Management Bridge
|
||||
/// </summary>
|
||||
PROTO_SEMB,
|
||||
ProtoSemb,
|
||||
|
||||
/// <summary>
|
||||
/// NVMe
|
||||
/// </summary>
|
||||
PROTO_NVME,
|
||||
ProtoNvme,
|
||||
|
||||
/// <summary>
|
||||
/// MMC, SD, SDIO
|
||||
/// </summary>
|
||||
PROTO_MMCSD,
|
||||
ProtoMmcsd,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum mmc_card_features
|
||||
enum MmcCardFeatures
|
||||
{
|
||||
CARD_FEATURE_MEMORY = 0x1,
|
||||
CARD_FEATURE_SDHC = 0x1 << 1,
|
||||
CARD_FEATURE_SDIO = 0x1 << 2,
|
||||
CARD_FEATURE_SD20 = 0x1 << 3,
|
||||
CARD_FEATURE_MMC = 0x1 << 4,
|
||||
CARD_FEATURE_18V = 0x1 << 5,
|
||||
CardFeatureMemory = 0x1,
|
||||
CardFeatureSdhc = 0x1 << 1,
|
||||
CardFeatureSdio = 0x1 << 2,
|
||||
CardFeatureSd20 = 0x1 << 3,
|
||||
CardFeatureMmc = 0x1 << 4,
|
||||
CardFeature18V = 0x1 << 5,
|
||||
}
|
||||
|
||||
enum cam_generations : uint
|
||||
enum CamGenerations : uint
|
||||
{
|
||||
CAM_BUS_GENERATION = 0x00,
|
||||
CAM_TARGET_GENERATION = 0x01,
|
||||
CAM_DEV_GENERATION = 0x02,
|
||||
CAM_PERIPH_GENERATION = 0x03,
|
||||
CamBusGeneration = 0x00,
|
||||
CamTargetGeneration = 0x01,
|
||||
CamDevGeneration = 0x02,
|
||||
CamPeriphGeneration = 0x03,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum dev_pos_type
|
||||
enum DevPosType
|
||||
{
|
||||
CAM_DEV_POS_NONE = 0x000,
|
||||
CAM_DEV_POS_BUS = 0x001,
|
||||
CAM_DEV_POS_TARGET = 0x002,
|
||||
CAM_DEV_POS_DEVICE = 0x004,
|
||||
CAM_DEV_POS_PERIPH = 0x008,
|
||||
CAM_DEV_POS_PDPTR = 0x010,
|
||||
CamDevPosNone = 0x000,
|
||||
CamDevPosBus = 0x001,
|
||||
CamDevPosTarget = 0x002,
|
||||
CamDevPosDevice = 0x004,
|
||||
CamDevPosPeriph = 0x008,
|
||||
CamDevPosPdptr = 0x010,
|
||||
// CAM_DEV_POS_TYPEMASK = 0xf00,
|
||||
CAM_DEV_POS_EDT = 0x100,
|
||||
CAM_DEV_POS_PDRV = 0x200
|
||||
CamDevPosEdt = 0x100,
|
||||
CamDevPosPdrv = 0x200
|
||||
}
|
||||
|
||||
enum FreebsdIoctl : uint
|
||||
{
|
||||
CAMIOCOMMAND = 0xC4D81802,
|
||||
Camiocommand = 0xC4D81802,
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum ccb_flags : uint
|
||||
enum CcbFlags : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// The CDB field is a pointer
|
||||
/// </summary>
|
||||
CAM_CDB_POINTER = 0x00000001,
|
||||
CamCdbPointer = 0x00000001,
|
||||
/// <summary>
|
||||
/// SIM queue actions are enabled
|
||||
/// </summary>
|
||||
CAM_QUEUE_ENABLE = 0x00000002,
|
||||
CamQueueEnable = 0x00000002,
|
||||
/// <summary>
|
||||
/// CCB contains a linked CDB
|
||||
/// </summary>
|
||||
CAM_CDB_LINKED = 0x00000004,
|
||||
CamCdbLinked = 0x00000004,
|
||||
/// <summary>
|
||||
/// Perform transport negotiation with this command.
|
||||
/// </summary>
|
||||
CAM_NEGOTIATE = 0x00000008,
|
||||
CamNegotiate = 0x00000008,
|
||||
/// <summary>
|
||||
/// Data type with physical addrs
|
||||
/// </summary>
|
||||
CAM_DATA_ISPHYS = 0x00000010,
|
||||
CamDataIsphys = 0x00000010,
|
||||
/// <summary>
|
||||
/// Disable autosense feature
|
||||
/// </summary>
|
||||
CAM_DIS_AUTOSENSE = 0x00000020,
|
||||
CamDisAutosense = 0x00000020,
|
||||
/// <summary>
|
||||
/// Data direction (00:IN/OUT)
|
||||
/// </summary>
|
||||
CAM_DIR_BOTH = 0x00000000,
|
||||
CamDirBoth = 0x00000000,
|
||||
/// <summary>
|
||||
/// Data direction (01:DATA IN)
|
||||
/// </summary>
|
||||
CAM_DIR_IN = 0x00000040,
|
||||
CamDirIn = 0x00000040,
|
||||
/// <summary>
|
||||
/// Data direction (10:DATA OUT)
|
||||
/// </summary>
|
||||
CAM_DIR_OUT = 0x00000080,
|
||||
CamDirOut = 0x00000080,
|
||||
/// <summary>
|
||||
/// Data direction (11:no data)
|
||||
/// </summary>
|
||||
CAM_DIR_NONE = 0x000000C0,
|
||||
CamDirNone = 0x000000C0,
|
||||
/// <summary>
|
||||
/// Data type (000:Virtual)
|
||||
/// </summary>
|
||||
CAM_DATA_VADDR = 0x00000000,
|
||||
CamDataVaddr = 0x00000000,
|
||||
/// <summary>
|
||||
/// Data type (001:Physical)
|
||||
/// </summary>
|
||||
CAM_DATA_PADDR = 0x00000010,
|
||||
CamDataPaddr = 0x00000010,
|
||||
/// <summary>
|
||||
/// Data type (010:sglist)
|
||||
/// </summary>
|
||||
CAM_DATA_SG = 0x00040000,
|
||||
CamDataSg = 0x00040000,
|
||||
/// <summary>
|
||||
/// Data type (011:sglist phys)
|
||||
/// </summary>
|
||||
CAM_DATA_SG_PADDR = 0x00040010,
|
||||
CamDataSgPaddr = 0x00040010,
|
||||
/// <summary>
|
||||
/// Data type (100:bio)
|
||||
/// </summary>
|
||||
CAM_DATA_BIO = 0x00200000,
|
||||
CamDataBio = 0x00200000,
|
||||
/// <summary>
|
||||
/// Use Soft reset alternative
|
||||
/// </summary>
|
||||
CAM_SOFT_RST_OP = 0x00000100,
|
||||
CamSoftRstOp = 0x00000100,
|
||||
/// <summary>
|
||||
/// Flush resid bytes on complete
|
||||
/// </summary>
|
||||
CAM_ENG_SYNC = 0x00000200,
|
||||
CamEngSync = 0x00000200,
|
||||
/// <summary>
|
||||
/// Disable DEV Q freezing
|
||||
/// </summary>
|
||||
CAM_DEV_QFRZDIS = 0x00000400,
|
||||
CamDevQfrzdis = 0x00000400,
|
||||
/// <summary>
|
||||
/// Freeze DEV Q on execution
|
||||
/// </summary>
|
||||
CAM_DEV_QFREEZE = 0x00000800,
|
||||
CamDevQfreeze = 0x00000800,
|
||||
/// <summary>
|
||||
/// Command takes a lot of power
|
||||
/// </summary>
|
||||
CAM_HIGH_POWER = 0x00001000,
|
||||
CamHighPower = 0x00001000,
|
||||
/// <summary>
|
||||
/// Sense data is a pointer
|
||||
/// </summary>
|
||||
CAM_SENSE_PTR = 0x00002000,
|
||||
CamSensePtr = 0x00002000,
|
||||
/// <summary>
|
||||
/// Sense pointer is physical addr
|
||||
/// </summary>
|
||||
CAM_SENSE_PHYS = 0x00004000,
|
||||
CamSensePhys = 0x00004000,
|
||||
/// <summary>
|
||||
/// Use the tag action in this ccb
|
||||
/// </summary>
|
||||
CAM_TAG_ACTION_VALID = 0x00008000,
|
||||
CamTagActionValid = 0x00008000,
|
||||
/// <summary>
|
||||
/// Pass driver does err. recovery
|
||||
/// </summary>
|
||||
CAM_PASS_ERR_RECOVER = 0x00010000,
|
||||
CamPassErrRecover = 0x00010000,
|
||||
/// <summary>
|
||||
/// Disable disconnect
|
||||
/// </summary>
|
||||
CAM_DIS_DISCONNECT = 0x00020000,
|
||||
CamDisDisconnect = 0x00020000,
|
||||
/// <summary>
|
||||
/// Message buffer ptr is physical
|
||||
/// </summary>
|
||||
CAM_MSG_BUF_PHYS = 0x00080000,
|
||||
CamMsgBufPhys = 0x00080000,
|
||||
/// <summary>
|
||||
/// Autosense data ptr is physical
|
||||
/// </summary>
|
||||
CAM_SNS_BUF_PHYS = 0x00100000,
|
||||
CamSnsBufPhys = 0x00100000,
|
||||
/// <summary>
|
||||
/// CDB poiner is physical
|
||||
/// </summary>
|
||||
CAM_CDB_PHYS = 0x00400000,
|
||||
CamCdbPhys = 0x00400000,
|
||||
/// <summary>
|
||||
/// SG list is for the HBA engine
|
||||
/// </summary>
|
||||
CAM_ENG_SGLIST = 0x00800000,
|
||||
CamEngSglist = 0x00800000,
|
||||
|
||||
/* Phase cognizant mode flags */
|
||||
/// <summary>
|
||||
/// Disable autosave/restore ptrs
|
||||
/// </summary>
|
||||
CAM_DIS_AUTOSRP = 0x01000000,
|
||||
CamDisAutosrp = 0x01000000,
|
||||
/// <summary>
|
||||
/// Disable auto disconnect
|
||||
/// </summary>
|
||||
CAM_DIS_AUTODISC = 0x02000000,
|
||||
CamDisAutodisc = 0x02000000,
|
||||
/// <summary>
|
||||
/// Target CCB available
|
||||
/// </summary>
|
||||
CAM_TGT_CCB_AVAIL = 0x04000000,
|
||||
CamTgtCcbAvail = 0x04000000,
|
||||
/// <summary>
|
||||
/// The SIM runs in phase mode
|
||||
/// </summary>
|
||||
CAM_TGT_PHASE_MODE = 0x08000000,
|
||||
CamTgtPhaseMode = 0x08000000,
|
||||
/// <summary>
|
||||
/// Message buffer valid
|
||||
/// </summary>
|
||||
CAM_MSGB_VALID = 0x10000000,
|
||||
CamMsgbValid = 0x10000000,
|
||||
/// <summary>
|
||||
/// Status buffer valid
|
||||
/// </summary>
|
||||
CAM_STATUS_VALID = 0x20000000,
|
||||
CamStatusValid = 0x20000000,
|
||||
/// <summary>
|
||||
/// Data buffer valid
|
||||
/// </summary>
|
||||
CAM_DATAB_VALID = 0x40000000,
|
||||
CamDatabValid = 0x40000000,
|
||||
/* Host target Mode flags */
|
||||
/// <summary>
|
||||
/// Send sense data with status
|
||||
/// </summary>
|
||||
CAM_SEND_SENSE = 0x08000000,
|
||||
CamSendSense = 0x08000000,
|
||||
/// <summary>
|
||||
/// Terminate I/O Message sup.
|
||||
/// </summary>
|
||||
CAM_TERM_IO = 0x10000000,
|
||||
CamTermIo = 0x10000000,
|
||||
/// <summary>
|
||||
/// Disconnects are mandatory
|
||||
/// </summary>
|
||||
CAM_DISCONNECT = 0x20000000,
|
||||
CamDisconnect = 0x20000000,
|
||||
/// <summary>
|
||||
/// Send status after data phase
|
||||
/// </summary>
|
||||
CAM_SEND_STATUS = 0x40000000,
|
||||
CamSendStatus = 0x40000000,
|
||||
/// <summary>
|
||||
/// Call callback without lock.
|
||||
/// </summary>
|
||||
CAM_UNLOCKED = 0x80000000
|
||||
CamUnlocked = 0x80000000
|
||||
}
|
||||
|
||||
enum cam_status : uint
|
||||
enum CamStatus : uint
|
||||
{
|
||||
/// <summary>CCB request is in progress</summary>
|
||||
CAM_REQ_INPROG = 0x00,
|
||||
CamReqInprog = 0x00,
|
||||
|
||||
/// <summary>CCB request completed without error</summary>
|
||||
CAM_REQ_CMP = 0x01,
|
||||
CamReqCmp = 0x01,
|
||||
|
||||
/// <summary>CCB request aborted by the host</summary>
|
||||
CAM_REQ_ABORTED = 0x02,
|
||||
CamReqAborted = 0x02,
|
||||
|
||||
/// <summary>Unable to abort CCB request</summary>
|
||||
CAM_UA_ABORT = 0x03,
|
||||
CamUaAbort = 0x03,
|
||||
|
||||
/// <summary>CCB request completed with an error</summary>
|
||||
CAM_REQ_CMP_ERR = 0x04,
|
||||
CamReqCmpErr = 0x04,
|
||||
|
||||
/// <summary>CAM subsystem is busy</summary>
|
||||
CAM_BUSY = 0x05,
|
||||
CamBusy = 0x05,
|
||||
|
||||
/// <summary>CCB request was invalid</summary>
|
||||
CAM_REQ_INVALID = 0x06,
|
||||
CamReqInvalid = 0x06,
|
||||
|
||||
/// <summary>Supplied Path ID is invalid</summary>
|
||||
CAM_PATH_INVALID = 0x07,
|
||||
CamPathInvalid = 0x07,
|
||||
|
||||
/// <summary>SCSI Device Not Installed/there</summary>
|
||||
CAM_DEV_NOT_THERE = 0x08,
|
||||
CamDevNotThere = 0x08,
|
||||
|
||||
/// <summary>Unable to terminate I/O CCB request</summary>
|
||||
CAM_UA_TERMIO = 0x09,
|
||||
CamUaTermio = 0x09,
|
||||
|
||||
/// <summary>Target Selection Timeout</summary>
|
||||
CAM_SEL_TIMEOUT = 0x0a,
|
||||
CamSelTimeout = 0x0a,
|
||||
|
||||
/// <summary>Command timeout</summary>
|
||||
CAM_CMD_TIMEOUT = 0x0b,
|
||||
CamCmdTimeout = 0x0b,
|
||||
|
||||
/// <summary>SCSI error, look at error code in CCB</summary>
|
||||
CAM_SCSI_STATUS_ERROR = 0x0c,
|
||||
CamScsiStatusError = 0x0c,
|
||||
|
||||
/// <summary>Message Reject Received</summary>
|
||||
CAM_MSG_REJECT_REC = 0x0d,
|
||||
CamMsgRejectRec = 0x0d,
|
||||
|
||||
/// <summary>SCSI Bus Reset Sent/Received</summary>
|
||||
CAM_SCSI_BUS_RESET = 0x0e,
|
||||
CamScsiBusReset = 0x0e,
|
||||
|
||||
/// <summary>Uncorrectable parity error occurred</summary>
|
||||
CAM_UNCOR_PARITY = 0x0f,
|
||||
CamUncorParity = 0x0f,
|
||||
|
||||
/// <summary>Autosense: request sense cmd fail</summary>
|
||||
CAM_AUTOSENSE_FAIL = 0x10,
|
||||
CamAutosenseFail = 0x10,
|
||||
|
||||
/// <summary>No HBA Detected error</summary>
|
||||
CAM_NO_HBA = 0x11,
|
||||
CamNoHba = 0x11,
|
||||
|
||||
/// <summary>Data Overrun error</summary>
|
||||
CAM_DATA_RUN_ERR = 0x12,
|
||||
CamDataRunErr = 0x12,
|
||||
|
||||
/// <summary>Unexpected Bus Free</summary>
|
||||
CAM_UNEXP_BUSFREE = 0x13,
|
||||
CamUnexpBusfree = 0x13,
|
||||
|
||||
/// <summary>Target Bus Phase Sequence Failure</summary>
|
||||
CAM_SEQUENCE_FAIL = 0x14,
|
||||
CamSequenceFail = 0x14,
|
||||
|
||||
/// <summary>CCB length supplied is inadequate</summary>
|
||||
CAM_CCB_LEN_ERR = 0x15,
|
||||
CamCcbLenErr = 0x15,
|
||||
|
||||
/// <summary>Unable to provide requested capability</summary>
|
||||
CAM_PROVIDE_FAIL = 0x16,
|
||||
CamProvideFail = 0x16,
|
||||
|
||||
/// <summary>A SCSI BDR msg was sent to target</summary>
|
||||
CAM_BDR_SENT = 0x17,
|
||||
CamBdrSent = 0x17,
|
||||
|
||||
/// <summary>CCB request terminated by the host</summary>
|
||||
CAM_REQ_TERMIO = 0x18,
|
||||
CamReqTermio = 0x18,
|
||||
|
||||
/// <summary>Unrecoverable Host Bus Adapter Error</summary>
|
||||
CAM_UNREC_HBA_ERROR = 0x19,
|
||||
CamUnrecHbaError = 0x19,
|
||||
|
||||
/// <summary>Request was too large for this host</summary>
|
||||
CAM_REQ_TOO_BIG = 0x1a,
|
||||
CamReqTooBig = 0x1a,
|
||||
|
||||
/// <summary>This request should be requeued to preserve transaction ordering. This typically occurs when the SIM recognizes an error that should freeze the queue and must place additional requests for the target at the sim level back into the XPT queue.</summary>
|
||||
CAM_REQUEUE_REQ = 0x1b,
|
||||
CamRequeueReq = 0x1b,
|
||||
|
||||
/// <summary>ATA error, look at error code in CCB</summary>
|
||||
CAM_ATA_STATUS_ERROR = 0x1c,
|
||||
CamAtaStatusError = 0x1c,
|
||||
|
||||
/// <summary>Initiator/Target Nexus lost.</summary>
|
||||
CAM_SCSI_IT_NEXUS_LOST = 0x1d,
|
||||
CamScsiItNexusLost = 0x1d,
|
||||
|
||||
/// <summary>SMP error, look at error code in CCB</summary>
|
||||
CAM_SMP_STATUS_ERROR = 0x1e,
|
||||
CamSmpStatusError = 0x1e,
|
||||
|
||||
/// <summary>Command completed without error but exceeded the soft timeout threshold.</summary>
|
||||
CAM_REQ_SOFTTIMEOUT = 0x1f,
|
||||
CamReqSofttimeout = 0x1f,
|
||||
|
||||
/*
|
||||
* 0x20 - 0x32 are unassigned
|
||||
*/
|
||||
|
||||
/// <summary>Initiator Detected Error</summary>
|
||||
CAM_IDE = 0x33,
|
||||
CamIde = 0x33,
|
||||
|
||||
/// <summary>Resource Unavailable</summary>
|
||||
CAM_RESRC_UNAVAIL = 0x34,
|
||||
CamResrcUnavail = 0x34,
|
||||
|
||||
/// <summary>Unacknowledged Event by Host</summary>
|
||||
CAM_UNACKED_EVENT = 0x35,
|
||||
CamUnackedEvent = 0x35,
|
||||
|
||||
/// <summary>Message Received in Host Target Mode</summary>
|
||||
CAM_MESSAGE_RECV = 0x36,
|
||||
CamMessageRecv = 0x36,
|
||||
|
||||
/// <summary>Invalid CDB received in Host Target Mode</summary>
|
||||
CAM_INVALID_CDB = 0x37,
|
||||
CamInvalidCdb = 0x37,
|
||||
|
||||
/// <summary>Lun supplied is invalid</summary>
|
||||
CAM_LUN_INVALID = 0x38,
|
||||
CamLunInvalid = 0x38,
|
||||
|
||||
/// <summary>Target ID supplied is invalid</summary>
|
||||
CAM_TID_INVALID = 0x39,
|
||||
CamTidInvalid = 0x39,
|
||||
|
||||
/// <summary>The requested function is not available</summary>
|
||||
CAM_FUNC_NOTAVAIL = 0x3a,
|
||||
CamFuncNotavail = 0x3a,
|
||||
|
||||
/// <summary>Nexus is not established</summary>
|
||||
CAM_NO_NEXUS = 0x3b,
|
||||
CamNoNexus = 0x3b,
|
||||
|
||||
/// <summary>The initiator ID is invalid</summary>
|
||||
CAM_IID_INVALID = 0x3c,
|
||||
CamIidInvalid = 0x3c,
|
||||
|
||||
/// <summary>The SCSI CDB has been received</summary>
|
||||
CAM_CDB_RECVD = 0x3d,
|
||||
CamCdbRecvd = 0x3d,
|
||||
|
||||
/// <summary>The LUN is already enabled for target mode</summary>
|
||||
CAM_LUN_ALRDY_ENA = 0x3e,
|
||||
CamLunAlrdyEna = 0x3e,
|
||||
|
||||
/// <summary>SCSI Bus Busy</summary>
|
||||
CAM_SCSI_BUSY = 0x3f,
|
||||
CamScsiBusy = 0x3f,
|
||||
|
||||
/*
|
||||
* Flags
|
||||
*/
|
||||
|
||||
/// <summary>The DEV queue is frozen w/this err</summary>
|
||||
CAM_DEV_QFRZN = 0x40,
|
||||
CamDevQfrzn = 0x40,
|
||||
|
||||
/// <summary>Autosense data valid for target</summary>
|
||||
CAM_AUTOSNS_VALID = 0x80,
|
||||
CamAutosnsValid = 0x80,
|
||||
|
||||
/// <summary>SIM ready to take more commands</summary>
|
||||
CAM_RELEASE_SIMQ = 0x100,
|
||||
CamReleaseSimq = 0x100,
|
||||
|
||||
/// <summary>SIM has this command in its queue</summary>
|
||||
CAM_SIM_QUEUED = 0x200,
|
||||
CamSimQueued = 0x200,
|
||||
|
||||
/// <summary>Quality of service data is valid</summary>
|
||||
CAM_QOS_VALID = 0x400,
|
||||
CamQosValid = 0x400,
|
||||
|
||||
/// <summary>Mask bits for just the status #</summary>
|
||||
CAM_STATUS_MASK = 0x3F,
|
||||
CamStatusMask = 0x3F,
|
||||
|
||||
/*
|
||||
* Target Specific Adjunct Status
|
||||
*/
|
||||
|
||||
/// <summary>sent sense with status</summary>
|
||||
CAM_SENT_SENSE = 0x40000000
|
||||
CamSentSense = 0x40000000
|
||||
}
|
||||
}
|
||||
@@ -50,15 +50,15 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
{
|
||||
DeviceInfo deviceInfo = new DeviceInfo();
|
||||
IntPtr dev = cam_open_device(passDevice, FileFlags.ReadWrite);
|
||||
cam_device camDevice = (cam_device)Marshal.PtrToStructure(dev, typeof(cam_device));
|
||||
CamDevice camDevice = (CamDevice)Marshal.PtrToStructure(dev, typeof(CamDevice));
|
||||
|
||||
IntPtr ccbPtr = cam_getccb(dev);
|
||||
|
||||
if(ccbPtr.ToInt64() == 0) continue;
|
||||
|
||||
ccb_getdev cgd = (ccb_getdev)Marshal.PtrToStructure(ccbPtr, typeof(ccb_getdev));
|
||||
CcbGetdev cgd = (CcbGetdev)Marshal.PtrToStructure(ccbPtr, typeof(CcbGetdev));
|
||||
|
||||
cgd.ccb_h.func_code = xpt_opcode.XPT_GDEV_TYPE;
|
||||
cgd.ccb_h.func_code = XptOpcode.XptGdevType;
|
||||
|
||||
Marshal.StructureToPtr(cgd, ccbPtr, false);
|
||||
|
||||
@@ -70,22 +70,22 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
continue;
|
||||
}
|
||||
|
||||
cgd = (ccb_getdev)Marshal.PtrToStructure(ccbPtr, typeof(ccb_getdev));
|
||||
cgd = (CcbGetdev)Marshal.PtrToStructure(ccbPtr, typeof(CcbGetdev));
|
||||
|
||||
cam_freeccb(ccbPtr);
|
||||
cam_close_device(dev);
|
||||
|
||||
string simName = StringHandlers.CToString(camDevice.sim_name);
|
||||
deviceInfo.path = passDevice;
|
||||
byte[] serialNumber = new byte[camDevice.serial_num_len];
|
||||
Array.Copy(camDevice.serial_num, 0, serialNumber, 0, serialNumber.Length);
|
||||
deviceInfo.serial = StringHandlers.CToString(serialNumber);
|
||||
string simName = StringHandlers.CToString(camDevice.SimName);
|
||||
deviceInfo.Path = passDevice;
|
||||
byte[] serialNumber = new byte[camDevice.SerialNumLen];
|
||||
Array.Copy(camDevice.SerialNum, 0, serialNumber, 0, serialNumber.Length);
|
||||
deviceInfo.Serial = StringHandlers.CToString(serialNumber);
|
||||
|
||||
switch(cgd.protocol)
|
||||
{
|
||||
case cam_proto.PROTO_ATA:
|
||||
case cam_proto.PROTO_ATAPI:
|
||||
case cam_proto.PROTO_SATAPM:
|
||||
case CamProto.ProtoAta:
|
||||
case CamProto.ProtoAtapi:
|
||||
case CamProto.ProtoSatapm:
|
||||
{
|
||||
// Little-endian FreeBSD gives it resorted
|
||||
// Big-endian FreeBSD, no idea
|
||||
@@ -103,49 +103,49 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
|
||||
if(separated.Length == 1)
|
||||
{
|
||||
deviceInfo.vendor = "ATA";
|
||||
deviceInfo.model = separated[0];
|
||||
deviceInfo.Vendor = "ATA";
|
||||
deviceInfo.Model = separated[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceInfo.vendor = separated[0];
|
||||
deviceInfo.model = separated[separated.Length - 1];
|
||||
deviceInfo.Vendor = separated[0];
|
||||
deviceInfo.Model = separated[separated.Length - 1];
|
||||
}
|
||||
|
||||
deviceInfo.serial = idt.Value.SerialNumber;
|
||||
deviceInfo.bus = simName == "ahcich" ? "SATA" : "ATA";
|
||||
deviceInfo.supported = simName != "ata";
|
||||
deviceInfo.Serial = idt.Value.SerialNumber;
|
||||
deviceInfo.Bus = simName == "ahcich" ? "SATA" : "ATA";
|
||||
deviceInfo.Supported = simName != "ata";
|
||||
}
|
||||
if(cgd.protocol == cam_proto.PROTO_ATAPI) goto case cam_proto.PROTO_SCSI;
|
||||
if(cgd.protocol == CamProto.ProtoAtapi) goto case CamProto.ProtoScsi;
|
||||
break;
|
||||
}
|
||||
case cam_proto.PROTO_SCSI:
|
||||
case CamProto.ProtoScsi:
|
||||
{
|
||||
Decoders.SCSI.Inquiry.SCSIInquiry? inq = Decoders.SCSI.Inquiry.Decode(cgd.inq_data);
|
||||
if(inq.HasValue)
|
||||
{
|
||||
deviceInfo.vendor = StringHandlers.CToString(inq.Value.VendorIdentification).Trim();
|
||||
deviceInfo.model = StringHandlers.CToString(inq.Value.ProductIdentification).Trim();
|
||||
deviceInfo.bus = simName == "ata" || simName == "ahcich" ? "ATAPI" : "SCSI";
|
||||
deviceInfo.supported = simName != "ata";
|
||||
deviceInfo.Vendor = StringHandlers.CToString(inq.Value.VendorIdentification).Trim();
|
||||
deviceInfo.Model = StringHandlers.CToString(inq.Value.ProductIdentification).Trim();
|
||||
deviceInfo.Bus = simName == "ata" || simName == "ahcich" ? "ATAPI" : "SCSI";
|
||||
deviceInfo.Supported = simName != "ata";
|
||||
}
|
||||
break;
|
||||
}
|
||||
case cam_proto.PROTO_NVME:
|
||||
deviceInfo.bus = "NVMe";
|
||||
deviceInfo.supported = false;
|
||||
case CamProto.ProtoNvme:
|
||||
deviceInfo.Bus = "NVMe";
|
||||
deviceInfo.Supported = false;
|
||||
break;
|
||||
case cam_proto.PROTO_MMCSD:
|
||||
deviceInfo.model = "Unknown card";
|
||||
deviceInfo.bus = "MMC/SD";
|
||||
deviceInfo.supported = false;
|
||||
case CamProto.ProtoMmcsd:
|
||||
deviceInfo.Model = "Unknown card";
|
||||
deviceInfo.Bus = "MMC/SD";
|
||||
deviceInfo.Supported = false;
|
||||
break;
|
||||
}
|
||||
|
||||
listDevices.Add(deviceInfo);
|
||||
}
|
||||
|
||||
return listDevices.Count > 0 ? listDevices.OrderBy(t => t.path).ToArray() : null;
|
||||
return listDevices.Count > 0 ? listDevices.OrderBy(t => t.Path).ToArray() : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ using target_id_t = System.UInt32;
|
||||
namespace DiscImageChef.Devices.FreeBSD
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ata_cmd
|
||||
struct AtaCmd
|
||||
{
|
||||
public CamAtaIoFlags flags;
|
||||
public byte command;
|
||||
@@ -59,7 +59,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ata_res
|
||||
struct AtaRes
|
||||
{
|
||||
public CamAtaIoFlags flags;
|
||||
public byte status;
|
||||
@@ -76,64 +76,64 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct cam_pinfo
|
||||
struct CamPinfo
|
||||
{
|
||||
public uint priority;
|
||||
public uint generation;
|
||||
public int index;
|
||||
}
|
||||
|
||||
struct LIST_ENTRY
|
||||
struct ListEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// LIST_ENTRY(ccb_hdr)=le->*le_next
|
||||
/// </summary>
|
||||
public IntPtr le_next;
|
||||
public IntPtr LeNext;
|
||||
/// <summary>
|
||||
/// LIST_ENTRY(ccb_hdr)=le->**le_prev
|
||||
/// </summary>
|
||||
public IntPtr le_prev;
|
||||
public IntPtr LePrev;
|
||||
}
|
||||
|
||||
struct SLIST_ENTRY
|
||||
struct SlistEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// SLIST_ENTRY(ccb_hdr)=sle->*sle_next
|
||||
/// </summary>
|
||||
public IntPtr sle_next;
|
||||
public IntPtr SleNext;
|
||||
}
|
||||
|
||||
struct TAILQ_ENTRY
|
||||
struct TailqEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// TAILQ_ENTRY(ccb_hdr)=tqe->*tqe_next
|
||||
/// </summary>
|
||||
public IntPtr tqe_next;
|
||||
public IntPtr TqeNext;
|
||||
/// <summary>
|
||||
/// TAILQ_ENTRY(ccb_hdr)=tqe->**tqe_prev
|
||||
/// </summary>
|
||||
public IntPtr tqe_prev;
|
||||
public IntPtr TqePrev;
|
||||
}
|
||||
|
||||
struct STAILQ_ENTRY
|
||||
struct StailqEntry
|
||||
{
|
||||
/// <summary>
|
||||
/// STAILQ_ENTRY(ccb_hdr)=stqe->*stqe_next
|
||||
/// </summary>
|
||||
public IntPtr stqe_next;
|
||||
public IntPtr StqeNext;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
struct camq_entry
|
||||
struct CamqEntry
|
||||
{
|
||||
[FieldOffset(0)] public LIST_ENTRY le;
|
||||
[FieldOffset(0)] public SLIST_ENTRY sle;
|
||||
[FieldOffset(0)] public TAILQ_ENTRY tqe;
|
||||
[FieldOffset(0)] public STAILQ_ENTRY stqe;
|
||||
[FieldOffset(0)] public ListEntry le;
|
||||
[FieldOffset(0)] public SlistEntry sle;
|
||||
[FieldOffset(0)] public TailqEntry tqe;
|
||||
[FieldOffset(0)] public StailqEntry stqe;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct timeval
|
||||
struct Timeval
|
||||
{
|
||||
public long tv_sec;
|
||||
/// <summary>long</summary>
|
||||
@@ -141,39 +141,39 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_qos_area
|
||||
struct CcbQosArea
|
||||
{
|
||||
public timeval etime;
|
||||
public Timeval etime;
|
||||
public UIntPtr sim_data;
|
||||
public UIntPtr periph_data;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_hdr
|
||||
struct CcbHdr
|
||||
{
|
||||
public cam_pinfo pinfo;
|
||||
public camq_entry xpt_links;
|
||||
public camq_entry sim_links;
|
||||
public camq_entry periph_links;
|
||||
public CamPinfo pinfo;
|
||||
public CamqEntry xpt_links;
|
||||
public CamqEntry sim_links;
|
||||
public CamqEntry periph_links;
|
||||
public uint retry_count;
|
||||
public IntPtr cbfcnp;
|
||||
public xpt_opcode func_code;
|
||||
public cam_status status;
|
||||
public XptOpcode func_code;
|
||||
public CamStatus status;
|
||||
public IntPtr path;
|
||||
public uint path_id;
|
||||
public uint target_id;
|
||||
public ulong target_lun;
|
||||
public ccb_flags flags;
|
||||
public CcbFlags flags;
|
||||
public uint xflags;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] periph_priv;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)] public IntPtr[] sim_priv;
|
||||
public ccb_qos_area qos;
|
||||
public CcbQosArea qos;
|
||||
public uint timeout;
|
||||
public timeval softtimeout;
|
||||
public Timeval softtimeout;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct scsi_sense_data
|
||||
struct ScsiSenseData
|
||||
{
|
||||
const int SSD_FULL_SIZE = 252;
|
||||
public byte error_code;
|
||||
@@ -184,9 +184,9 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_scsiio
|
||||
struct CcbScsiio
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>Ptr to mapping info</summary>
|
||||
@@ -196,7 +196,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>Data transfer length</summary>
|
||||
public uint dxfer_len;
|
||||
/// <summary>Autosense storage</summary>
|
||||
public scsi_sense_data sense_data;
|
||||
public ScsiSenseData sense_data;
|
||||
/// <summary>Number of bytes to autosense</summary>
|
||||
public byte sense_len;
|
||||
/// <summary>Number of bytes for the CDB</summary>
|
||||
@@ -230,9 +230,9 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// SCSI I/O Request CCB used for the XPT_SCSI_IO and XPT_CONT_TARGET_IO function codes.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_scsiio64
|
||||
struct CcbScsiio64
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>Ptr to mapping info</summary>
|
||||
@@ -242,7 +242,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>Data transfer length</summary>
|
||||
public uint dxfer_len;
|
||||
/// <summary>Autosense storage</summary>
|
||||
public scsi_sense_data sense_data;
|
||||
public ScsiSenseData sense_data;
|
||||
/// <summary>Number of bytes to autosense</summary>
|
||||
public byte sense_len;
|
||||
/// <summary>Number of bytes for the CDB</summary>
|
||||
@@ -277,15 +277,15 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// ATA I/O Request CCB used for the XPT_ATA_IO function code.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_ataio
|
||||
struct CcbAtaio
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>ATA command register set</summary>
|
||||
public ata_cmd cmd;
|
||||
public AtaCmd cmd;
|
||||
/// <summary>ATA result register set</summary>
|
||||
public ata_res res;
|
||||
public AtaRes res;
|
||||
/// <summary>Ptr to the data buf/SG list</summary>
|
||||
public IntPtr data_ptr;
|
||||
/// <summary>Data transfer length</summary>
|
||||
@@ -299,7 +299,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct nvme_command
|
||||
struct NvmeCommand
|
||||
{
|
||||
private ushort opc_fuse_rsvd1;
|
||||
/// <summary>
|
||||
@@ -358,55 +358,55 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// opcode
|
||||
/// </summary>
|
||||
public byte opc => (byte)((opc_fuse_rsvd1 & 0xFF00) >> 8);
|
||||
public byte Opc => (byte)((opc_fuse_rsvd1 & 0xFF00) >> 8);
|
||||
/// <summary>
|
||||
/// fused operation
|
||||
/// </summary>
|
||||
public byte fuse => (byte)((opc_fuse_rsvd1 & 0xC0) >> 6);
|
||||
public byte Fuse => (byte)((opc_fuse_rsvd1 & 0xC0) >> 6);
|
||||
/// <summary>
|
||||
/// reserved
|
||||
/// </summary>
|
||||
public byte rsvd1 => (byte)(opc_fuse_rsvd1 & 0x3F);
|
||||
public byte Rsvd1 => (byte)(opc_fuse_rsvd1 & 0x3F);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct nvme_status
|
||||
struct NvmeStatus
|
||||
{
|
||||
private ushort status;
|
||||
|
||||
/// <summary>
|
||||
/// phase tag
|
||||
/// </summary>
|
||||
public byte p => (byte)((status & 0x8000) >> 15);
|
||||
public byte P => (byte)((status & 0x8000) >> 15);
|
||||
|
||||
/// <summary>
|
||||
/// status code
|
||||
/// </summary>
|
||||
public byte sc => (byte)((status & 0x7F80) >> 7);
|
||||
public byte Sc => (byte)((status & 0x7F80) >> 7);
|
||||
|
||||
/// <summary>
|
||||
/// status code type
|
||||
/// </summary>
|
||||
public byte sct => (byte)((status & 0x70) >> 4);
|
||||
public byte Sct => (byte)((status & 0x70) >> 4);
|
||||
|
||||
/// <summary>
|
||||
/// reserved
|
||||
/// </summary>
|
||||
public byte rsvd2 => (byte)((status & 0xC) >> 15);
|
||||
public byte Rsvd2 => (byte)((status & 0xC) >> 15);
|
||||
|
||||
/// <summary>
|
||||
/// more
|
||||
/// </summary>
|
||||
public byte m => (byte)((status & 0x2) >> 1);
|
||||
public byte M => (byte)((status & 0x2) >> 1);
|
||||
|
||||
/// <summary>
|
||||
/// do not retry
|
||||
/// </summary>
|
||||
public byte dnr => (byte)(status & 0x1);
|
||||
public byte Dnr => (byte)(status & 0x1);
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct nvme_completion
|
||||
struct NvmeCompletion
|
||||
{
|
||||
/// <summary>
|
||||
/// command-specific
|
||||
@@ -433,22 +433,22 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// </summary>
|
||||
public ushort cid;
|
||||
|
||||
public nvme_status status;
|
||||
public NvmeStatus status;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// NVMe I/O Request CCB used for the XPT_NVME_IO and XPT_NVME_ADMIN function codes.
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_nvmeio
|
||||
struct CcbNvmeio
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
public CcbHdr ccb_h;
|
||||
/// <summary>Ptr for next CCB for action</summary>
|
||||
public IntPtr next_ccb;
|
||||
/// <summary>NVME command, per NVME standard</summary>
|
||||
public nvme_command cmd;
|
||||
public NvmeCommand cmd;
|
||||
/// <summary>NVME completion, per NVME standard</summary>
|
||||
public nvme_completion cpl;
|
||||
public NvmeCompletion cpl;
|
||||
/// <summary>Ptr to the data buf/SG list</summary>
|
||||
public IntPtr data_ptr;
|
||||
/// <summary>Data transfer length</summary>
|
||||
@@ -460,7 +460,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct periph_match_pattern
|
||||
struct PeriphMatchPattern
|
||||
{
|
||||
private const int DEV_IDLEN = 16;
|
||||
|
||||
@@ -469,18 +469,18 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
public path_id_t path_id;
|
||||
public target_id_t target_id;
|
||||
public lun_id_t target_lun;
|
||||
public periph_pattern_flags flags;
|
||||
public PeriphPatternFlags flags;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct device_id_match_pattern
|
||||
struct DeviceIdMatchPattern
|
||||
{
|
||||
public byte id_len;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] id;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct scsi_static_inquiry_pattern
|
||||
struct ScsiStaticInquiryPattern
|
||||
{
|
||||
private const int SID_VENDOR_SIZE = 8;
|
||||
private const int SID_PRODUCT_SIZE = 16;
|
||||
@@ -493,24 +493,24 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
struct device_match_pattern_data
|
||||
struct DeviceMatchPatternData
|
||||
{
|
||||
[FieldOffset(0)] public scsi_static_inquiry_pattern inq_pat;
|
||||
[FieldOffset(0)] public device_id_match_pattern devid_pat;
|
||||
[FieldOffset(0)] public ScsiStaticInquiryPattern inq_pat;
|
||||
[FieldOffset(0)] public DeviceIdMatchPattern devid_pat;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct device_match_pattern
|
||||
struct DeviceMatchPattern
|
||||
{
|
||||
public path_id_t path_id;
|
||||
public target_id_t target_id;
|
||||
public lun_id_t target_lun;
|
||||
public dev_pattern_flags flags;
|
||||
public device_match_pattern_data data;
|
||||
public DevPatternFlags flags;
|
||||
public DeviceMatchPatternData data;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct bus_match_pattern
|
||||
struct BusMatchPattern
|
||||
{
|
||||
private const int DEV_IDLEN = 16;
|
||||
|
||||
@@ -518,26 +518,26 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN)] public byte[] dev_name;
|
||||
public uint unit_number;
|
||||
public uint bus_id;
|
||||
bus_pattern_flags flags;
|
||||
BusPatternFlags flags;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
struct match_pattern
|
||||
struct MatchPattern
|
||||
{
|
||||
[FieldOffset(0)] public periph_match_pattern periph_pattern;
|
||||
[FieldOffset(0)] public device_match_pattern device_pattern;
|
||||
[FieldOffset(0)] public bus_match_pattern bus_pattern;
|
||||
[FieldOffset(0)] public PeriphMatchPattern periph_pattern;
|
||||
[FieldOffset(0)] public DeviceMatchPattern device_pattern;
|
||||
[FieldOffset(0)] public BusMatchPattern bus_pattern;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct dev_match_pattern
|
||||
struct DevMatchPattern
|
||||
{
|
||||
public dev_match_type type;
|
||||
public match_pattern pattern;
|
||||
public DevMatchType type;
|
||||
public MatchPattern pattern;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct periph_match_result
|
||||
struct PeriphMatchResult
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] periph_name;
|
||||
public uint unit_number;
|
||||
@@ -547,7 +547,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct mmc_cid
|
||||
struct MmcCid
|
||||
{
|
||||
public uint mid;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] pnm;
|
||||
@@ -560,7 +560,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct mmc_params
|
||||
struct MmcParams
|
||||
{
|
||||
/// <summary>
|
||||
/// Card model
|
||||
@@ -585,7 +585,7 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// Card CID -- parsed
|
||||
/// </summary>
|
||||
public mmc_cid cid;
|
||||
public MmcCid cid;
|
||||
|
||||
/// <summary>
|
||||
/// Card CSD -- raw
|
||||
@@ -600,26 +600,26 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// What kind of card is it
|
||||
/// </summary>
|
||||
public mmc_card_features card_features;
|
||||
public MmcCardFeatures card_features;
|
||||
|
||||
public byte sdio_func_count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct device_match_result
|
||||
struct DeviceMatchResult
|
||||
{
|
||||
public path_id_t path_id;
|
||||
public target_id_t target_id;
|
||||
public lun_id_t target_lun;
|
||||
public cam_proto protocol;
|
||||
public CamProto protocol;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] ident_data;
|
||||
public dev_result_flags flags;
|
||||
public mmc_params mmc_ident_data;
|
||||
public DevResultFlags flags;
|
||||
public MmcParams mmc_ident_data;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct bus_match_result
|
||||
struct BusMatchResult
|
||||
{
|
||||
public path_id_t path_id;
|
||||
private const int DEV_IDLEN = 16;
|
||||
@@ -629,22 +629,22 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
struct match_result
|
||||
struct MatchResult
|
||||
{
|
||||
[FieldOffset(0)] public periph_match_result periph_result;
|
||||
[FieldOffset(0)] public device_match_result device_result;
|
||||
[FieldOffset(0)] public bus_match_result bus_result;
|
||||
[FieldOffset(0)] public PeriphMatchResult periph_result;
|
||||
[FieldOffset(0)] public DeviceMatchResult device_result;
|
||||
[FieldOffset(0)] public BusMatchResult bus_result;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct dev_match_result
|
||||
struct DevMatchResult
|
||||
{
|
||||
public dev_match_type type;
|
||||
public match_result result;
|
||||
public DevMatchType type;
|
||||
public MatchResult result;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_dm_cookie
|
||||
struct CcbDmCookie
|
||||
{
|
||||
public IntPtr bus;
|
||||
public IntPtr target;
|
||||
@@ -654,18 +654,18 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_dev_position
|
||||
struct CcbDevPosition
|
||||
{
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public cam_generations[] generations;
|
||||
dev_pos_type position_type;
|
||||
public ccb_dm_cookie cookie;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public CamGenerations[] generations;
|
||||
DevPosType position_type;
|
||||
public CcbDmCookie cookie;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_dev_match
|
||||
struct CcbDevMatch
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
ccb_dev_match_status status;
|
||||
public CcbHdr ccb_h;
|
||||
CcbDevMatchStatus status;
|
||||
public uint num_patterns;
|
||||
public uint pattern_buf_len;
|
||||
|
||||
@@ -682,10 +682,10 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// </summary>
|
||||
public IntPtr matches;
|
||||
|
||||
public ccb_dev_position pos;
|
||||
public CcbDevPosition pos;
|
||||
}
|
||||
|
||||
struct cam_device
|
||||
struct CamDevice
|
||||
{
|
||||
private const int MAXPATHLEN = 1024;
|
||||
private const int DEV_IDLEN = 16;
|
||||
@@ -693,86 +693,86 @@ namespace DiscImageChef.Devices.FreeBSD
|
||||
/// <summary>
|
||||
/// Pathname of the device given by the user. This may be null if the user states the device name and unit number separately.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPATHLEN)] public byte[] device_path;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = MAXPATHLEN)] public byte[] DevicePath;
|
||||
/// <summary>
|
||||
/// Device name given by the user.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] given_dev_name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] GivenDevName;
|
||||
/// <summary>
|
||||
/// Unit number given by the user.
|
||||
/// </summary>
|
||||
public uint given_unit_number;
|
||||
public uint GivenUnitNumber;
|
||||
/// <summary>
|
||||
/// Name of the device, e.g. 'pass'
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] device_name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = DEV_IDLEN + 1)] public byte[] DeviceName;
|
||||
/// <summary>
|
||||
/// Unit number of the passthrough device associated with this particular device.
|
||||
/// </summary>
|
||||
public uint dev_unit_num;
|
||||
public uint DevUnitNum;
|
||||
/// <summary>
|
||||
/// Controller name, e.g. 'ahc'
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = SIM_IDLEN + 1)] public byte[] sim_name;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = SIM_IDLEN + 1)] public byte[] SimName;
|
||||
/// <summary>
|
||||
/// Controller unit number
|
||||
/// </summary>
|
||||
public uint sim_unit_number;
|
||||
public uint SimUnitNumber;
|
||||
/// <summary>
|
||||
/// Controller bus number
|
||||
/// </summary>
|
||||
public uint bus_id;
|
||||
public uint BusId;
|
||||
/// <summary>
|
||||
/// Logical Unit Number
|
||||
/// </summary>
|
||||
public lun_id_t target_lun;
|
||||
public lun_id_t TargetLun;
|
||||
/// <summary>
|
||||
/// Target ID
|
||||
/// </summary>
|
||||
public target_id_t target_id;
|
||||
public target_id_t TargetId;
|
||||
/// <summary>
|
||||
/// System SCSI bus number
|
||||
/// </summary>
|
||||
public path_id_t path_id;
|
||||
public path_id_t PathId;
|
||||
/// <summary>
|
||||
/// type of peripheral device
|
||||
/// </summary>
|
||||
public ushort pd_type;
|
||||
public ushort PdType;
|
||||
/// <summary>
|
||||
/// SCSI Inquiry data
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] InqData;
|
||||
/// <summary>
|
||||
/// device serial number
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] serial_num;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 252)] public byte[] SerialNum;
|
||||
/// <summary>
|
||||
/// length of the serial number
|
||||
/// </summary>
|
||||
public byte serial_num_len;
|
||||
public byte SerialNumLen;
|
||||
/// <summary>
|
||||
/// Negotiated sync period
|
||||
/// </summary>
|
||||
public byte sync_period;
|
||||
public byte SyncPeriod;
|
||||
/// <summary>
|
||||
/// Negotiated sync offset
|
||||
/// </summary>
|
||||
public byte sync_offset;
|
||||
public byte SyncOffset;
|
||||
/// <summary>
|
||||
/// Negotiated bus width
|
||||
/// </summary>
|
||||
public byte bus_width;
|
||||
public byte BusWidth;
|
||||
/// <summary>
|
||||
/// file descriptor for device
|
||||
/// </summary>
|
||||
public int fd;
|
||||
public int Fd;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct ccb_getdev
|
||||
struct CcbGetdev
|
||||
{
|
||||
public ccb_hdr ccb_h;
|
||||
public cam_proto protocol;
|
||||
public CcbHdr ccb_h;
|
||||
public CamProto protocol;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] inq_data;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)] public byte[] ident_data;
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user