override protected uint OnWriteDataImpl(System.UInt64 Offset, uint Size, ref System.Array Buffer) { byte[] buf = (byte[])Buffer; Console.WriteLine("write (" + GLOBAL.icomm.seq_num + ") " + Offset + " size = " + Buffer.Length + " hash:" + DEFS.checksum_buf(buf, 0, (int)Size)); bool dopuchhole = false; if (scrubmode) { dopuchhole = true; for (int i = 0; i < buf.Length; i++) { if (buf[i] != 0) { dopuchhole = false; break; } } } lock (m_rvi) { if (scrubmode && dopuchhole) { GLOBAL.icomm.write_punch_hole(m_rvi, (long)Offset, (int)Size); } else { GLOBAL.icomm.write(m_rvi, (long)Offset, (byte[])buf, 0, (int)Size); } } return(Size); }
override protected uint OnReadDataImpl(System.UInt64 Offset, uint Size, out System.Array BufferX) { byte[] buf = new byte[Size]; lock (m_rvi) { GLOBAL.icomm.read(m_rvi, (long)Offset, buf, 0, (int)Size); } BufferX = buf; Console.WriteLine("Read (" + GLOBAL.icomm.seq_num + " )" + Offset + " size = " + Size + " hash:" + DEFS.checksum_buf((byte[])BufferX, 0, (int)Size)); return(Size); }