InodeWatcherEvent.h 857 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2020-2021, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/EnumBits.h>
  8. #include <AK/Types.h>
  9. #ifdef KERNEL
  10. # include <Kernel/API/POSIX/sys/limits.h>
  11. #else
  12. # include <limits.h>
  13. #endif
  14. struct [[gnu::packed]] InodeWatcherEvent {
  15. enum class Type : u32 {
  16. Invalid = 0,
  17. MetadataModified = 1 << 0,
  18. ContentModified = 1 << 1,
  19. Deleted = 1 << 2,
  20. ChildCreated = 1 << 3,
  21. ChildDeleted = 1 << 4,
  22. };
  23. int watch_descriptor { 0 };
  24. Type type { Type::Invalid };
  25. size_t name_length { 0 };
  26. // This is a VLA which is written during the read() from the descriptor.
  27. char const name[];
  28. };
  29. AK_ENUM_BITWISE_OPERATORS(InodeWatcherEvent::Type);
  30. constexpr unsigned MAXIMUM_EVENT_SIZE = sizeof(InodeWatcherEvent) + NAME_MAX + 1;