VolumeDisk.cs 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using Utilities;
  5. namespace ISCSIConsole
  6. {
  7. public class VolumeDisk : Disk // a fake disk that serves a single volume
  8. {
  9. private Volume m_volume;
  10. public VolumeDisk(Volume volume)
  11. {
  12. m_volume = volume;
  13. }
  14. public override byte[] ReadSectors(long sectorIndex, int sectorCount)
  15. {
  16. return m_volume.ReadSectors(sectorIndex, sectorCount);
  17. }
  18. public override void WriteSectors(long sectorIndex, byte[] data)
  19. {
  20. if (!IsReadOnly)
  21. {
  22. m_volume.WriteSectors(sectorIndex, data);
  23. }
  24. }
  25. public override int BytesPerSector
  26. {
  27. get
  28. {
  29. return m_volume.BytesPerSector;
  30. }
  31. }
  32. public override long Size
  33. {
  34. get
  35. {
  36. return m_volume.Size;
  37. }
  38. }
  39. }
  40. }