diff --git a/Aaru.Filesystems/extFS/Unimplemented.cs b/Aaru.Filesystems/extFS/Super.cs similarity index 58% rename from Aaru.Filesystems/extFS/Unimplemented.cs rename to Aaru.Filesystems/extFS/Super.cs index 9eafc1b49..b2c789bd2 100644 --- a/Aaru.Filesystems/extFS/Unimplemented.cs +++ b/Aaru.Filesystems/extFS/Super.cs @@ -2,7 +2,7 @@ // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // -// Filename : Unimplemented.cs +// Filename : Super.cs // Author(s) : Natalia Portillo // // Component : Linux extended filesystem plugin. @@ -26,11 +26,9 @@ // Copyright © 2011-2026 Natalia Portillo // ****************************************************************************/ -using System; -using System.Collections.Generic; -using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; +using Aaru.Logging; namespace Aaru.Filesystems; @@ -39,13 +37,32 @@ namespace Aaru.Filesystems; public sealed partial class extFS { /// - public FileSystem Metadata { get; private set; } - /// - public IEnumerable<(string name, Type type, string description)> SupportedOptions { get; } - /// - public Dictionary Namespaces { get; } + public ErrorNumber StatFs(out FileSystemInfo stat) + { + stat = null; + if(!_mounted) return ErrorNumber.AccessDenied; - /// - public ErrorNumber StatFs(out FileSystemInfo stat) => throw new NotImplementedException(); + AaruLogging.Debug(MODULE_NAME, "StatFs: returning filesystem statistics"); + + stat = new FileSystemInfo + { + Blocks = _superblock.s_nzones, + FreeBlocks = _superblock.s_freeblockscount, + FilenameLength = EXT_NAME_LEN, + Type = FS_TYPE, + Files = _superblock.s_ninodes, + FreeFiles = _superblock.s_freeinodescount, + PluginId = Id + }; + + AaruLogging.Debug(MODULE_NAME, + "StatFs complete: totalBlocks={0}, freeBlocks={1}, inodes={2}, freeInodes={3}", + _superblock.s_nzones, + _superblock.s_freeblockscount, + _superblock.s_ninodes, + _superblock.s_freeinodescount); + + return ErrorNumber.NoError; + } } \ No newline at end of file diff --git a/Aaru.Filesystems/extFS/extFS.cs b/Aaru.Filesystems/extFS/extFS.cs index b616743ac..1e866620b 100644 --- a/Aaru.Filesystems/extFS/extFS.cs +++ b/Aaru.Filesystems/extFS/extFS.cs @@ -29,6 +29,7 @@ using System; using System.Collections.Generic; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; using Partition = Aaru.CommonTypes.Partition; @@ -43,7 +44,7 @@ public sealed partial class extFS : IReadOnlyFilesystem const string MODULE_NAME = "extFS plugin"; /// Cached root directory entries (filename to inode number) - readonly Dictionary _rootDirectoryCache = new(); + readonly Dictionary _rootDirectoryCache = []; /// The encoding used for filenames Encoding _encoding; @@ -59,6 +60,12 @@ public sealed partial class extFS : IReadOnlyFilesystem /// The cached superblock ext_super_block _superblock; + /// + public FileSystem Metadata { get; private set; } + /// + public IEnumerable<(string name, Type type, string description)> SupportedOptions { get; } = []; + /// + public Dictionary Namespaces { get; } = []; #region IFilesystem Members