/// <exception cref="System.IO.IOException"/> internal static void PadEditLog(EditLogOutputStream elos, int paddingLength) { if (paddingLength <= 0) { return; } byte[] buf = new byte[4096]; for (int i = 0; i < buf.Length; i++) { buf[i] = unchecked ((byte)unchecked ((byte)(-1))); } int pad = paddingLength; while (pad > 0) { int toWrite = pad > buf.Length ? buf.Length : pad; elos.WriteRaw(buf, 0, toWrite); pad -= toWrite; } }
/// <exception cref="System.IO.IOException"/> public override void AddTransactionsToLog(EditLogOutputStream elos, FSEditLogOp.OpInstanceCache cache) { for (long txid = 1; txid <= MaxTxid; txid++) { if (txid == BadTxid) { byte[] garbage = new byte[] { unchecked ((int)(0x1)), unchecked ((int)(0x2)), unchecked ( (int)(0x3)) }; elos.WriteRaw(garbage, 0, garbage.Length); } else { FSEditLogOp.DeleteOp op; op = FSEditLogOp.DeleteOp.GetInstance(cache); op.SetTransactionId(txid); op.SetPath("/foo." + txid); op.SetTimestamp(txid); elos.Write(op); } } }