#include "eio_private.h"
#include "Eio.h"
+/*============================================================================*
+ * Local *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
+
static void
_eio_eet_open_job(void *data, Ecore_Thread *thread)
{
_eio_eet_read_free(er);
}
+/**
+ * @endcond
+ */
+
+/*============================================================================*
+ * Global *
+ *============================================================================*/
+
+
+/*============================================================================*
+ * API *
+ *============================================================================*/
+
EAPI Eio_File *
eio_eet_open(const char *filename,
Eet_File_Mode mode,
#else
# include <asm/unistd.h>
# include <linux/inotify.h>
-static inline int inotify_init(void);
-static inline int inotify_add_watch(int fd, const char *name, __u32 mask);
-static inline int inotify_rm_watch(int fd, __u32 wd);
#endif
-struct _Eio_Monitor_Backend
-{
- Eio_Monitor *parent;
+/*============================================================================*
+ * Local *
+ *============================================================================*/
- int hwnd;
-};
-
-static Ecore_Fd_Handler *_inotify_fdh = NULL;
-static Eina_Hash *_inotify_monitors = NULL;
-
-static void
-_eio_inotify_del(void *data)
-{
- Eio_Monitor_Backend *emb = data;
- int fd;
-
- if (emb->hwnd)
- {
- fd = ecore_main_fd_handler_fd_get(_inotify_fdh);
- inotify_rm_watch(fd, emb->hwnd);
- emb->hwnd = 0;
- }
-
- free(emb);
-}
+/**
+ * @cond LOCAL
+ */
typedef struct _Eio_Inotify_Table Eio_Inotify_Table;
+
struct _Eio_Inotify_Table
{
int mask;
int *ev_dir_code;
};
+struct _Eio_Monitor_Backend
+{
+ Eio_Monitor *parent;
+
+ int hwnd;
+};
+
+static Ecore_Fd_Handler *_inotify_fdh = NULL;
+static Eina_Hash *_inotify_monitors = NULL;
+
#define EIO_INOTIFY_LINE(Ino, Ef, Ed) \
{ Ino, &EIO_MONITOR_##Ef, &EIO_MONITOR_##Ed }
EIO_INOTIFY_LINE(IN_UNMOUNT, SELF_DELETED, SELF_DELETED)
};
+#ifndef HAVE_SYS_INOTIFY
+static inline int
+inotify_init(void)
+{
+ return syscall(__NR_inotify_init);
+}
+
+static inline int
+inotify_add_watch(int fd, const char *name, __u32 mask)
+{
+ return syscall(__NR_inotify_add_watch, fd, name, mask);
+}
+
+static inline int
+inotify_rm_watch(int fd, __u32 wd)
+{
+ return syscall(__NR_inotify_rm_watch, fd, wd);
+}
+#endif
+
+static void
+_eio_inotify_del(void *data)
+{
+ Eio_Monitor_Backend *emb = data;
+ int fd;
+
+ if (emb->hwnd)
+ {
+ fd = ecore_main_fd_handler_fd_get(_inotify_fdh);
+ inotify_rm_watch(fd, emb->hwnd);
+ emb->hwnd = 0;
+ }
+
+ free(emb);
+}
+
static void
_eio_inotify_events(Eio_Monitor_Backend *backend, const char *file, int mask)
{
return ECORE_CALLBACK_RENEW;
}
+/**
+ * @endcond
+ */
+
+
+/*============================================================================*
+ * Global *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
+
+/**
+ * @endcond
+ */
+
void eio_monitor_backend_init(void)
{
int fd;
monitor->backend = NULL;
}
-#ifndef HAVE_SYS_INOTIFY
-static inline int
-inotify_init(void)
-{
- return syscall(__NR_inotify_init);
-}
-
-static inline int
-inotify_add_watch(int fd, const char *name, __u32 mask)
-{
- return syscall(__NR_inotify_add_watch, fd, name, mask);
-}
-static inline int
-inotify_rm_watch(int fd, __u32 wd)
-{
- return syscall(__NR_inotify_rm_watch, fd, wd);
-}
-#endif
+/*============================================================================*
+ * API *
+ *============================================================================*/
#include "eio_private.h"
#include "Eio.h"
-EAPI int EIO_MONITOR_ERROR;
-EAPI int EIO_MONITOR_FILE_CREATED;
-EAPI int EIO_MONITOR_FILE_DELETED;
-EAPI int EIO_MONITOR_FILE_MODIFIED;
-EAPI int EIO_MONITOR_FILE_CLOSED;
-EAPI int EIO_MONITOR_DIRECTORY_CREATED;
-EAPI int EIO_MONITOR_DIRECTORY_DELETED;
-EAPI int EIO_MONITOR_DIRECTORY_MODIFIED;
-EAPI int EIO_MONITOR_DIRECTORY_CLOSED;
-EAPI int EIO_MONITOR_SELF_RENAME;
-EAPI int EIO_MONITOR_SELF_DELETED;
+/*============================================================================*
+ * Local *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
static Eina_Hash *_eio_monitors = NULL;
static pid_t _monitor_pid = -1;
return ;
}
+/**
+ * @endcond
+ */
+
+/*============================================================================*
+ * Global *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
+
void
eio_monitor_init(void)
{
_monitor_pid = -1;
}
+void
+_eio_monitor_send(Eio_Monitor *monitor, const char *filename, int event_code)
+{
+ Eio_Monitor_Event *ev;
+
+ ev = calloc(1, sizeof (Eio_Monitor_Event));
+ if (!ev) return ;
+
+ ev->monitor = monitor;
+ EINA_REFCOUNT_REF(ev->monitor);
+ ev->filename = eina_stringshare_add(filename);
+
+ ecore_event_add(event_code, ev, _eio_monitor_event_cleanup_cb, NULL);
+}
+
+void
+_eio_monitor_rename(Eio_Monitor *monitor, const char *newpath)
+{
+ const char *tmp;
+
+ /* destroy old state */
+ if (monitor->exist) eio_file_cancel(monitor->exist);
+
+ if (monitor->backend)
+ {
+ if (!monitor->fallback)
+ eio_monitor_backend_del(monitor);
+ else
+ eio_monitor_fallback_del(monitor);
+ }
+
+ /* rename */
+ tmp = monitor->path;
+ monitor->path = eina_stringshare_add(newpath);
+ eina_hash_move(_eio_monitors, tmp, monitor->path);
+ eina_stringshare_del(tmp);
+
+ /* That means death (cmp pointer and not content) */
+ if (tmp == monitor->path)
+ {
+ _eio_monitor_error(monitor, -1);
+ return ;
+ }
+
+ EINA_REFCOUNT_REF(monitor); /* as we spawn a thread for this monitor, we need to refcount specifically for it */
+
+ /* restart */
+ monitor->rename = EINA_TRUE;
+ monitor->exist = eio_file_direct_stat(monitor->path,
+ _eio_monitor_stat_cb,
+ _eio_monitor_error_cb,
+ monitor);
+
+ /* FIXME: probably should handle this more gracefully */
+ if (!monitor->exist) abort();
+ /* and notify the app */
+ _eio_monitor_send(monitor, newpath, EIO_MONITOR_SELF_RENAME);
+}
+
+/**
+ * @endcond
+ */
+
+
+/*============================================================================*
+ * API *
+ *============================================================================*/
+
+EAPI int EIO_MONITOR_ERROR;
+EAPI int EIO_MONITOR_FILE_CREATED;
+EAPI int EIO_MONITOR_FILE_DELETED;
+EAPI int EIO_MONITOR_FILE_MODIFIED;
+EAPI int EIO_MONITOR_FILE_CLOSED;
+EAPI int EIO_MONITOR_DIRECTORY_CREATED;
+EAPI int EIO_MONITOR_DIRECTORY_DELETED;
+EAPI int EIO_MONITOR_DIRECTORY_MODIFIED;
+EAPI int EIO_MONITOR_DIRECTORY_CLOSED;
+EAPI int EIO_MONITOR_SELF_RENAME;
+EAPI int EIO_MONITOR_SELF_DELETED;
+
EAPI Eio_Monitor *
eio_monitor_add(const char *path)
{
EINA_SAFETY_ON_NULL_RETURN_VAL(monitor, NULL);
return monitor->path;
}
-
-void
-_eio_monitor_send(Eio_Monitor *monitor, const char *filename, int event_code)
-{
- Eio_Monitor_Event *ev;
-
- ev = calloc(1, sizeof (Eio_Monitor_Event));
- if (!ev) return ;
-
- ev->monitor = monitor;
- EINA_REFCOUNT_REF(ev->monitor);
- ev->filename = eina_stringshare_add(filename);
-
- ecore_event_add(event_code, ev, _eio_monitor_event_cleanup_cb, NULL);
-}
-
-void
-_eio_monitor_rename(Eio_Monitor *monitor, const char *newpath)
-{
- const char *tmp;
-
- /* destroy old state */
- if (monitor->exist) eio_file_cancel(monitor->exist);
-
- if (monitor->backend)
- {
- if (!monitor->fallback)
- eio_monitor_backend_del(monitor);
- else
- eio_monitor_fallback_del(monitor);
- }
-
- /* rename */
- tmp = monitor->path;
- monitor->path = eina_stringshare_add(newpath);
- eina_hash_move(_eio_monitors, tmp, monitor->path);
- eina_stringshare_del(tmp);
-
- /* That means death (cmp pointer and not content) */
- if (tmp == monitor->path)
- {
- _eio_monitor_error(monitor, -1);
- return ;
- }
-
- EINA_REFCOUNT_REF(monitor); /* as we spawn a thread for this monitor, we need to refcount specifically for it */
-
- /* restart */
- monitor->rename = EINA_TRUE;
- monitor->exist = eio_file_direct_stat(monitor->path,
- _eio_monitor_stat_cb,
- _eio_monitor_error_cb,
- monitor);
-
- /* FIXME: probably should handle this more gracefully */
- if (!monitor->exist) abort();
- /* and notify the app */
- _eio_monitor_send(monitor, newpath, EIO_MONITOR_SELF_RENAME);
-}
#include "eio_private.h"
#include "Eio.h"
+/*============================================================================*
+ * Local *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
+
typedef struct _Eio_Monitor_Stat Eio_Monitor_Stat;
+
struct _Eio_Monitor_Stat
{
Eina_Stat buffer;
static Eina_Bool _eio_monitor_fallback_timer_cb(void *data);
-#if !defined HAVE_INOTIFY && !defined HAVE_NOTIFY_WIN32
-void eio_monitor_backend_init(void)
-{
-}
-
-void eio_monitor_backend_shutdown(void)
-{
-}
-
-void eio_monitor_backend_add(Eio_Monitor *monitor)
-{
- eio_monitor_fallback_add(monitor);
-}
-
-void eio_monitor_backend_del(Eio_Monitor *monitor)
-{
- eio_monitor_fallback_del(monitor);
-}
-#endif
-
static void
_eio_monitor_fallback_heavy_cb(void *data, Ecore_Thread *thread)
{
return EINA_FALSE;
}
+/**
+ * @endcond
+ */
+
+/*============================================================================*
+ * Global *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
+
+#if !defined HAVE_INOTIFY && !defined HAVE_NOTIFY_WIN32
+void eio_monitor_backend_init(void)
+{
+}
+
+void eio_monitor_backend_shutdown(void)
+{
+}
+
+void eio_monitor_backend_add(Eio_Monitor *monitor)
+{
+ eio_monitor_fallback_add(monitor);
+}
+
+void eio_monitor_backend_del(Eio_Monitor *monitor)
+{
+ eio_monitor_fallback_del(monitor);
+}
+#endif
+
void
eio_monitor_fallback_init(void)
{
}
free(backend);
}
+
+/**
+ * @endcond
+ */
+
+
+/*============================================================================*
+ * API *
+ *============================================================================*/
#include "eio_private.h"
#include "Eio.h"
+/*============================================================================*
+ * Local *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
+
struct _Eio_Monitor_Backend
{
};
+/**
+ * @endcond
+ */
+
+/*============================================================================*
+ * Global *
+ *============================================================================*/
+
+/**
+ * @cond LOCAL
+ */
+
void eio_monitor_backend_init(void)
{
abort();
void eio_monitor_backend_del(Eio_Monitor *monitor)
{
}
+
+
+/**
+ * @endcond
+ */
+
+
+/*============================================================================*
+ * API *
+ *============================================================================*/