Exemple #1
0
        private static Boolean Unmap(
            IntPtr StorageUnitPtr,
            IntPtr Descriptors, UInt32 Count,
            ref StorageUnitStatus Status)
        {
            StorageUnitBase StorageUnit = (StorageUnitBase)Api.GetUserContext(StorageUnitPtr);

            UnmapDescriptor[] DescriptorArray = Api.MakeUnmapDescriptorArray(Descriptors, Count);
            try
            {
                StorageUnit.Unmap(DescriptorArray, ref Status);
            }
            catch (Exception)
            {
            }
            return(true);
        }
Exemple #2
0
        private static Boolean Flush(
            IntPtr StorageUnitPtr,
            UInt64 BlockAddress, UInt32 BlockCount,
            ref StorageUnitStatus Status)
        {
            StorageUnitBase StorageUnit = (StorageUnitBase)Api.GetUserContext(StorageUnitPtr);

            try
            {
                StorageUnit.Flush(BlockAddress, BlockCount, ref Status);
            }
            catch (Exception)
            {
                Status.SetSense(
                    StorageUnitBase.SCSI_SENSE_MEDIUM_ERROR,
                    StorageUnitBase.SCSI_ADSENSE_WRITE_ERROR);
            }
            return(true);
        }
Exemple #3
0
        /* SPD_STORAGE_UNIT_INTERFACE */
        private static Boolean Read(
            IntPtr StorageUnitPtr,
            IntPtr Buffer, UInt64 BlockAddress, UInt32 BlockCount, Boolean Flush,
            ref StorageUnitStatus Status)
        {
            StorageUnitBase StorageUnit = (StorageUnitBase)Api.GetUserContext(StorageUnitPtr);

            try
            {
                StorageUnit.Read(_ThreadBuffer, BlockAddress, BlockCount, Flush, ref Status);
            }
            catch (Exception)
            {
                Status.SetSense(
                    StorageUnitBase.SCSI_SENSE_MEDIUM_ERROR,
                    StorageUnitBase.SCSI_ADSENSE_UNRECOVERED_ERROR);
            }
            return(true);
        }
Exemple #4
0
 /* ctor/dtor */
 /// <summary>
 /// Creates an instance of the StorageUnitHost class.
 /// </summary>
 /// <param name="StorageUnit">The storage unit to host.</param>
 public StorageUnitHost(StorageUnitBase StorageUnit)
 {
     _StorageUnit  = StorageUnit;
     _ShutdownLock = new ReaderWriterLockSlim();
 }