InodeIdentifier.h 881 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include <AK/ByteBuffer.h>
  3. #include <AK/Types.h>
  4. class FS;
  5. struct InodeMetadata;
  6. class InodeIdentifier {
  7. public:
  8. InodeIdentifier() { }
  9. InodeIdentifier(dword fileSystemID, dword inode)
  10. : m_fsid(fileSystemID)
  11. , m_index(inode)
  12. {
  13. }
  14. bool is_valid() const { return m_fsid != 0 && m_index != 0; }
  15. dword fsid() const { return m_fsid; }
  16. dword index() const { return m_index; }
  17. FS* fs();
  18. const FS* fs() const;
  19. bool operator==(const InodeIdentifier& other) const
  20. {
  21. return m_fsid == other.m_fsid && m_index == other.m_index;
  22. }
  23. bool operator!=(const InodeIdentifier& other) const
  24. {
  25. return m_fsid != other.m_fsid || m_index != other.m_index;
  26. }
  27. bool is_root_inode() const;
  28. ByteBuffer read_entire_file() const;
  29. private:
  30. dword m_fsid { 0 };
  31. dword m_index { 0 };
  32. };