#ifndef FILEWATCH_H_ #define FILEWATCH_H_ #include "array/array.h" #include "types.h" typedef struct FileWatcherContext FileWatcherContext; typedef struct FileWatch FileWatch; /** * Search for a FileWatch matching by watch descriptor. * * @param ctx * @param wd Watch descriptor given by inotipy * @param index Will contain the first occurrance of a matching FileWatch. Can * be null. */ FileWatch *file_watch_find_by_wd(FileWatcherContext *ctx, int wd, size_t *index); /** * Search for a FileWatch in a particular context matching by filepath. * @param ctx * @param path An absolute path for the file searched for * @param index Will contain the first occurrance of a matching FileWatch. Can * be null. */ FileWatch *file_watch_find_by_path(FileWatcherContext *ctx, const char *path, size_t *index); /** * Create FileWatch, start monitoring for changes and generating events. * * Creats a parent FileWatch if it doesn't already exist. */ HiResult file_watch_add(FileWatcherContext *ctx, u32 mask, const char *path); /** * Stop a watch, clear all references and free memory */ HiResult file_watch_remove(FileWatcherContext *ctx, const char *path); /** * Free memory and clear all watches in this context */ void file_watch_destroy_watches(FileWatcherContext *ctx); #endif // FILEWATCH_H_