You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.3 KiB
47 lines
1.3 KiB
#ifndef SCOT_FS_WATCHER_H
|
|
#define SCOT_FS_WATCHER_H
|
|
|
|
#include <scot/event_listener.h>
|
|
#include <scot/thread.h>
|
|
#include <scot/stream.h>
|
|
|
|
#include <scot/list_type_proto.h>
|
|
|
|
struct scot_fsw_info
|
|
{
|
|
int watch_d;
|
|
char * path;
|
|
uint32_t mask;
|
|
uint32_t got_events; /* also a mask, that shows, which events already
|
|
occured (will be 0 at init and after a callback was
|
|
called.) */
|
|
char * old_name; /* This is used within rename events. With inotify
|
|
a rename is build up from 2 inotify_events.
|
|
IN_MOVE_FROM and IN_MOVE_TO. The move from
|
|
event holds the old name. This old name is saved
|
|
here if an IN_MOVE_FORM occured. */
|
|
};
|
|
typedef struct scot_fsw_info scot_fsw_info;
|
|
GEN_LIST_TYPE_PROTO (scot_fsw_info);
|
|
|
|
struct scot_fs_watcher
|
|
{
|
|
struct scot_event_listener el;
|
|
fd_set rfds;
|
|
struct scot_stream notify_d;
|
|
|
|
list_scot_fsw_info_node_t * w_list;
|
|
THREAD_MUTEX_T mutex;
|
|
};
|
|
|
|
|
|
struct scot_fs_watcher * scot_fs_watcher_new (void);
|
|
void scot_fs_watcher_free (struct scot_fs_watcher *);
|
|
|
|
void scot_fs_watcher_add (struct scot_fs_watcher *, const char *, uint32_t);
|
|
void scot_fs_watcher_remove (struct scot_fs_watcher *, const char *, uint32_t);
|
|
|
|
int scot_fs_watcher_get_mask (struct scot_fs_watcher *, int);
|
|
void scot_fs_watcher_main_loop (struct scot_fs_watcher *);
|
|
|
|
#endif /* SCOT_FS_WATCHER_H */
|