2017-09-14 21:20:32 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Locus.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : Locus filesystem plugin
|
2017-09-14 21:20:32 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Identifies the Locus filesystem and shows information.
|
2017-09-14 21:20:32 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ 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 aint with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2018-12-29 17:34:38 +00:00
|
|
|
|
// Copyright © 2011-2019 Natalia Portillo
|
2017-09-14 21:20:32 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
2017-12-22 08:43:22 +00:00
|
|
|
|
using System.Diagnostics.CodeAnalysis;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
using System.Runtime.InteropServices;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using DiscImageChef.CommonTypes;
|
2018-06-25 19:08:16 +01:00
|
|
|
|
using DiscImageChef.CommonTypes.Interfaces;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
using DiscImageChef.Console;
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using Schemas;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
// Commit count
|
|
|
|
|
|
using commitcnt_t = System.Int32;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
// Disk address
|
|
|
|
|
|
using daddr_t = System.Int32;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
// Fstore
|
|
|
|
|
|
using fstore_t = System.Int32;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
// Global File System number
|
|
|
|
|
|
using gfs_t = System.Int32;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
// Inode number
|
|
|
|
|
|
using ino_t = System.Int32;
|
2019-03-01 07:35:22 +00:00
|
|
|
|
using Marshal = DiscImageChef.Helpers.Marshal;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
// Filesystem pack number
|
|
|
|
|
|
using pckno_t = System.Int16;
|
2017-12-19 19:33:46 +00:00
|
|
|
|
// Timestamp
|
|
|
|
|
|
using time_t = System.Int32;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Filesystems
|
|
|
|
|
|
{
|
2017-12-26 06:05:12 +00:00
|
|
|
|
public class Locus : IFilesystem
|
2017-09-14 21:20:32 +01:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
const int NICINOD = 325;
|
|
|
|
|
|
const int NICFREE = 600;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
const int OLDNICINOD = 700;
|
|
|
|
|
|
const int OLDNICFREE = 500;
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
const uint LOCUS_MAGIC = 0xFFEEDDCD;
|
|
|
|
|
|
const uint LOCUS_CIGAM = 0xCDDDEEFF;
|
2018-06-20 22:22:21 +01:00
|
|
|
|
const uint LOCUS_MAGIC_OLD = 0xFFEEDDCC;
|
|
|
|
|
|
const uint LOCUS_CIGAM_OLD = 0xCCDDEEFF;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
public FileSystemType XmlFsType { get; private set; }
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public Encoding Encoding { get; private set; }
|
|
|
|
|
|
public string Name => "Locus Filesystem Plugin";
|
|
|
|
|
|
public Guid Id => new Guid("1A70B30A-437D-479A-88E1-D0C9C1797FF4");
|
2018-08-29 22:15:43 +01:00
|
|
|
|
public string Author => "Natalia Portillo";
|
2017-10-12 23:54:02 +01:00
|
|
|
|
|
2017-12-26 07:28:40 +00:00
|
|
|
|
public bool Identify(IMediaImage imagePlugin, Partition partition)
|
2017-09-14 21:20:32 +01:00
|
|
|
|
{
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(imagePlugin.Info.SectorSize < 512) return false;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
|
|
|
|
|
for(ulong location = 0; location <= 8; location++)
|
|
|
|
|
|
{
|
2019-03-01 07:35:22 +00:00
|
|
|
|
uint sbSize = (uint)(Marshal.SizeOf<Locus_Superblock>() / imagePlugin.Info.SectorSize);
|
|
|
|
|
|
if(Marshal.SizeOf<Locus_Superblock>() % imagePlugin.Info.SectorSize != 0) sbSize++;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(partition.Start + location + sbSize >= imagePlugin.Info.Sectors) break;
|
2017-11-08 17:05:00 +00:00
|
|
|
|
|
2017-09-14 21:20:32 +01:00
|
|
|
|
byte[] sector = imagePlugin.ReadSectors(partition.Start + location, sbSize);
|
2019-03-01 07:35:22 +00:00
|
|
|
|
if(sector.Length < Marshal.SizeOf<Locus_Superblock>()) return false;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2019-03-01 07:35:22 +00:00
|
|
|
|
Locus_Superblock locusSb = Marshal.ByteArrayToStructureLittleEndian<Locus_Superblock>(sector);
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2018-06-20 22:22:21 +01:00
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "magic at {1} = 0x{0:X8}", locusSb.s_magic, location);
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM ||
|
2018-06-20 22:22:21 +01:00
|
|
|
|
locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) return true;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Encoding encoding)
|
2017-09-14 21:20:32 +01:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
2017-09-14 21:20:32 +01:00
|
|
|
|
information = "";
|
2017-12-26 06:05:12 +00:00
|
|
|
|
if(imagePlugin.Info.SectorSize < 512) return;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2018-06-20 22:22:21 +01:00
|
|
|
|
Locus_Superblock locusSb = new Locus_Superblock();
|
2018-06-22 08:08:38 +01:00
|
|
|
|
byte[] sector = null;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
|
|
|
|
|
for(ulong location = 0; location <= 8; location++)
|
|
|
|
|
|
{
|
2019-03-01 07:35:22 +00:00
|
|
|
|
uint sbSize = (uint)(Marshal.SizeOf<Locus_Superblock>() / imagePlugin.Info.SectorSize);
|
|
|
|
|
|
if(Marshal.SizeOf<Locus_Superblock>() % imagePlugin.Info.SectorSize != 0) sbSize++;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
|
|
|
|
|
sector = imagePlugin.ReadSectors(partition.Start + location, sbSize);
|
2019-03-01 07:35:22 +00:00
|
|
|
|
if(sector.Length < Marshal.SizeOf<Locus_Superblock>()) return;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2019-03-01 07:35:22 +00:00
|
|
|
|
locusSb = Marshal.ByteArrayToStructureLittleEndian<Locus_Superblock>(sector);
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
if(locusSb.s_magic == LOCUS_MAGIC || locusSb.s_magic == LOCUS_CIGAM ||
|
2018-06-20 22:22:21 +01:00
|
|
|
|
locusSb.s_magic == LOCUS_MAGIC_OLD || locusSb.s_magic == LOCUS_CIGAM_OLD) break;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// We don't care about old version for information
|
2018-06-20 22:22:21 +01:00
|
|
|
|
if(locusSb.s_magic != LOCUS_MAGIC && locusSb.s_magic != LOCUS_CIGAM && locusSb.s_magic != LOCUS_MAGIC_OLD &&
|
|
|
|
|
|
locusSb.s_magic != LOCUS_CIGAM_OLD) return;
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
|
|
|
|
|
// Numerical arrays are not important for information so no need to swap them
|
2018-06-20 22:22:21 +01:00
|
|
|
|
if(locusSb.s_magic == LOCUS_CIGAM || locusSb.s_magic == LOCUS_CIGAM_OLD)
|
2017-09-14 21:20:32 +01:00
|
|
|
|
{
|
2019-03-01 07:35:22 +00:00
|
|
|
|
locusSb = Marshal.ByteArrayToStructureBigEndian<Locus_Superblock>(sector);
|
2018-06-20 22:22:21 +01:00
|
|
|
|
locusSb.s_flags = (LocusFlags)Swapping.Swap((ushort)locusSb.s_flags);
|
2017-09-14 21:20:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
2018-06-20 22:22:21 +01:00
|
|
|
|
sb.AppendLine(locusSb.s_magic == LOCUS_MAGIC_OLD ? "Locus filesystem (old)" : "Locus filesystem");
|
|
|
|
|
|
|
|
|
|
|
|
int blockSize = locusSb.s_version == LocusVersion.SB_SB4096 ? 4096 : 1024;
|
|
|
|
|
|
|
|
|
|
|
|
string s_fsmnt = StringHandlers.CToString(locusSb.s_fsmnt, Encoding);
|
|
|
|
|
|
string s_fpack = StringHandlers.CToString(locusSb.s_fpack, Encoding);
|
|
|
|
|
|
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_magic = 0x{0:X8}", locusSb.s_magic);
|
2018-06-22 08:08:38 +01:00
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfs = {0}", locusSb.s_gfs);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fsize = {0}", locusSb.s_fsize);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lwm = {0}", locusSb.s_lwm);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_hwm = {0}", locusSb.s_hwm);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_llst = {0}", locusSb.s_llst);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fstore = {0}", locusSb.s_fstore);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_time = {0}", locusSb.s_time);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tfree = {0}", locusSb.s_tfree);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_isize = {0}", locusSb.s_isize);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nfree = {0}", locusSb.s_nfree);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flags = {0}", locusSb.s_flags);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_tinode = {0}", locusSb.s_tinode);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_lasti = {0}", locusSb.s_lasti);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_nbehind = {0}", locusSb.s_nbehind);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfspack = {0}", locusSb.s_gfspack);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ninode = {0}", locusSb.s_ninode);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_flock = {0}", locusSb.s_flock);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_ilock = {0}", locusSb.s_ilock);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_fmod = {0}", locusSb.s_fmod);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_version = {0}", locusSb.s_version);
|
2018-06-20 22:22:21 +01:00
|
|
|
|
|
|
|
|
|
|
sb.AppendFormat("Superblock last modified on {0}", DateHandlers.UnixToDateTime(locusSb.s_time))
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2018-06-20 22:22:21 +01:00
|
|
|
|
sb.AppendFormat("Volume has {0} blocks of {1} bytes each (total {2} bytes)", locusSb.s_fsize, blockSize,
|
|
|
|
|
|
locusSb.s_fsize * blockSize).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("{0} blocks free ({1} bytes)", locusSb.s_tfree, locusSb.s_tfree * blockSize).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("I-node list uses {0} blocks", locusSb.s_isize).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("{0} free inodes", locusSb.s_tinode).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("Next free inode search will start at inode {0}", locusSb.s_lasti).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("There are an estimate of {0} free inodes before next search start", locusSb.s_nbehind)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
.AppendLine();
|
2018-06-20 22:22:21 +01:00
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_RDONLY)) sb.AppendLine("Read-only volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN)) sb.AppendLine("Clean volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY)) sb.AppendLine("Dirty volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_RMV)) sb.AppendLine("Removable volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_PRIMPACK)) sb.AppendLine("This is the primary pack");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_REPLTYPE)) sb.AppendLine("Replicated volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_USER)) sb.AppendLine("User replicated volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_BACKBONE)) sb.AppendLine("Backbone volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_NFS)) sb.AppendLine("NFS volume");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_BYHAND)) sb.AppendLine("Volume inhibits automatic fsck");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_NOSUID)) sb.AppendLine("Set-uid/set-gid is disabled");
|
|
|
|
|
|
if(locusSb.s_flags.HasFlag(LocusFlags.SB_SYNCW)) sb.AppendLine("Volume uses synchronous writes");
|
2017-09-14 21:20:32 +01:00
|
|
|
|
sb.AppendFormat("Volume label: {0}", s_fsmnt).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("Physical volume name: {0}", s_fpack).AppendLine();
|
2018-06-20 22:22:21 +01:00
|
|
|
|
sb.AppendFormat("Global File System number: {0}", locusSb.s_gfs).AppendLine();
|
|
|
|
|
|
sb.AppendFormat("Global File System pack number {0}", locusSb.s_gfspack).AppendLine();
|
2017-09-14 21:20:32 +01:00
|
|
|
|
|
|
|
|
|
|
information = sb.ToString();
|
|
|
|
|
|
|
2017-12-26 08:01:40 +00:00
|
|
|
|
XmlFsType = new FileSystemType
|
2017-09-14 21:20:32 +01:00
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Type = "Locus filesystem",
|
2017-09-14 21:20:32 +01:00
|
|
|
|
ClusterSize = blockSize,
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Clusters = locusSb.s_fsize,
|
2017-09-14 21:20:32 +01:00
|
|
|
|
// Sometimes it uses one, or the other. Use the bigger
|
2018-06-22 08:08:38 +01:00
|
|
|
|
VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt,
|
|
|
|
|
|
ModificationDate = DateHandlers.UnixToDateTime(locusSb.s_time),
|
2017-09-14 21:20:32 +01:00
|
|
|
|
ModificationDateSpecified = true,
|
2018-06-22 08:08:38 +01:00
|
|
|
|
Dirty = !locusSb.s_flags.HasFlag(LocusFlags.SB_CLEAN) ||
|
|
|
|
|
|
locusSb.s_flags.HasFlag(LocusFlags.SB_DIRTY),
|
|
|
|
|
|
FreeClusters = locusSb.s_tfree,
|
2017-12-21 02:52:12 +00:00
|
|
|
|
FreeClustersSpecified = true
|
2017-09-14 21:20:32 +01:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2017-12-24 02:37:41 +00:00
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
|
|
|
|
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
struct Locus_Superblock
|
|
|
|
|
|
{
|
|
|
|
|
|
public uint s_magic; /* identifies this as a locus filesystem */
|
|
|
|
|
|
/* defined as a constant below */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public gfs_t s_gfs; /* global filesystem number */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
public daddr_t s_fsize; /* size in blocks of entire volume */
|
|
|
|
|
|
/* several ints for replicated filsystems */
|
|
|
|
|
|
public commitcnt_t s_lwm; /* all prior commits propagated */
|
|
|
|
|
|
public commitcnt_t s_hwm; /* highest commit propagated */
|
|
|
|
|
|
/* oldest committed version in the list.
|
|
|
|
|
|
* llst mod NCMTLST is the offset of commit #llst in the list,
|
|
|
|
|
|
* which wraps around from there.
|
|
|
|
|
|
*/
|
|
|
|
|
|
public commitcnt_t s_llst;
|
|
|
|
|
|
public fstore_t s_fstore; /* filesystem storage bit mask; if the
|
|
|
|
|
|
filsys is replicated and this is not a
|
|
|
|
|
|
primary or backbone copy, this bit mask
|
|
|
|
|
|
determines which files are stored */
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public time_t s_time; /* last super block update */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
public daddr_t s_tfree; /* total free blocks*/
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public ino_t s_isize; /* size in blocks of i-list */
|
|
|
|
|
|
public short s_nfree; /* number of addresses in s_free */
|
|
|
|
|
|
public LocusFlags s_flags; /* filsys flags, defined below */
|
|
|
|
|
|
public ino_t s_tinode; /* total free inodes */
|
|
|
|
|
|
public ino_t s_lasti; /* start place for circular search */
|
|
|
|
|
|
public ino_t s_nbehind; /* est # free inodes before s_lasti */
|
|
|
|
|
|
public pckno_t s_gfspack; /* global filesystem pack number */
|
|
|
|
|
|
public short s_ninode; /* number of i-nodes in s_inode */
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
|
|
|
|
|
public short[] s_dinfo; /* interleave stuff */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
//#define s_m s_dinfo[0]
|
|
|
|
|
|
//#define s_skip s_dinfo[0] /* AIX defines */
|
|
|
|
|
|
//#define s_n s_dinfo[1]
|
|
|
|
|
|
//#define s_cyl s_dinfo[1] /* AIX defines */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public byte s_flock; /* lock during free list manipulation */
|
|
|
|
|
|
public byte s_ilock; /* lock during i-list manipulation */
|
|
|
|
|
|
public byte s_fmod; /* super block modified flag */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
public LocusVersion s_version; /* version of the data format in fs. */
|
|
|
|
|
|
/* defined below. */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
|
|
|
|
|
public byte[] s_fsmnt; /* name of this file system */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
|
public byte[] s_fpack; /* name of this physical volume */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NICINOD)]
|
|
|
|
|
|
public ino_t[] s_inode; /* free i-node list */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = NICFREE)]
|
|
|
|
|
|
public daddr_t[] su_free; /* free block list for non-replicated filsys */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public byte s_byteorder; /* byte order of integers */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
|
|
|
|
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
|
|
|
|
|
struct Locus_OldSuperblock
|
|
|
|
|
|
{
|
|
|
|
|
|
public uint s_magic; /* identifies this as a locus filesystem */
|
|
|
|
|
|
/* defined as a constant below */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public gfs_t s_gfs; /* global filesystem number */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
public daddr_t s_fsize; /* size in blocks of entire volume */
|
|
|
|
|
|
/* several ints for replicated filsystems */
|
|
|
|
|
|
public commitcnt_t s_lwm; /* all prior commits propagated */
|
|
|
|
|
|
public commitcnt_t s_hwm; /* highest commit propagated */
|
|
|
|
|
|
/* oldest committed version in the list.
|
|
|
|
|
|
* llst mod NCMTLST is the offset of commit #llst in the list,
|
|
|
|
|
|
* which wraps around from there.
|
|
|
|
|
|
*/
|
|
|
|
|
|
public commitcnt_t s_llst;
|
|
|
|
|
|
public fstore_t s_fstore; /* filesystem storage bit mask; if the
|
|
|
|
|
|
filsys is replicated and this is not a
|
|
|
|
|
|
primary or backbone copy, this bit mask
|
|
|
|
|
|
determines which files are stored */
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public time_t s_time; /* last super block update */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
public daddr_t s_tfree; /* total free blocks*/
|
|
|
|
|
|
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public ino_t s_isize; /* size in blocks of i-list */
|
|
|
|
|
|
public short s_nfree; /* number of addresses in s_free */
|
|
|
|
|
|
public LocusFlags s_flags; /* filsys flags, defined below */
|
|
|
|
|
|
public ino_t s_tinode; /* total free inodes */
|
|
|
|
|
|
public ino_t s_lasti; /* start place for circular search */
|
|
|
|
|
|
public ino_t s_nbehind; /* est # free inodes before s_lasti */
|
|
|
|
|
|
public pckno_t s_gfspack; /* global filesystem pack number */
|
|
|
|
|
|
public short s_ninode; /* number of i-nodes in s_inode */
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
|
|
|
|
|
public short[] s_dinfo; /* interleave stuff */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
//#define s_m s_dinfo[0]
|
|
|
|
|
|
//#define s_skip s_dinfo[0] /* AIX defines */
|
|
|
|
|
|
//#define s_n s_dinfo[1]
|
|
|
|
|
|
//#define s_cyl s_dinfo[1] /* AIX defines */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public byte s_flock; /* lock during free list manipulation */
|
|
|
|
|
|
public byte s_ilock; /* lock during i-list manipulation */
|
|
|
|
|
|
public byte s_fmod; /* super block modified flag */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
public LocusVersion s_version; /* version of the data format in fs. */
|
|
|
|
|
|
/* defined below. */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
|
|
|
|
|
public byte[] s_fsmnt; /* name of this file system */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
|
public byte[] s_fpack; /* name of this physical volume */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = OLDNICINOD)]
|
|
|
|
|
|
public ino_t[] s_inode; /* free i-node list */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = OLDNICFREE)]
|
|
|
|
|
|
public daddr_t[] su_free; /* free block list for non-replicated filsys */
|
2018-06-22 08:08:38 +01:00
|
|
|
|
public byte s_byteorder; /* byte order of integers */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
|
|
|
|
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
|
|
|
|
|
[Flags]
|
|
|
|
|
|
enum LocusFlags : ushort
|
|
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
SB_RDONLY = 0x1, /* no writes on filesystem */
|
|
|
|
|
|
SB_CLEAN = 0x2, /* fs unmounted cleanly (or checks run) */
|
|
|
|
|
|
SB_DIRTY = 0x4, /* fs mounted without CLEAN bit set */
|
|
|
|
|
|
SB_RMV = 0x8, /* fs is a removable file system */
|
|
|
|
|
|
SB_PRIMPACK = 0x10, /* This is the primary pack of the filesystem */
|
|
|
|
|
|
SB_REPLTYPE = 0x20, /* This is a replicated type filesystem. */
|
|
|
|
|
|
SB_USER = 0x40, /* This is a "user" replicated filesystem. */
|
|
|
|
|
|
SB_BACKBONE = 0x80, /* backbone pack ; complete copy of primary pack but not modifiable */
|
|
|
|
|
|
SB_NFS = 0x100, /* This is a NFS type filesystem */
|
|
|
|
|
|
SB_BYHAND = 0x200, /* Inhibits automatic fscks on a mangled file system */
|
|
|
|
|
|
SB_NOSUID = 0x400, /* Set-uid/Set-gid is disabled */
|
|
|
|
|
|
SB_SYNCW = 0x800 /* Synchronous Write */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
|
|
|
|
|
[SuppressMessage("ReSharper", "BuiltInTypeReferenceStyle")]
|
|
|
|
|
|
[Flags]
|
|
|
|
|
|
enum LocusVersion : byte
|
|
|
|
|
|
{
|
2018-06-22 08:08:38 +01:00
|
|
|
|
SB_SB4096 = 1, /* smallblock filesys with 4096 byte blocks */
|
|
|
|
|
|
SB_B1024 = 2, /* 1024 byte block filesystem */
|
|
|
|
|
|
NUMSCANDEV = 5 /* Used by scangfs(), refed in space.h */
|
2017-12-24 02:37:41 +00:00
|
|
|
|
}
|
2017-09-14 21:20:32 +01:00
|
|
|
|
}
|
|
|
|
|
|
}
|