summaryrefslogtreecommitdiff
path: root/src/lib/ecore_file/ecore_file_monitor_inotify.c
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-06 13:38:34 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-12-06 13:38:34 +0000
commit62bb4646c9fee3f535c3810a7cdba114043d14d4 (patch)
treefad3ac78c2163cb5ebebb916c5ca52e3ed5f4ef0 /src/lib/ecore_file/ecore_file_monitor_inotify.c
parent6a5eaacc6ada22808ec8515ef2b414883f4f59fe (diff)
efl/ecore_file: refactor to be more like eio in providing backends.
instead of the previous mess, just define the functions with common names and call the backend that was compiled in, similar to what eio does. also do not be silent on errors, use eina_safety_checks to issue warnings. SVN revision: 80360
Diffstat (limited to 'src/lib/ecore_file/ecore_file_monitor_inotify.c')
-rw-r--r--src/lib/ecore_file/ecore_file_monitor_inotify.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c
index 9cb5de83e6..9f9818dcd7 100644
--- a/src/lib/ecore_file/ecore_file_monitor_inotify.c
+++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c
@@ -20,8 +20,6 @@
20 * - Listen to IN_IGNORED, emitted when the watch is removed 20 * - Listen to IN_IGNORED, emitted when the watch is removed
21 */ 21 */
22 22
23#ifdef HAVE_SYS_INOTIFY_H
24
25#include <sys/inotify.h> 23#include <sys/inotify.h>
26 24
27 25
@@ -48,7 +46,7 @@ static void _ecore_file_monitor_inotify_print(char *file, int mas
48#endif 46#endif
49 47
50int 48int
51ecore_file_monitor_inotify_init(void) 49ecore_file_monitor_backend_init(void)
52{ 50{
53 int fd; 51 int fd;
54 52
@@ -69,12 +67,12 @@ ecore_file_monitor_inotify_init(void)
69} 67}
70 68
71int 69int
72ecore_file_monitor_inotify_shutdown(void) 70ecore_file_monitor_backend_shutdown(void)
73{ 71{
74 int fd; 72 int fd;
75 73
76 while(_monitors) 74 while(_monitors)
77 ecore_file_monitor_inotify_del(_monitors); 75 ecore_file_monitor_backend_del(_monitors);
78 76
79 if (_fdh) 77 if (_fdh)
80 { 78 {
@@ -87,7 +85,7 @@ ecore_file_monitor_inotify_shutdown(void)
87} 85}
88 86
89Ecore_File_Monitor * 87Ecore_File_Monitor *
90ecore_file_monitor_inotify_add(const char *path, 88ecore_file_monitor_backend_add(const char *path,
91 void (*func) (void *data, Ecore_File_Monitor *em, 89 void (*func) (void *data, Ecore_File_Monitor *em,
92 Ecore_File_Event event, 90 Ecore_File_Event event,
93 const char *path), 91 const char *path),
@@ -100,8 +98,8 @@ ecore_file_monitor_inotify_add(const char *path,
100 98
101 if (_inotify_fd_pid != getpid()) 99 if (_inotify_fd_pid != getpid())
102 { 100 {
103 ecore_file_monitor_inotify_shutdown(); 101 ecore_file_monitor_backend_shutdown();
104 ecore_file_monitor_inotify_init(); 102 ecore_file_monitor_backend_init();
105 } 103 }
106 104
107 em = calloc(1, sizeof(Ecore_File_Monitor_Inotify)); 105 em = calloc(1, sizeof(Ecore_File_Monitor_Inotify));
@@ -124,7 +122,7 @@ ecore_file_monitor_inotify_add(const char *path,
124} 122}
125 123
126void 124void
127ecore_file_monitor_inotify_del(Ecore_File_Monitor *em) 125ecore_file_monitor_backend_del(Ecore_File_Monitor *em)
128{ 126{
129 int fd; 127 int fd;
130 128
@@ -283,7 +281,7 @@ _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path)
283 if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0) 281 if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0)
284 { 282 {
285 INF("inotify_add_watch failed, file was deleted"); 283 INF("inotify_add_watch failed, file was deleted");
286 ecore_file_monitor_inotify_del(em); 284 ecore_file_monitor_backend_del(em);
287 return 0; 285 return 0;
288 } 286 }
289 return 1; 287 return 1;
@@ -328,4 +326,3 @@ _ecore_file_monitor_inotify_print(char *file, int mask)
328 INF("Inotify unmount %s: %s", type, file); 326 INF("Inotify unmount %s: %s", type, file);
329} 327}
330#endif 328#endif
331#endif /* HAVE_SYS_INOTIFY_H */