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