Esempio n. 1
0
        public static LfsRestartPage Create(long fileSize, int bytesPerSystemPage, int bytesPerLogPage, params LfsClientRecord[] clients)
        {
            LfsRestartPage restartPage = new LfsRestartPage();

            restartPage.LogPageSize                   = (uint)bytesPerLogPage;
            restartPage.RestartArea.CurrentLsn        = 0;
            restartPage.RestartArea.LastLsnDataLength = 0;
            restartPage.RestartArea.ClientFreeList    = LfsRestartArea.NoClient;
            restartPage.RestartArea.ClientInUseList   = (clients.Length > 0) ? (ushort)0 : LfsRestartArea.NoClient;
            restartPage.RestartArea.Flags             = LfsRestartFlags.CleanDismount;
            restartPage.RestartArea.FileSize          = (ulong)fileSize;
            restartPage.RestartArea.FileSizeBits      = LfsRestartArea.CalculateFileSizeBits(fileSize);
            restartPage.RestartArea.LogPageDataOffset = (ushort)LfsRecordPage.GetDataOffset(bytesPerLogPage);

            if (clients.Length > 0)
            {
                clients[0].PrevClient = LfsRestartArea.NoClient;
                clients[clients.Length - 1].NextClient = LfsRestartArea.NoClient;
            }

            for (int index = 1; index < clients.Length; index++)
            {
                clients[index].PrevClient = (ushort)(index - 1);
            }

            restartPage.RestartArea.LogClientArray.AddRange(clients);

            return(restartPage);
        }
Esempio n. 2
0
        public LfsRestartPage(byte[] buffer, int offset)
        {
            MultiSectorHeader multiSectorHeader = new MultiSectorHeader(buffer, offset + 0x00);

            if (multiSectorHeader.Signature != ValidSignature && multiSectorHeader.Signature != ModifiedSignature)
            {
                throw new InvalidDataException("Invalid RSTR record signature");
            }
            ChkDskLsn        = LittleEndianConverter.ToUInt64(buffer, offset + 0x08);
            m_systemPageSize = LittleEndianConverter.ToUInt32(buffer, offset + 0x10);
            LogPageSize      = LittleEndianConverter.ToUInt32(buffer, offset + 0x14);
            ushort restartOffset = LittleEndianConverter.ToUInt16(buffer, offset + 0x18);

            MinorVersion         = LittleEndianConverter.ToInt16(buffer, offset + 0x1A);
            MajorVersion         = LittleEndianConverter.ToInt16(buffer, offset + 0x1C);
            UpdateSequenceNumber = LittleEndianConverter.ToUInt16(buffer, offset + multiSectorHeader.UpdateSequenceArrayOffset);
            RestartArea          = new LfsRestartArea(buffer, offset + restartOffset);
        }
Esempio n. 3
0
 public LfsRestartPage()
 {
     RestartArea  = new LfsRestartArea();
     MinorVersion = 1;
     MajorVersion = 1;
 }