[JFS] Implement statfs.

This commit is contained in:
2026-02-25 03:23:29 +00:00
parent 67b6a09afb
commit 389dc48dc0
3 changed files with 66 additions and 5 deletions

View File

@@ -38,6 +38,9 @@ public sealed partial class JFS
const string FS_TYPE = "jfs";
const string MODULE_NAME = "JFS plugin";
/// <summary>Maximum filename length in JFS</summary>
const ushort JFS_NAME_MAX = 255;
/// <summary>Byte offset of the aggregate inode table (AITBL_OFF)</summary>
const long AITBL_OFF = 0xB000;

View File

@@ -0,0 +1,63 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Super.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : IBM JFS filesystem 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 />
/// <summary>Implements detection of IBM's Journaled File System</summary>
public sealed partial class JFS
{
/// <inheritdoc />
public ErrorNumber StatFs(out FileSystemInfo stat)
{
stat = null;
if(!_mounted) return ErrorNumber.AccessDenied;
stat = new FileSystemInfo
{
Blocks = _superblock.s_size / _superblock.s_bsize,
FilenameLength = JFS_NAME_MAX,
FreeBlocks = 0, // Would require parsing the block allocation map
Files = 0, // Would require parsing the inode allocation map
FreeFiles = 0, // Would require parsing the inode allocation map
PluginId = Id,
Type = FS_TYPE,
Id =
{
IsGuid = true,
uuid = _superblock.s_uuid
}
};
return ErrorNumber.NoError;
}
}

View File

@@ -29,16 +29,11 @@
using System;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
namespace Aaru.Filesystems;
public sealed partial class JFS
{
/// <inheritdoc />
public ErrorNumber StatFs(out FileSystemInfo stat) => throw new NotImplementedException();
/// <inheritdoc />
public ErrorNumber ReadLink(string path, out string dest) => throw new NotImplementedException();