[pfs] Implement statfs.

This commit is contained in:
2026-02-07 01:55:24 +00:00
parent 4b495523b0
commit 331372ecfe
2 changed files with 56 additions and 5 deletions

View File

@@ -0,0 +1,56 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Super.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Professional File System plugin.
//
// --[ 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 <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2026 Natalia Portillo
// ****************************************************************************/
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs;
namespace Aaru.Filesystems;
/// <inheritdoc />
public sealed partial class PFS
{
/// <inheritdoc />
public ErrorNumber StatFs(out FileSystemInfo stat)
{
stat = null;
if(!_mounted) return ErrorNumber.AccessDenied;
stat = new FileSystemInfo
{
Blocks = _rootBlock.diskSize,
FilenameLength = (ushort)(_hasExtension ? _filenameSize : DNSIZE - 2), // Default 30 chars
FreeBlocks = _rootBlock.blocksfree,
FreeFiles = 0, // PFS doesn't have a fixed inode count
PluginId = Id,
Type = FS_TYPE
};
return ErrorNumber.NoError;
}
}

View File

@@ -29,7 +29,6 @@
using System;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
namespace Aaru.Filesystems;
@@ -40,10 +39,6 @@ public sealed partial class PFS
public ErrorNumber Unmount() => throw new NotImplementedException();
/// <inheritdoc />
public ErrorNumber StatFs(out FileSystemInfo stat) => throw new NotImplementedException();
/// <inheritdoc />
public ErrorNumber ReadLink(string path, out string dest) => throw new NotImplementedException();