// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : Structs.cs // Author(s) : Natalia Portillo // // Component : Files-11 On-Disk Structure plugin. // // --[ Description ] ---------------------------------------------------------- // // Identifies the Files-11 On-Disk Structure and shows information. // // --[ License ] -------------------------------------------------------------- // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 2.1 of the // License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, see . // // ---------------------------------------------------------------------------- // Copyright © 2011-2025 Natalia Portillo // ****************************************************************************/ using System.Runtime.InteropServices; namespace Aaru.Filesystems; // Information from VMS File System Internals by Kirby McCoy // ISBN: 1-55558-056-4 // With some hints from http://www.decuslib.com/DECUS/vmslt97b/gnusoftware/gccaxp/7_1/vms/hm2def.h // Expects the home block to be always in sector #1 (does not check deltas) // Assumes a sector size of 512 bytes (VMS does on HDDs and optical drives, dunno about M.O.) // Book only describes ODS-2. Need to test ODS-1 and ODS-5 // There is an ODS with signature "DECFILES11A", yet to be seen // Time is a 64 bit unsigned integer, tenths of microseconds since 1858/11/17 00:00:00. // TODO: Implement checksum /// /// Implements detection of DEC's On-Disk Structure, aka the ODS filesystem public sealed partial class ODS { #region Nested type: HomeBlock [StructLayout(LayoutKind.Sequential, Pack = 1)] readonly struct HomeBlock { /// 0x000, LBN of THIS home block public readonly uint homelbn; /// 0x004, LBN of the secondary home block public readonly uint alhomelbn; /// 0x008, LBN of backup INDEXF.SYS;1 public readonly uint altidxlbn; /// 0x00C, High byte contains filesystem version (1, 2 or 5), low byte contains revision (1) public readonly ushort struclev; /// 0x00E, Number of blocks each bit of the volume bitmap represents public readonly ushort cluster; /// 0x010, VBN of THIS home block public readonly ushort homevbn; /// 0x012, VBN of the secondary home block public readonly ushort alhomevbn; /// 0x014, VBN of backup INDEXF.SYS;1 public readonly ushort altidxvbn; /// 0x016, VBN of the bitmap public readonly ushort ibmapvbn; /// 0x018, LBN of the bitmap public readonly uint ibmaplbn; /// 0x01C, Max files on volume public readonly uint maxfiles; /// 0x020, Bitmap size in sectors public readonly ushort ibmapsize; /// 0x022, Reserved files, 5 at minimum public readonly ushort resfiles; /// 0x024, Device type, ODS-2 defines it as always 0 public readonly ushort devtype; /// 0x026, Relative volume number (number of the volume in a set) public readonly ushort rvn; /// 0x028, Total number of volumes in the set this volume is public readonly ushort setcount; /// 0x02A, Flags public readonly ushort volchar; /// 0x02C, User ID of the volume owner public readonly uint volowner; /// 0x030, Security mask (??) public readonly uint sec_mask; /// 0x034, Volume permissions (system, owner, group and other) public readonly ushort protect; /// 0x036, Default file protection, unsupported in ODS-2 public readonly ushort fileprot; /// 0x038, Default file record protection public readonly ushort recprot; /// 0x03A, Checksum of all preceding entries public readonly ushort checksum1; /// 0x03C, Creation date public readonly ulong credate; /// 0x044, Window size (pointers for the window) public readonly byte window; /// 0x045, Directories to be stored in cache public readonly byte lru_lim; /// 0x046, Default allocation size in blocks public readonly ushort extend; /// 0x048, Minimum file retention period public readonly ulong retainmin; /// 0x050, Maximum file retention period public readonly ulong retainmax; /// 0x058, Last modification date public readonly ulong revdate; /// 0x060, Minimum security class, 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public readonly byte[] min_class; /// 0x074, Maximum security class, 20 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 20)] public readonly byte[] max_class; /// 0x088, File lookup table FID public readonly ushort filetab_fid1; /// 0x08A, File lookup table FID public readonly ushort filetab_fid2; /// 0x08C, File lookup table FID public readonly ushort filetab_fid3; /// 0x08E, Lowest structure level on the volume public readonly ushort lowstruclev; /// 0x090, Highest structure level on the volume public readonly ushort highstruclev; /// 0x092, Volume copy date (??) public readonly ulong copydate; /// 0x09A, 302 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 302)] public readonly byte[] reserved1; /// 0x1C8, Physical drive serial number public readonly uint serialnum; /// 0x1CC, Name of the volume set, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public readonly byte[] strucname; /// 0x1D8, Volume label, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public readonly byte[] volname; /// 0x1E4, Name of the volume owner, 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public readonly byte[] ownername; /// 0x1F0, ODS-2 defines it as "DECFILE11B", 12 bytes [MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public readonly byte[] format; /// 0x1FC, Reserved public readonly ushort reserved2; /// 0x1FE, Checksum of preceding 255 words (16 bit units) public readonly ushort checksum2; } #endregion }