NetworkInador/lib/file_watcher.h

55 lines
1.6 KiB
C

/*
* file_watcher.h
* This file is part of Network-inador
*
* Copyright (C) 2025 - Félix Arreola Rodríguez
*
* Network-inador is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Network-inador is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Network-inador; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef __FILE_WATCHER_H__
#define __FILE_WATCHER_H__
#include "network-inador-public.h"
#include "flist.h"
typedef void (*FileWatcherCloseWriteCB) (NetworkInadorHandle *handle, const char *path, void *data);
typedef struct {
int inotify_wd;
char path[4096];
FileWatcherCloseWriteCB close_write_cb;
void *close_write_data;
} INotifyWD;
typedef struct {
int has_inotify;
int inotify_fd;
int inotify_source;
FList *wds;
} NetworkInadorFileWatcher;
void network_inador_file_watcher_init (NetworkInadorHandle *handle);
void network_inador_file_watcher_add_file (NetworkInadorHandle *handle, const char *path, FileWatcherCloseWriteCB close_write_cb, void *close_write_data);
void network_inador_file_watcher_cleanup (NetworkInadorHandle *handle);
#endif /* __FILE_WATCHER_H__ */