2018-10-10 11:53:07 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AK/ByteBuffer.h>
|
|
|
|
#include <AK/Types.h>
|
|
|
|
|
|
|
|
class FileSystem;
|
|
|
|
struct InodeMetadata;
|
|
|
|
|
|
|
|
class InodeIdentifier {
|
|
|
|
public:
|
|
|
|
InodeIdentifier() { }
|
|
|
|
InodeIdentifier(dword fileSystemID, dword inode)
|
|
|
|
: m_fileSystemID(fileSystemID)
|
|
|
|
, m_index(inode)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool isValid() const { return m_fileSystemID != 0 && m_index != 0; }
|
|
|
|
|
2018-11-15 15:10:12 +01:00
|
|
|
dword fsid() const { return m_fileSystemID; }
|
2018-10-10 11:53:07 +02:00
|
|
|
dword index() const { return m_index; }
|
|
|
|
|
|
|
|
FileSystem* fileSystem();
|
|
|
|
const FileSystem* fileSystem() const;
|
|
|
|
|
|
|
|
bool operator==(const InodeIdentifier& other) const
|
|
|
|
{
|
|
|
|
return m_fileSystemID == other.m_fileSystemID && m_index == other.m_index;
|
|
|
|
}
|
|
|
|
|
2018-10-24 14:28:22 +02:00
|
|
|
bool operator!=(const InodeIdentifier& other) const
|
|
|
|
{
|
|
|
|
return m_fileSystemID != other.m_fileSystemID || m_index != other.m_index;
|
|
|
|
}
|
|
|
|
|
2018-10-10 11:53:07 +02:00
|
|
|
InodeMetadata metadata() const;
|
|
|
|
bool isRootInode() const;
|
|
|
|
|
|
|
|
ByteBuffer readEntireFile() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
dword m_fileSystemID { 0 };
|
|
|
|
dword m_index { 0 };
|
|
|
|
};
|
|
|
|
|