UnveilNode.h 885 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <AK/Trie.h>
  9. namespace Kernel {
  10. enum UnveilAccess {
  11. Read = 1,
  12. Write = 2,
  13. Execute = 4,
  14. CreateOrRemove = 8,
  15. Browse = 16,
  16. None = 0,
  17. };
  18. struct UnveilNode;
  19. struct UnveilMetadata {
  20. String full_path;
  21. UnveilAccess permissions { None };
  22. bool explicitly_unveiled { false };
  23. };
  24. struct UnveilNode final : public Trie<String, UnveilMetadata, Traits<String>, UnveilNode> {
  25. using Trie<String, UnveilMetadata, Traits<String>, UnveilNode>::Trie;
  26. bool was_explicitly_unveiled() const { return this->metadata_value().explicitly_unveiled; }
  27. UnveilAccess permissions() const { return this->metadata_value().permissions; }
  28. const String& path() const { return this->metadata_value().full_path; }
  29. };
  30. }