On Thu, Dec 06, 2012 at 05:38:36AM -0800, Enlightenment SVN wrote: > Log: > 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. > > > > Author: barbieri > Date: 2012-12-06 05:38:34 -0800 (Thu, 06 Dec 2012) > New Revision: 80360 > Trac: http://trac.enlightenment.org/e/changeset/80360 > > Modified: > trunk/efl/configure.ac trunk/efl/src/Makefile_Ecore_File.am > trunk/efl/src/Makefile_Eio.am > trunk/efl/src/lib/ecore_file/ecore_file_monitor.c > trunk/efl/src/lib/ecore_file/ecore_file_monitor_inotify.c > trunk/efl/src/lib/ecore_file/ecore_file_monitor_poll.c > trunk/efl/src/lib/ecore_file/ecore_file_monitor_win32.c > trunk/efl/src/lib/ecore_file/ecore_file_private.h > > Modified: trunk/efl/configure.ac > =================================================================== > --- trunk/efl/configure.ac 2012-12-06 13:24:27 UTC (rev 80359) > +++ trunk/efl/configure.ac 2012-12-06 13:38:34 UTC (rev 80360) > @@ -478,6 +478,13 @@ > have_inotify="${ac_cv_header_sys_inotify_h}" > AM_CONDITIONAL([HAVE_INOTIFY], [test "x${have_inotify}" = "xyes"]) > > +have_notify_win32="${have_win32}" > +AC_DEFINE_IF([HAVE_NOTIFY_WIN32], > + [test "x${have_notify_win32}" = "xyes"], > + [File monitoring with Windows notification])
Missing val argument here... it should be: AC_DEFINE_IF([HAVE_NOTIFY_WIN32], [test "x${have_notify_win32}" = "xyes"], [1], [File monitoring with Windows notification]) > +AM_CONDITIONAL([HAVE_NOTIFY_WIN32], [test "x${have_notify_win32}" = "xyes"]) > + > + > EFL_CHECK_PATH_MAX > > > @@ -2392,17 +2399,6 @@ > have_poll="yes" > fi > > -have_notify_win32="no" > - > -case "$host_os" in > - mingw32ce*) > - ;; > - mingw32*) > - have_notify_win32="yes" > - AC_DEFINE([HAVE_NOTIFY_WIN32], [1], [File monitoring with Windows > notification]) > - ;; > -esac > - > if ! test "x${have_atfile_source}" = "xno" ; then > AC_CHECK_FUNCS([mkdirat], > [ > @@ -3933,11 +3929,6 @@ > > AC_MSG_RESULT([${have_xattr}]) > > -# Check for inotify specificity > -have_notify_win32="no" > -EIO_CHECK_NOTIFY_WIN32([have_notify_win32="yes"], [have_notify_win32="no"]) > -AM_CONDITIONAL([EIO_HAVE_WINCHANGE], [test "x${have_notify_win32}" = "xyes"]) > - > #### End of Eio > > > > Modified: trunk/efl/src/Makefile_Ecore_File.am > =================================================================== > --- trunk/efl/src/Makefile_Ecore_File.am 2012-12-06 13:24:27 UTC (rev > 80359) > +++ trunk/efl/src/Makefile_Ecore_File.am 2012-12-06 13:38:34 UTC (rev > 80360) > @@ -11,12 +11,22 @@ > lib/ecore_file/ecore_file.c \ > lib/ecore_file/ecore_file_download.c \ > lib/ecore_file/ecore_file_monitor.c \ > -lib/ecore_file/ecore_file_monitor_inotify.c \ > -lib/ecore_file/ecore_file_monitor_poll.c \ > -lib/ecore_file/ecore_file_monitor_win32.c \ > lib/ecore_file/ecore_file_path.c \ > lib/ecore_file/ecore_file_private.h > > +if HAVE_INOTIFY > +lib_ecore_file_libecore_file_la_SOURCES += \ > +lib/ecore_file/ecore_file_monitor_inotify.c > +else > +if HAVE_NOTIFY_WIN32 > +lib_ecore_file_libecore_file_la_SOURCES += \ > +lib/ecore_file/ecore_file_monitor_win32.c > +else > +lib_ecore_file_libecore_file_la_SOURCES += \ > +lib/ecore_file/ecore_file_monitor_poll.c > +endif > +endif > + > lib_ecore_file_libecore_file_la_CPPFLAGS = \ > -I$(top_srcdir)/src/lib/eina \ > -I$(top_srcdir)/src/lib/eo \ > > Modified: trunk/efl/src/Makefile_Eio.am > =================================================================== > --- trunk/efl/src/Makefile_Eio.am 2012-12-06 13:24:27 UTC (rev 80359) > +++ trunk/efl/src/Makefile_Eio.am 2012-12-06 13:38:34 UTC (rev 80360) > @@ -21,7 +21,7 @@ > if HAVE_INOTIFY > lib_eio_libeio_la_SOURCES += lib/eio/eio_monitor_inotify.c > else > -if EIO_HAVE_WINCHANGE > +if HAVE_NOTIFY_WIN32 > lib_eio_libeio_la_SOURCES += lib/eio/eio_monitor_win32.c > endif > endif > > Modified: trunk/efl/src/lib/ecore_file/ecore_file_monitor.c > =================================================================== > --- trunk/efl/src/lib/ecore_file/ecore_file_monitor.c 2012-12-06 13:24:27 UTC > (rev 80359) > +++ trunk/efl/src/lib/ecore_file/ecore_file_monitor.c 2012-12-06 13:38:34 UTC > (rev 80360) > @@ -4,66 +4,18 @@ > > #include "ecore_file_private.h" > > -typedef enum { > - ECORE_FILE_MONITOR_TYPE_NONE, > -#ifdef HAVE_SYS_INOTIFY_H > - ECORE_FILE_MONITOR_TYPE_INOTIFY, > -#endif > -#ifdef HAVE_NOTIFY_WIN32 > - ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32, > -#endif > -#ifdef HAVE_POLL > - ECORE_FILE_MONITOR_TYPE_POLL > -#endif > -} Ecore_File_Monitor_Type; > - > -static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; > - > int > ecore_file_monitor_init(void) > { > -#ifdef HAVE_SYS_INOTIFY_H > - monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY; > - if (ecore_file_monitor_inotify_init()) > + if (ecore_file_monitor_backend_init()) > return 1; > -#endif > -#ifdef HAVE_NOTIFY_WIN32 > - monitor_type = ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32; > - if (ecore_file_monitor_win32_init()) > - return 1; > -#endif > -#ifdef HAVE_POLL > - monitor_type = ECORE_FILE_MONITOR_TYPE_POLL; > - if (ecore_file_monitor_poll_init()) > - return 1; > -#endif > - monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; > return 0; > } > > void > ecore_file_monitor_shutdown(void) > { > - switch (monitor_type) > - { > - case ECORE_FILE_MONITOR_TYPE_NONE: > - break; > -#ifdef HAVE_SYS_INOTIFY_H > - case ECORE_FILE_MONITOR_TYPE_INOTIFY: > - ecore_file_monitor_inotify_shutdown(); > - break; > -#endif > -#ifdef HAVE_NOTIFY_WIN32 > - case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: > - ecore_file_monitor_win32_shutdown(); > - break; > -#endif > -#ifdef HAVE_POLL > - case ECORE_FILE_MONITOR_TYPE_POLL: > - ecore_file_monitor_poll_shutdown(); > - break; > -#endif > - } > + ecore_file_monitor_backend_shutdown(); > } > > /** > @@ -94,27 +46,11 @@ > Ecore_File_Monitor_Cb func, > void *data) > { > - if (!path || !*path) > - return NULL; > + EINA_SAFETY_ON_NULL_RETURN_VAL(path, NULL); > + EINA_SAFETY_ON_TRUE_RETURN_VAL(path[0] == '\0', NULL); > + EINA_SAFETY_ON_NULL_RETURN_VAL(func, NULL); > > - switch (monitor_type) > - { > - case ECORE_FILE_MONITOR_TYPE_NONE: > - return NULL; > -#ifdef HAVE_SYS_INOTIFY_H > - case ECORE_FILE_MONITOR_TYPE_INOTIFY: > - return ecore_file_monitor_inotify_add(path, func, data); > -#endif > -#ifdef HAVE_NOTIFY_WIN32 > - case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: > - return ecore_file_monitor_win32_add(path, func, data); > -#endif > -#ifdef HAVE_POLL > - case ECORE_FILE_MONITOR_TYPE_POLL: > - return ecore_file_monitor_poll_add(path, func, data); > -#endif > - } > - return NULL; > + return ecore_file_monitor_backend_add(path, func, data); > } > > /** > @@ -131,29 +67,8 @@ > EAPI void > ecore_file_monitor_del(Ecore_File_Monitor *em) > { > - if (!em) > - return; > - > - switch (monitor_type) > - { > - case ECORE_FILE_MONITOR_TYPE_NONE: > - break; > -#ifdef HAVE_SYS_INOTIFY_H > - case ECORE_FILE_MONITOR_TYPE_INOTIFY: > - ecore_file_monitor_inotify_del(em); > - break; > -#endif > -#ifdef HAVE_NOTIFY_WIN32 > - case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: > - ecore_file_monitor_win32_del(em); > - break; > -#endif > -#ifdef HAVE_POLL > - case ECORE_FILE_MONITOR_TYPE_POLL: > - ecore_file_monitor_poll_del(em); > - break; > -#endif > - } > + EINA_SAFETY_ON_NULL_RETURN(em); > + ecore_file_monitor_backend_del(em); > } > > /** > @@ -170,8 +85,7 @@ > EAPI const char * > ecore_file_monitor_path_get(Ecore_File_Monitor *em) > { > - if (!em) > - return NULL; > + EINA_SAFETY_ON_NULL_RETURN_VAL(em, NULL); > return em->path; > } > > > Modified: trunk/efl/src/lib/ecore_file/ecore_file_monitor_inotify.c > =================================================================== > --- trunk/efl/src/lib/ecore_file/ecore_file_monitor_inotify.c 2012-12-06 > 13:24:27 UTC (rev 80359) > +++ trunk/efl/src/lib/ecore_file/ecore_file_monitor_inotify.c 2012-12-06 > 13:38:34 UTC (rev 80360) > @@ -20,8 +20,6 @@ > * - Listen to IN_IGNORED, emitted when the watch is removed > */ > > -#ifdef HAVE_SYS_INOTIFY_H > - > #include <sys/inotify.h> > > > @@ -48,7 +46,7 @@ > #endif > > int > -ecore_file_monitor_inotify_init(void) > +ecore_file_monitor_backend_init(void) > { > int fd; > > @@ -69,12 +67,12 @@ > } > > int > -ecore_file_monitor_inotify_shutdown(void) > +ecore_file_monitor_backend_shutdown(void) > { > int fd; > > while(_monitors) > - ecore_file_monitor_inotify_del(_monitors); > + ecore_file_monitor_backend_del(_monitors); > > if (_fdh) > { > @@ -87,7 +85,7 @@ > } > > Ecore_File_Monitor * > -ecore_file_monitor_inotify_add(const char *path, > +ecore_file_monitor_backend_add(const char *path, > void (*func) (void *data, Ecore_File_Monitor > *em, > Ecore_File_Event event, > const char *path), > @@ -100,8 +98,8 @@ > > if (_inotify_fd_pid != getpid()) > { > - ecore_file_monitor_inotify_shutdown(); > - ecore_file_monitor_inotify_init(); > + ecore_file_monitor_backend_shutdown(); > + ecore_file_monitor_backend_init(); > } > > em = calloc(1, sizeof(Ecore_File_Monitor_Inotify)); > @@ -124,7 +122,7 @@ > } > > void > -ecore_file_monitor_inotify_del(Ecore_File_Monitor *em) > +ecore_file_monitor_backend_del(Ecore_File_Monitor *em) > { > int fd; > > @@ -283,7 +281,7 @@ > if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0) > { > INF("inotify_add_watch failed, file was deleted"); > - ecore_file_monitor_inotify_del(em); > + ecore_file_monitor_backend_del(em); > return 0; > } > return 1; > @@ -328,4 +326,3 @@ > INF("Inotify unmount %s: %s", type, file); > } > #endif > -#endif /* HAVE_SYS_INOTIFY_H */ > > Modified: trunk/efl/src/lib/ecore_file/ecore_file_monitor_poll.c > =================================================================== > --- trunk/efl/src/lib/ecore_file/ecore_file_monitor_poll.c 2012-12-06 > 13:24:27 UTC (rev 80359) > +++ trunk/efl/src/lib/ecore_file/ecore_file_monitor_poll.c 2012-12-06 > 13:38:34 UTC (rev 80360) > @@ -8,8 +8,6 @@ > > #include "ecore_file_private.h" > > -#ifdef HAVE_POLL > - > /* > * TODO: > * - Implement recursive as an option! > @@ -43,16 +41,16 @@ > static int _ecore_file_monitor_poll_checking(Ecore_File_Monitor *em, > char *name); > > int > -ecore_file_monitor_poll_init(void) > +ecore_file_monitor_backend_init(void) > { > return 1; > } > > int > -ecore_file_monitor_poll_shutdown(void) > +ecore_file_monitor_backend_shutdown(void) > { > while(_monitors) > - ecore_file_monitor_poll_del(_monitors); > + ecore_file_monitor_backend_del(_monitors); > > if (_timer) > { > @@ -63,7 +61,7 @@ > } > > Ecore_File_Monitor * > -ecore_file_monitor_poll_add(const char *path, > +ecore_file_monitor_backend_add(const char *path, > void (*func) (void *data, Ecore_File_Monitor *em, > Ecore_File_Event event, > const char *path), > @@ -125,7 +123,7 @@ > } > else > { > - ecore_file_monitor_poll_del(em); > + ecore_file_monitor_backend_del(em); > return NULL; > } > > @@ -133,7 +131,7 @@ > } > > void > -ecore_file_monitor_poll_del(Ecore_File_Monitor *em) > +ecore_file_monitor_backend_del(Ecore_File_Monitor *em) > { > Ecore_File *l; > > @@ -337,4 +335,3 @@ > } > return 0; > } > -#endif > > Modified: trunk/efl/src/lib/ecore_file/ecore_file_monitor_win32.c > =================================================================== > --- trunk/efl/src/lib/ecore_file/ecore_file_monitor_win32.c 2012-12-06 > 13:24:27 UTC (rev 80359) > +++ trunk/efl/src/lib/ecore_file/ecore_file_monitor_win32.c 2012-12-06 > 13:38:34 UTC (rev 80360) > @@ -6,8 +6,6 @@ > # include <config.h> > #endif > > -#ifdef HAVE_NOTIFY_WIN32 > - > # define WIN32_LEAN_AND_MEAN > # include <windows.h> > # undef WIN32_LEAN_AND_MEAN > @@ -225,19 +223,19 @@ > } > > int > -ecore_file_monitor_win32_init(void) > +ecore_file_monitor_backend_init(void) > { > return 1; > } > > int > -ecore_file_monitor_win32_shutdown(void) > +ecore_file_monitor_backend_shutdown(void) > { > return 1; > } > > Ecore_File_Monitor * > -ecore_file_monitor_win32_add(const char *path, > +ecore_file_monitor_backend_add(const char *path, > void (*func) (void *data, Ecore_File_Monitor > *em, > Ecore_File_Event event, > const char *path), > @@ -293,7 +291,7 @@ > } > > void > -ecore_file_monitor_win32_del(Ecore_File_Monitor *em) > +ecore_file_monitor_backend_del(Ecore_File_Monitor *em) > { > Ecore_File_Monitor_Win32 *m; > > @@ -306,5 +304,3 @@ > free(em->path); > free(em); > } > - > -#endif > > Modified: trunk/efl/src/lib/ecore_file/ecore_file_private.h > =================================================================== > --- trunk/efl/src/lib/ecore_file/ecore_file_private.h 2012-12-06 13:24:27 UTC > (rev 80359) > +++ trunk/efl/src/lib/ecore_file/ecore_file_private.h 2012-12-06 13:38:34 UTC > (rev 80360) > @@ -81,43 +81,16 @@ > Ecore_File *files; > }; > > -#ifdef HAVE_SYS_INOTIFY_H > -int ecore_file_monitor_inotify_init(void); > -int ecore_file_monitor_inotify_shutdown(void); > -Ecore_File_Monitor *ecore_file_monitor_inotify_add(const char *path, > - void (*func) (void > *data, > - > Ecore_File_Monitor *ecore_file_monitor, > - > Ecore_File_Event event, > - const > char *path), > - void *data); > -void ecore_file_monitor_inotify_del(Ecore_File_Monitor > *ecore_file_monitor); > -#endif > - > -#ifdef HAVE_NOTIFY_WIN32 > -int ecore_file_monitor_win32_init(void); > -int ecore_file_monitor_win32_shutdown(void); > -Ecore_File_Monitor *ecore_file_monitor_win32_add(const char *path, > - void (*func) (void > *data, > - > Ecore_File_Monitor *ecore_file_monitor, > - > Ecore_File_Event event, > - const > char *path), > - void *data); > -void ecore_file_monitor_win32_del(Ecore_File_Monitor > *ecore_file_monitor); > -#endif > +int ecore_file_monitor_backend_init(void); > +int ecore_file_monitor_backend_shutdown(void); > +Ecore_File_Monitor *ecore_file_monitor_backend_add(const char *path, > + void (*func) (void *data, > + > Ecore_File_Monitor *ecore_file_monitor, > + > Ecore_File_Event event, > + const char > *path), > + void *data); > +void ecore_file_monitor_backend_del(Ecore_File_Monitor > *ecore_file_monitor); > > -#ifdef HAVE_POLL > -int ecore_file_monitor_poll_init(void); > -int ecore_file_monitor_poll_shutdown(void); > -Ecore_File_Monitor *ecore_file_monitor_poll_add(const char *path, > - void (*func) (void *data, > - > Ecore_File_Monitor *ecore_file_monitor, > - > Ecore_File_Event event, > - const char > *path), > - void *data); > -void ecore_file_monitor_poll_del(Ecore_File_Monitor > *ecore_file_monitor); > - > -#endif > - > /* ecore_file_path */ > void ecore_file_path_init(void); > void ecore_file_path_shutdown(void); > > > ------------------------------------------------------------------------------ > LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial > Remotely access PCs and mobile devices and provide instant support > Improve your efficiency, and focus on delivering more value-add services > Discover what IT Professionals Know. Rescue delivers > http://p.sf.net/sfu/logmein_12329d2d > _______________________________________________ > enlightenment-svn mailing list > enlightenment-...@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/enlightenment-svn -- Leandro Dorileo ProFUSION embedded systems http://profusion.mobi ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ enlightenment-devel mailing list enlightenment-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-devel